add K* scripts to be run at shutdown
authorMike Baker <mbm@openwrt.org>
Thu, 10 May 2007 10:07:38 +0000 (10:07 +0000)
committerMike Baker <mbm@openwrt.org>
Thu, 10 May 2007 10:07:38 +0000 (10:07 +0000)
SVN-Revision: 7163

package/base-files/files/etc/init.d/network
package/base-files/files/etc/init.d/rcS
package/base-files/files/etc/init.d/sysctl [new file with mode: 0755]
package/base-files/files/etc/inittab
package/base-files/files/etc/profile
package/base-files/files/etc/rc.common

index 950b33726a4fd7ddf3fcd7d1f98319401e6097ff..eab00118ad46242ee6c3e8289c12b12ab6252fa9 100755 (executable)
@@ -2,6 +2,8 @@
 # Copyright (C) 2006 OpenWrt.org
 
 START=40
+STOP=40
+
 boot() {
        setup_switch() { return 0; }
 
index 755e08b9c8520b24b8d2adeabd898a53b6a68d90..61c1d6dab7ab1e3d11de2d9036b778e3f1ab0da6 100755 (executable)
@@ -1,10 +1,8 @@
 #!/bin/sh
 # Copyright (C) 2006 OpenWrt.org
 
-(
-       for i in /etc/rc.d/S*; do
-               $i boot 2>&1
+{
+       for i in /etc/rc.d/$1*; do
+               $i $2 2>&1
        done 
-       
-       sysctl -p >&-
-) | logger -s -p 6 -t '' &
+} | logger -s -p 6 -t '' &
diff --git a/package/base-files/files/etc/init.d/sysctl b/package/base-files/files/etc/init.d/sysctl
new file mode 100755 (executable)
index 0000000..35d5e30
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org 
+
+START=99
+start() {
+       [ -f /etc/sysctl.conf ] && sysctl -p >&-
+}
index 3d92717c9dd44d72c2f4876f1bd96d80f698199c..d7a053aba2c26eb3240275c36ce338ff230497a7 100644 (file)
@@ -1,3 +1,4 @@
-::sysinit:/etc/init.d/rcS
+::sysinit:/etc/init.d/rcS S boot
+::shutdown:/etc/init.d/rcS K stop
 tts/0::askfirst:/bin/ash --login
 ttyS0::askfirst:/bin/ash --login
index 001fb2062b85fed7491f414a987303e86cb5ef24..8aac3b752779ecd3df5bf87f82220cc21731ebe1 100644 (file)
@@ -12,4 +12,3 @@ alias more=less
 
 arp() { cat /proc/net/arp; }
 [ -z /bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
-reboot() { ifdown wan 2>&1 >/dev/null ; /sbin/reboot; }
index 5d9ee8666f55b41f9519652dfcb9d04d4968e7db..7ca107817dcfe904306f2439640d049c376e3f93 100755 (executable)
@@ -40,6 +40,7 @@ enable() {
        name="$(basename "${initscript}")"
        disable
        ln -s "/etc/init.d/$name" "$IPKG_INSTROOT/etc/rc.d/S${START}${name##S[0-9][0-9]}"
+       [ "$STOP" ] && ln -s "/etc/init.d/$name" "$IPKG_INSTROOT/etc/rc.d/K${START}${name##K[0-9][0-9]}"
 }
 
 enabled() {