summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2024-11-20 18:53:10 +0200
committerMaxim Devaev <[email protected]>2024-11-20 18:53:10 +0200
commitd25e43c9340c1061efcde966b6a01c6b0ce97b0f (patch)
tree0c96833ad9c73ff4bff909359bfc3298e9e037f5
parent3cbeabe2e86ba988f58c3a269889f1cc241b3ca8 (diff)
pikvm/pikvm#1415: Allow autoconnecting to open wifi
-rwxr-xr-xscripts/kvmd-bootconfig11
1 files changed, 10 insertions, 1 deletions
diff --git a/scripts/kvmd-bootconfig b/scripts/kvmd-bootconfig
index c2fc5c6f..6e89944d 100755
--- a/scripts/kvmd-bootconfig
+++ b/scripts/kvmd-bootconfig
@@ -256,7 +256,16 @@ if [ -n "$WIFI_ESSID" ]; then
else
make_dhcp_iface "$WIFI_IFACE" 50
fi
- wpa_passphrase "$WIFI_ESSID" "$WIFI_PASSWD" > "/etc/wpa_supplicant/wpa_supplicant-$WIFI_IFACE.conf"
+ if [ "${#WIFI_PASSWD}" -ge 8 ];then
+ wpa_passphrase "$WIFI_ESSID" "$WIFI_PASSWD" > "/etc/wpa_supplicant/wpa_supplicant-$WIFI_IFACE.conf"
+ else
+ cat <<end_of_file > "/etc/wpa_supplicant/wpa_supplicant-$WIFI_IFACE.conf"
+network={
+ ssid=${WIFI_ESSID@Q}
+ key_mgmt=NONE
+}
+end_of_file
+ fi
chmod 640 "/etc/wpa_supplicant/wpa_supplicant-$WIFI_IFACE.conf"
if [ -n "$WIFI_HIDDEN" ]; then
sed -i -e 's/^}/\tscan_ssid=1\n}/g' "/etc/wpa_supplicant/wpa_supplicant-$WIFI_IFACE.conf"