Skip to content
Snippets Groups Projects
Commit f7abefe1 authored by rubo77's avatar rubo77
Browse files

the use of `uci` is unlucky in case you do uci commit on the console

parent 8f5ac152
No related branches found
No related tags found
No related merge requests found
...@@ -18,26 +18,26 @@ else ...@@ -18,26 +18,26 @@ else
fi fi
# maximum simplyfied, no more ttvn rating # maximum simplyfied, no more ttvn rating
CHECK=$(batctl gwl -H|grep -v "gateways in range"|wc -l) CHECK=$(batctl gwl -H|grep -v "gateways in range"|wc -l)
HOSTAPD=/var/run/hostapd-phy0.conf
if [ $CHECK -eq 0 ] ; then if [ $CHECK -eq 0 ] ; then
if [ $(expr $(date "+%s") / 60 % $MINUTES) -eq 0 ]; then if [ $(expr $(date "+%s") / 60 % $MINUTES) -eq 0 ]; then
if [ "$(uci get wireless.client_radio0.ssid)" == "$OFFLINE_SSID" ]; then CURRENT_SSID=`grep "^ssid=$ONLINE_SSID" $HOSTAPD | cut -d"=" -f2`
if [ "$CURRENT_SSID" == "$OFFLINE_SSID" ]; then
echo "$0 - still on $OFFLINE_SSID" echo "$0 - still on $OFFLINE_SSID"
exit 0 exit 0
fi fi
echo "$0 change ssid to $OFFLINE_SSID" | logger echo "$0 change ssid to $OFFLINE_SSID" | logger
uci set wireless.client_radio0.ssid="$OFFLINE_SSID" sed -i s~^ssid=$ONLINE_SSID~ssid=$OFFLINE_SSID~ $HOSTAPD
sed -i s~^ssid=$ONLINE_SSID~ssid=$OFFLINE_SSID~ /var/run/hostapd-phy0.conf
killall -HUP hostapd killall -HUP hostapd
fi fi
fi fi
if [ $CHECK -gt 0 ] ; then if [ $CHECK -gt 0 ] ; then
if [ "$(uci get wireless.client_radio0.ssid)" == "$ONLINE_SSID" ]; then CURRENT_SSID=`grep "^ssid=$ONLINE_SSID" $HOSTAPD | cut -d"=" -f2`
if [ "$CURRENT_SSID" == "$ONLINE_SSID" ]; then
echo "$0 - still on $ONLINE_SSID" echo "$0 - still on $ONLINE_SSID"
exit 0 exit 0
fi fi
echo "$0 change ssid to $ONLINE_SSID"| logger echo "$0 change ssid to $ONLINE_SSID"| logger
uci set wireless.client_radio0.ssid="$ONLINE_SSID" sed -i s~^ssid=$OFFLINE_SSID~ssid=$ONLINE_SSID~ $HOSTAPD
sed -i s~^ssid=$OFFLINE_SSID~ssid=$ONLINE_SSID~ /var/run/hostapd-phy0.conf
killall -HUP hostapd killall -HUP hostapd
fi fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment