Adding pi-gen sources as of v9-beta3

This commit is contained in:
Richard Goodwin
2018-10-31 07:53:41 -05:00
parent 7c6f46083f
commit d3745aafde
14 changed files with 376 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
#! /bin/bash -eu
HEADLESS_SETUP=false
if [ -e "/boot/teslausb-headless-setup.log" ]
then
HEADLESS_SETUP=true
fi
function setup_progress () {
if [ $HEADLESS_SETUP = "true" ]
then
SETUP_LOGFILE=/boot/teslausb-headless-setup.log
echo "$( date ) : $1" >> "$SETUP_LOGFILE"
fi
echo $1
}
function enable_wifi () {
setup_progress "Detecting whether to update wpa_supplicant.conf"
if [ ! -z ${SSID+x} ] && [ ! -z ${WIFIPASS+x} ]
then
if [ ! -e /boot/WIFI_ENABLED ]
then
if [ -e /root/bin/remountfs_rw ]
then
/root/bin/remountfs_rw
fi
setup_progress "Wifi variables specified, and no /boot/WIFI_ENABLED. Building wpa_supplicant.conf."
cp /boot/wpa_supplicant.conf.sample /boot/wpa_supplicant.conf
sed -i'.bak' -e "s/TEMPSSID/${SSID}/g" /boot/wpa_supplicant.conf
sed -i'.bak' -e "s/TEMPPASS/${WIFIPASS}/g" /boot/wpa_supplicant.conf
cp /boot/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf
touch /boot/WIFI_ENABLED
setup_progress "Rebooting..."
reboot
fi
else
echo "You need to export your desired SSID and WIFI pass like:"
echo " export SSID=your_ssid"
echo " export WIFIPASS=your_wifi_pass"
echo ""
echo "Then re-run enable_wifi.sh"
fi
}
enable_wifi