[packages] restorefactory: cleanup code (closes: #7327)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@21440 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
17628c1113
commit
777d13d079
@ -1,9 +1,9 @@
|
||||
# /bin/sh
|
||||
#!/bin/sh
|
||||
|
||||
system_config() {
|
||||
config_get button "$1" button "reset"
|
||||
config_get button "$1" button "reset"
|
||||
config_get action "$1" action "pressed"
|
||||
config_get timeout "$1" timeout "5"
|
||||
config_get timeout "$1" timeout "5"
|
||||
}
|
||||
|
||||
config_load system
|
||||
@ -13,19 +13,19 @@ config_foreach system_config restorefactory
|
||||
|
||||
[ -f /tmp/run/restorefactory.pid ] && read PID < /tmp/run/restorefactory.pid && kill $PID && rm /tmp/run/restorefactory.pid && logger -p user.info -t "restorefactory" "restore to factory defaults aborted"
|
||||
|
||||
[ "$ACTION" = "$action" ] && {
|
||||
[ "$ACTION" = "$action" ] && {
|
||||
|
||||
if [ "$timeout" -gt 0 ]
|
||||
if [ "$timeout" -gt 0 ]
|
||||
then
|
||||
sleep "$timeout" && firstboot && reboot &
|
||||
echo $! > /tmp/run/restorefactory.pid
|
||||
logger -p user.info -t "restorefactory" "restoring to factory defaults in $timeout seconds"
|
||||
echo $! > /tmp/run/restorefactory.pid
|
||||
logger -p user.info -t "restorefactory" "restoring to factory defaults in $timeout seconds"
|
||||
elif [ "$timeout" -eq 0 ]
|
||||
then
|
||||
then
|
||||
firstboot && reboot &
|
||||
else
|
||||
logger -p user.info -t "restorefactory" "invalid timeout value ($timeout)"
|
||||
fi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#!/bin/sh
|
||||
uci add system restorefactory
|
||||
uci set system.@restorefactory[0].button=reset
|
||||
uci set system.@restorefactory[0].button=reset
|
||||
uci set system.@restorefactory[0].action=pressed
|
||||
uci set system.@restorefactory[0].timeout=5
|
||||
uci set system.@restorefactory[0].timeout=5
|
||||
uci commit
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user