Skip to content

Instantly share code, notes, and snippets.

@xxmatyuk
Last active September 7, 2019 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xxmatyuk/cc2bd1d2cef0fcf7980ebf29feb47b7f to your computer and use it in GitHub Desktop.
Save xxmatyuk/cc2bd1d2cef0fcf7980ebf29feb47b7f to your computer and use it in GitHub Desktop.
Pi post boot script
#!/bin/bash
# Parse args
ssid="$1"
password="$2"
# Create Wi-Fi config
cat > wpa_supplicant.conf <<EOF
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US
network={
ssid="${ssid}"
psk="${password}"
key_mgmt=WPA-PSK
}
EOF
# Make Pi ssh-accessible
echo '' > ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment