From f8c24f115d9a2e8498d55eba88806008e1514e44 2019-11-11 23:17:28 From: Unknown Date: 2019-11-11 23:17:28 Subject: [PATCH] a --- diff --git a/README.md b/README.md index f1e9572..1dacf64 100644 --- a/README.md +++ b/README.md @@ -164,7 +164,7 @@ Set the IP address for the second NTP server. ##### `NET_WIFI_SSID`="" Set to your WIFI SSID -##### `NET_WIFI_WPAPSK`="" +##### `NET_WIFI_PSK`="" Set your WPA/WPA2 PSK --- diff --git a/bootstrap.d/20-networking.sh b/bootstrap.d/20-networking.sh index a9bbfd2..21095ec 100644 --- a/bootstrap.d/20-networking.sh +++ b/bootstrap.d/20-networking.sh @@ -88,21 +88,23 @@ else # ENABLE_ETH_DHCP=false "${ETC_DIR}/systemd/network/wlan0.network" fi -printf " -ctrl_interface=/run/wpa_supplicant -ctrl_interface_group=wheel -update_config=1 -eapol_version=1 -ap_scan=1 -fast_reauth=1 - -" > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf - -#Configure WPA_supplicant -chroot_exec wpa_passphrase "$NET_SSID" "$NET_WPAPSK" >> /etc/wpa_supplicant/wpa_supplicant-wlan0.conf - -chroot_exec systemctl enable wpa_supplicant.service -chroot_exec systemctl enable wpa_supplicant@wlan0.service +if [ -z "$NET_WIFI_SSID" ] && [ -z "$NET_WIFI_PSK" ] ; then + printf " + ctrl_interface=/run/wpa_supplicant + ctrl_interface_group=wheel + update_config=1 + eapol_version=1 + ap_scan=1 + fast_reauth=1 + + " > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf + + #Configure WPA_supplicant + chroot_exec wpa_passphrase "$NET_SSID" "$NET_WPAPSK" >> /etc/wpa_supplicant/wpa_supplicant-wlan0.conf + + chroot_exec systemctl enable wpa_supplicant.service + chroot_exec systemctl enable wpa_supplicant@wlan0.service +fi # Remove empty settings from network configuration sed -i "/.*=\$/d" "${ETC_DIR}/systemd/network/eth0.network" diff --git a/files/firstboot/42-config-ifnames.sh b/files/firstboot/42-config-ifnames.sh index 9bb9bfe..5de911e 100644 --- a/files/firstboot/42-config-ifnames.sh +++ b/files/firstboot/42-config-ifnames.sh @@ -25,4 +25,8 @@ if [ ! -z INTERFACE_NAME_WIFI ] ; then fi # Move config to new interface name mv /etc/systemd/network/wlan0.network /etc/systemd/network/"${INTERFACE_NAME_WIFI}".network + + systemctl disable wpa_supplicant@wlan0.service + systemctl enable wpa_supplicant@"${INTERFACE_NAME_WIFI}".service + systemctl start wpa_supplicant@"${INTERFACE_NAME_WIFI}".service fi diff --git a/rpi23-gen-image.sh b/rpi23-gen-image.sh index 74c4782..0cb44f2 100755 --- a/rpi23-gen-image.sh +++ b/rpi23-gen-image.sh @@ -125,8 +125,8 @@ NET_ETH_DNS_DOMAINS=${NET_ETH_DNS_DOMAINS:=""} NET_ETH_NTP_1=${NET_ETH_NTP_1:=""} NET_ETH_NTP_2=${NET_ETH_NTP_2:=""} -NET_WIFI_SSID=${NET_SSID:=""} -NET_WIFI_WPAPSK=${NET_WPAPSK:=""} +NET_WIFI_SSID=${NET_WIFI_SSID:=""} +NET_WIFI_PSK=${NET_WIFI_PSK:=""} # Network settings (static) NET_WIFI_ADDRESS=${NET_WIFI_ADDRESS:=""}