init script cleanup, use /etc/rc.d/ for enabled scripts, /etc/init.d/<pkgname> (enable|disable) manages symlinks

SVN-Revision: 5128
This commit is contained in:
Felix Fietkau
2006-10-15 21:03:30 +00:00
parent 6f8a93af7e
commit 8612d33691
20 changed files with 197 additions and 19 deletions

View File

@@ -2,6 +2,7 @@
# ADAM2 patcher for Netgear DG834 and compatible
# Copyright (C) 2006 OpenWrt.org
START=00
start() {
MD5="$(md5sum /dev/mtdblock/0 | awk '{print $1}')"
[ "$MD5" = "0530bfdf00ec155f4182afd70da028c1" ] && {

View File

@@ -1,6 +1,8 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=05
start() {
[ -e /etc/config/network ] && exit 0

View File

@@ -1,6 +1,7 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=05
start() {
[ -e /etc/config/network ] && exit 0

View File

@@ -1,6 +1,7 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=10
start() {
[ -f /proc/mounts ] || /sbin/mount_root
[ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc

View File

@@ -1,6 +1,7 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=40
start() {
setup_switch() { return 0; }

View File

@@ -11,8 +11,8 @@ syslogd -C 16 #${log_ipaddr:+-L -R $log_ipaddr}
klogd
(
for i in /etc/init.d/S*; do
$i start 2>&1
for i in /etc/rc.d/S*; do
$i boot 2>&1
done
sysctl -p >&-

View File

@@ -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"