mirror of
https://github.com/femtofox/femtofox.git
synced 2026-11-20 15:06:36 -05:00
commit
14d74b979d
1 changed files with 8 additions and 12 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue