[packages] restorefactory: cleanup code (closes: #7327)
authorNicolas Thill <nico@openwrt.org>
Thu, 13 May 2010 00:52:08 +0000 (00:52 +0000)
committerNicolas Thill <nico@openwrt.org>
Thu, 13 May 2010 00:52:08 +0000 (00:52 +0000)
SVN-Revision: 21440

utils/restorefactory/files/etc/hotplug.d/button/50-restorefactory
utils/restorefactory/files/etc/uci-defaults/50-restorefactory

index 2331bb2..5273499 100755 (executable)
@@ -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
-        }
+       }
 } 
 
index 9b73f33..ad27b48 100755 (executable)
@@ -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
-