add START=60 to dnsmasq init
[openwrt.git] / package / base-files / default / etc / rc.common
index 20d1efa..7180b0f 100755 (executable)
@@ -1,5 +1,9 @@
 #!/bin/sh
 #!/bin/sh
-. /etc/functions.sh
+# Copyright (C) 2006 OpenWrt.org
+
+. $IPKG_INSTROOT/etc/functions.sh
+
+START=50
 
 start() {
        return 0
 
 start() {
        return 0
@@ -27,12 +31,14 @@ shutdown() {
 }
 
 disable() {
 }
 
 disable() {
-       rm -f /etc/rc.d/${initscript##*/}
+       name="$(basename "${initscript}")"
+       rm -f "$IPKG_INSTROOT"/etc/rc.d/S??$name
 }
 
 enable() {
 }
 
 enable() {
+       name="$(basename "${initscript}")"
        disable
        disable
-       ln -s /etc/init.d/${initscript##*/} /etc/rc.d/${initscript##*/}
+       ln -s "/etc/init.d/$name" "$IPKG_INSTROOT/etc/rc.d/S${START}${name##S[0-9][0-9]}"
 }
 
 depends() {
 }
 
 depends() {
@@ -48,6 +54,8 @@ Available commands:
        stop    Stop the service
        restart Restart the service
        reload  Reload configuration files (or restart if that fails)
        stop    Stop the service
        restart Restart the service
        reload  Reload configuration files (or restart if that fails)
+       enable  Enable service autostart
+       disable Disable service autostart
 $EXTRA_HELP
 EOF
 }
 $EXTRA_HELP
 EOF
 }
@@ -59,7 +67,7 @@ action="$2"
 
 cmds=
 for cmd in $EXTRA_COMMANDS; do
 
 cmds=
 for cmd in $EXTRA_COMMANDS; do
-       cmds="$cmd) $cmd;;"
+       cmds="${cmds:+$cmds$N}$cmd) $cmd;;"
 done
 eval "case \"\$action\" in
        start) start;;
 done
 eval "case \"\$action\" in
        start) start;;
@@ -68,6 +76,8 @@ eval "case \"\$action\" in
        restart) restart;;
        boot) boot;;
        shutdown) shutdown;;
        restart) restart;;
        boot) boot;;
        shutdown) shutdown;;
+       enable) enable;;
+       disable) disable;;
        $cmds
        *) help;;
 esac"
        $cmds
        *) help;;
 esac"
This page took 0.025974 seconds and 4 git commands to generate.