Created
November 23, 2017 15:14
-
-
Save pikesley/4cab0261550b93c42c1ab3a8d1fbdea8 to your computer and use it in GitHub Desktop.
Run this as root to configure WiFi for Hypriot https://blog.hypriot.com/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
[ ${2} ] || ( echo "usage ${0} <SSID> <PSK>" && exit 1 ) | |
echo -n "Writing /etc/wpa_supplicant/wpa_supplicant.conf... " | |
echo "network={ | |
ssid=\"${1}\" | |
psk=\"${2}\" | |
}" > /etc/wpa_supplicant/wpa_supplicant.conf | |
echo "done" | |
echo -n "Writing /etc/network/interfaces.d/wlan0... " | |
echo "iface wlan0 inet manual | |
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf | |
iface default inet dhcp" > /etc/network/interfaces.d/wlan0 | |
echo "done" | |
echo -n "Writing /etc/rc.local... " | |
echo "#!/bin/sh -e | |
# rc.local | |
ifup wlan0 | |
exit 0" > /etc/rc.local | |
echo "done" | |
echo "Time to reboot" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment