From: Nicolas Thill Date: Thu, 13 May 2010 00:52:08 +0000 (+0000) Subject: [packages] restorefactory: cleanup code (closes: #7327) X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=50296bff629e521348459c82fdeda37d41d16ef0;p=openwrt%2Fsvn-archive%2Farchive.git [packages] restorefactory: cleanup code (closes: #7327) SVN-Revision: 21440 --- diff --git a/utils/restorefactory/files/etc/hotplug.d/button/50-restorefactory b/utils/restorefactory/files/etc/hotplug.d/button/50-restorefactory index 2331bb2a42..5273499680 100755 --- a/utils/restorefactory/files/etc/hotplug.d/button/50-restorefactory +++ b/utils/restorefactory/files/etc/hotplug.d/button/50-restorefactory @@ -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 - } + } } diff --git a/utils/restorefactory/files/etc/uci-defaults/50-restorefactory b/utils/restorefactory/files/etc/uci-defaults/50-restorefactory index 9b73f335e6..ad27b48085 100755 --- a/utils/restorefactory/files/etc/uci-defaults/50-restorefactory +++ b/utils/restorefactory/files/etc/uci-defaults/50-restorefactory @@ -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 -