From: Nuno Goncalves Date: Sun, 19 Dec 2010 01:17:57 +0000 (+0000) Subject: [packages] restorefactory: small makefile update X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=3d73b712af9b4fe71063607fc18dfea5709572cf;p=openwrt%2Fsvn-archive%2Farchive.git [packages] restorefactory: small makefile update SVN-Revision: 24696 --- diff --git a/net/sshtunnel/Makefile b/net/sshtunnel/Makefile index f75fcbbfb9..c704004c68 100644 --- a/net/sshtunnel/Makefile +++ b/net/sshtunnel/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=sshtunnel PKG_VERSION:=3 -PKG_RELEASE:=1 +PKG_RELEASE:=2 include $(INCLUDE_DIR)/package.mk diff --git a/utils/restorefactory/Makefile b/utils/restorefactory/Makefile index a359a66d4c..fbee589a76 100644 --- a/utils/restorefactory/Makefile +++ b/utils/restorefactory/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=restorefactory PKG_VERSION:=1 -PKG_RELEASE:=1 +PKG_RELEASE:=2 include $(INCLUDE_DIR)/package.mk @@ -29,7 +29,10 @@ define Build/Compile endef define Package/restorefactory/install - $(CP) ./files/* $(1) + $(INSTALL_DIR) $(1)/etc/hotplug.d/button + $(INSTALL_BIN) ./files/hotplug_restorefactory $(1)/etc/hotplug.d/button/50-restorefactory + $(INSTALL_DIR) $(1)/etc/defaults + $(INSTALL_BIN) ./files/uci_defaults_restorefactory $(1)/etc/defaults/50-restorefactory endef $(eval $(call BuildPackage,restorefactory)) diff --git a/utils/restorefactory/files/etc/hotplug.d/button/50-restorefactory b/utils/restorefactory/files/etc/hotplug.d/button/50-restorefactory deleted file mode 100755 index 5273499680..0000000000 --- a/utils/restorefactory/files/etc/hotplug.d/button/50-restorefactory +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -system_config() { - config_get button "$1" button "reset" - config_get action "$1" action "pressed" - config_get timeout "$1" timeout "5" -} - -config_load system -config_foreach system_config restorefactory - -[ "$BUTTON" = "$button" ] && { - - [ -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" ] && { - - 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" - elif [ "$timeout" -eq 0 ] - 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 deleted file mode 100755 index ad27b48085..0000000000 --- a/utils/restorefactory/files/etc/uci-defaults/50-restorefactory +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -uci add system restorefactory -uci set system.@restorefactory[0].button=reset -uci set system.@restorefactory[0].action=pressed -uci set system.@restorefactory[0].timeout=5 -uci commit diff --git a/utils/restorefactory/files/hotplug_restorefactory b/utils/restorefactory/files/hotplug_restorefactory new file mode 100755 index 0000000000..5273499680 --- /dev/null +++ b/utils/restorefactory/files/hotplug_restorefactory @@ -0,0 +1,31 @@ +#!/bin/sh + +system_config() { + config_get button "$1" button "reset" + config_get action "$1" action "pressed" + config_get timeout "$1" timeout "5" +} + +config_load system +config_foreach system_config restorefactory + +[ "$BUTTON" = "$button" ] && { + + [ -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" ] && { + + 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" + elif [ "$timeout" -eq 0 ] + then + firstboot && reboot & + else + logger -p user.info -t "restorefactory" "invalid timeout value ($timeout)" + fi + } +} + diff --git a/utils/restorefactory/files/uci_defaults_restorefactory b/utils/restorefactory/files/uci_defaults_restorefactory new file mode 100755 index 0000000000..ad27b48085 --- /dev/null +++ b/utils/restorefactory/files/uci_defaults_restorefactory @@ -0,0 +1,6 @@ +#!/bin/sh +uci add system restorefactory +uci set system.@restorefactory[0].button=reset +uci set system.@restorefactory[0].action=pressed +uci set system.@restorefactory[0].timeout=5 +uci commit diff --git a/utils/watchcat/Makefile b/utils/watchcat/Makefile index faf009188a..3c9016e62c 100644 --- a/utils/watchcat/Makefile +++ b/utils/watchcat/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=watchcat PKG_VERSION:=1 -PKG_RELEASE:=1 +PKG_RELEASE:=2 include $(INCLUDE_DIR)/package.mk @@ -34,7 +34,7 @@ endef define Package/watchcat/install $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) ./files/initd_watchcat $(1)/etc/init.d/watchcat - $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_DIR) $(1)/etc/defaults $(INSTALL_BIN) ./files/uci_defaults_watchcat $(1)/etc/defaults/50-watchcat endef