[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 2331bb2a429cf78c4b779f6813dc6caa04cb77a0..52734996803f514648c13bdc910b9aa18c6227eb 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 9b73f335e6cc70e5e9e15f85e8bafbc7953d0e64..ad27b4808505223630a85df5568ec7b158aba83e 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
-