Merge pull request #1994 from conchyliculture/wifi-empty-psk

Allow empty PSK in order to connect to open wifi networks
This commit is contained in:
fewtarius 2023-09-01 09:37:35 -04:00 committed by GitHub
commit 5f7f0bb8a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,6 +8,9 @@
###
### Basic WIFI properties used across the tool.
###
### Usage:
###  wifictl command [ssid] [psk]
###
CFG_ROOT="/storage/.cache"
WIFI_CFG="${CFG_ROOT}/connman/wifi.config"
@ -45,7 +48,7 @@ then
PSK="${GENERATED[0]: -10}"
fi
if [ ! -d "" ]
if [ ! -d "${CFG_ROOT}/connman" ]
then
mkdir -p "${CFG_ROOT}/connman"
fi
@ -142,8 +145,15 @@ AutoConnect = true
[service_${OS_NAME}_default]
Type = wifi
Name = ${SSID}
EOF
# Only add a PSK if one is provided, in order to connect to
# open networks.
if [ ! -z "${PSK}" ] ; then
cat >> "${WIFI_CFG}" <<EOF
Passphrase = ${PSK}
EOF
fi
if [ "${WIFI_TYPE}" = "1" ]
then