mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-03-14 21:10:11 +01:00
inteno-netmodes: change touching done_file to having a .pid file refs #15348
This commit is contained in:
parent
b6bb626f2b
commit
f5c49c8a6e
1 changed files with 22 additions and 20 deletions
|
|
@ -8,6 +8,18 @@ state="exit"
|
|||
TMPPATH="/tmp/netmode_config_backup"
|
||||
CURMODE=""
|
||||
SLEEPTIME=300
|
||||
pid_file=/tmp/netmode-conf.pid
|
||||
|
||||
echo "$$" >$pid_file
|
||||
|
||||
cleanup(){
|
||||
rm -rf $pid_file
|
||||
# we need to trigger a reload of icwmp but ONLY if ip or device has changed
|
||||
[ -f "/etc/hotplug.d/iface/90-icwmp" ] && INTERFACE=wan ACTION=ifup sh /etc/hotplug.d/iface/90-icwmp
|
||||
exit
|
||||
}
|
||||
|
||||
trap cleanup SIGHUP SIGINT SIGTERM SIGSTOP
|
||||
|
||||
set_wireless_values() {
|
||||
local iface_num="$1"
|
||||
|
|
@ -109,10 +121,8 @@ backup() {
|
|||
|
||||
file="$1"
|
||||
from_gui="$2"
|
||||
done_file="/tmp/netmode_done"
|
||||
|
||||
[ -f "$file" ] || exit
|
||||
[ -f "$done_file" ] && rm $done_file
|
||||
[ -f "$file" ] || cleanup
|
||||
|
||||
# let netmode-handler up to 20 seconds to finish switching mode
|
||||
wait_for_netmode_handler
|
||||
|
|
@ -163,16 +173,14 @@ done
|
|||
|
||||
[ "$apcliband" == "$band" -o "$band" == "" ] || {
|
||||
[ "$from_gui" == "true" ] && restore "back"
|
||||
touch $done_file
|
||||
exit
|
||||
cleanup
|
||||
}
|
||||
|
||||
repeater_iface_num=$(uci -q show wireless | grep -e ".mode='wet'" -e ".mode='sta'" | sed 's/.*\[\([0-9]\)\].*/\1/')
|
||||
|
||||
[ -z "$repeater_iface_num" ] && {
|
||||
[ "$from_gui" == "true" ] && restore "back"
|
||||
touch $done_file
|
||||
exit
|
||||
cleanup
|
||||
}
|
||||
|
||||
json_get_var ssid ssid
|
||||
|
|
@ -201,8 +209,7 @@ while json_get_var dummy $i; do
|
|||
a_num=$((a_num+1))
|
||||
[ -z $iface_num ] && {
|
||||
[ "$from_gui" == "true" ] && restore "back"
|
||||
touch $done_file
|
||||
exit
|
||||
cleanup
|
||||
}
|
||||
set_wireless_values "$iface_num" "$ssid" "$key" "$encryption" "$device"
|
||||
get_device "b" device
|
||||
|
|
@ -210,8 +217,7 @@ while json_get_var dummy $i; do
|
|||
b_num=$((b_num+1))
|
||||
[ -z $iface_num ] && {
|
||||
[ "$from_gui" == "true" ] && restore "back"
|
||||
touch $done_file
|
||||
exit
|
||||
cleanup
|
||||
}
|
||||
set_wireless_values "$iface_num" "$ssid" "$key" "$encryption" "$device"
|
||||
else
|
||||
|
|
@ -228,8 +234,7 @@ while json_get_var dummy $i; do
|
|||
esac
|
||||
[ -z $iface_num ] && {
|
||||
[ "$from_gui" == "true" ] && restore "back"
|
||||
touch $done_file
|
||||
exit
|
||||
cleanup
|
||||
}
|
||||
set_wireless_values "$iface_num" "$ssid" "$key" "$encryption" "$device"
|
||||
fi
|
||||
|
|
@ -276,8 +281,7 @@ if [ "$from_gui" == "true" ]; then
|
|||
ping -w1 $ip
|
||||
if [ $? -eq 0 ]; then
|
||||
restore
|
||||
touch $done_file
|
||||
exit
|
||||
cleanup
|
||||
else
|
||||
i=$((i-10))
|
||||
sleep 9
|
||||
|
|
@ -286,8 +290,7 @@ if [ "$from_gui" == "true" ]; then
|
|||
restore "back"
|
||||
else
|
||||
if [ "$state" == "exit" ]; then
|
||||
touch $done_file
|
||||
return
|
||||
cleanup
|
||||
fi
|
||||
ubus call leds set '{"state":"allflash"}'
|
||||
if [ "$state" == "apply" ]; then
|
||||
|
|
@ -300,7 +303,6 @@ else
|
|||
[ -f /etc/init.d/layer2 ] && /etc/init.d/layer2 reload
|
||||
correct_uplink
|
||||
ubus call leds set '{"state":"normal"}'
|
||||
touch $done_file
|
||||
# we need to trigger a reload of icwmp but ONLY if ip or device has changed
|
||||
[ -f "/etc/hotplug.d/iface/90-icwmp" ] && INTERFACE=wan ACTION=ifup sh /etc/hotplug.d/iface/90-icwmp
|
||||
fi
|
||||
|
||||
cleanup
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue