summaryrefslogtreecommitdiffstats
path: root/package/base-files/default/etc/rc.common
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2006-10-15 21:03:30 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2006-10-15 21:03:30 +0000
commit5eca1169a020f0d082a08ff282375f2ae2915503 (patch)
tree30a7c428135c35e4bfa2117bfe86448ff7239c92 /package/base-files/default/etc/rc.common
parentda89de0b0c143b4ee6a2ec5dd0db4dc2878122bd (diff)
init script cleanup, use /etc/rc.d/ for enabled scripts, /etc/init.d/<pkgname> (enable|disable) manages symlinks
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@5128 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files/default/etc/rc.common')
-rwxr-xr-xpackage/base-files/default/etc/rc.common16
1 files changed, 13 insertions, 3 deletions
diff --git a/package/base-files/default/etc/rc.common b/package/base-files/default/etc/rc.common
index 20d1efa40..a08f5e523 100755
--- a/package/base-files/default/etc/rc.common
+++ b/package/base-files/default/etc/rc.common
@@ -1,5 +1,9 @@
#!/bin/sh
-. /etc/functions.sh
+# Copyright (C) 2006 OpenWrt.org
+
+. $IPKG_INSTROOT/etc/functions.sh
+
+START=50
start() {
return 0
@@ -27,12 +31,14 @@ shutdown() {
}
disable() {
- rm -f /etc/rc.d/${initscript##*/}
+ name="$(basename "${initscript}")"
+ rm -f "$IPKG_INSTROOT/etc/rc.d/S??$name"
}
enable() {
+ name="$(basename "${initscript}")"
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() {
@@ -48,6 +54,8 @@ Available commands:
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
}
@@ -68,6 +76,8 @@ eval "case \"\$action\" in
restart) restart;;
boot) boot;;
shutdown) shutdown;;
+ enable) enable;;
+ disable) disable;;
$cmds
*) help;;
esac"