Merge pull request #184 from noon92/OSC

Fixed wifi setup menu.
This commit is contained in:
Ruledo 2025-01-12 00:27:43 -08:00 • committed by GitHub
commit 14d74b979d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -29,7 +29,7 @@ if [ $# -eq 0 ]; then
fi
# Parse options
while getopts ":s:p:c:hr" opt; do
while getopts ":s:p:c:h:r" opt; do
case ${opt} in
s) # Option -s (ssid)
sed -i "/ssid=/s/\".*\"/\"$OPTARG\"/" "$wpa_supplicant_conf"
@ -48,6 +48,7 @@ while getopts ":s:p:c:hr" opt; do
;;
h) # Option -h (help)
echo -e "$help"
exit 0
;;
r) # Option -r (restart wifi)
updated_wifi="true"
@ -65,17 +66,12 @@ while getopts ":s:p:c:hr" opt; do
esac
done
# Reconfigure wpa_supplicant if changes were made
if [ "$updated_wifi" = true ]; then
systemctl restart wpa_supplicant
wpa_cli -i wlan0 reconfigure # <-------- add watch for FAIL response, error out
timeout 30s dhclient -v
echo " Wifi restarted. Enabling Meshtastic wifi setting."
updatemeshtastic.sh "--set network.wifi_enabled true" 10 "USB config" #| tee -a /tmp/femtofox-config.log
if [ $? -eq 1 ]; then
echo "Update of Meshtastic FAILED."
exit 1
else
echo "Updated Meshtastic successfully."
exit 0
if ! wpa_cli -i wlan0 reconfigure | grep -q "OK"; then
echo "Failed to reconfigure wpa_supplicant on wlan0."
exit 1
fi
echo "Wi-Fi configuration updated successfully for wlan0."
fi