summaryrefslogtreecommitdiff
path: root/package/base-files
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2006-10-15 21:03:30 +0000
committerFelix Fietkau <nbd@openwrt.org>2006-10-15 21:03:30 +0000
commit8612d336918b408fd3abd844ccb8189f0d64acc5 (patch)
treedd043a8580746d6ee54912206a873228401c12f7 /package/base-files
parent6f8a93af7ef4eafdd3d6f678398e6f5df2a5560d (diff)
downloadmtk-20170518-8612d336918b408fd3abd844ccb8189f0d64acc5.zip
mtk-20170518-8612d336918b408fd3abd844ccb8189f0d64acc5.tar.gz
mtk-20170518-8612d336918b408fd3abd844ccb8189f0d64acc5.tar.bz2
init script cleanup, use /etc/rc.d/ for enabled scripts, /etc/init.d/<pkgname> (enable|disable) manages symlinks
SVN-Revision: 5128
Diffstat (limited to 'package/base-files')
-rwxr-xr-xpackage/base-files/ar7-2.4/etc/init.d/adam2 (renamed from package/base-files/ar7-2.4/etc/init.d/S00adam2)1
-rwxr-xr-xpackage/base-files/brcm-2.4/etc/init.d/netconfig (renamed from package/base-files/brcm-2.4/etc/init.d/S05netconfig)2
-rwxr-xr-xpackage/base-files/brcm-2.6/etc/init.d/netconfig (renamed from package/base-files/brcm-2.6/etc/init.d/S05netconfig)1
-rwxr-xr-xpackage/base-files/default/etc/init.d/boot (renamed from package/base-files/default/etc/init.d/S10boot)1
-rwxr-xr-xpackage/base-files/default/etc/init.d/cron (renamed from package/base-files/default/etc/init.d/S60cron)0
-rwxr-xr-xpackage/base-files/default/etc/init.d/httpd (renamed from package/base-files/default/etc/init.d/S50httpd)0
-rwxr-xr-xpackage/base-files/default/etc/init.d/network (renamed from package/base-files/default/etc/init.d/S40network)1
-rwxr-xr-xpackage/base-files/default/etc/init.d/rcS4
-rwxr-xr-xpackage/base-files/default/etc/init.d/telnet (renamed from package/base-files/default/etc/init.d/S50telnet)0
-rwxr-xr-xpackage/base-files/default/etc/rc.common16
10 files changed, 21 insertions, 5 deletions
diff --git a/package/base-files/ar7-2.4/etc/init.d/S00adam2 b/package/base-files/ar7-2.4/etc/init.d/adam2
index 5f5b350..425bc15 100755
--- a/package/base-files/ar7-2.4/etc/init.d/S00adam2
+++ b/package/base-files/ar7-2.4/etc/init.d/adam2
@@ -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" ] && {
diff --git a/package/base-files/brcm-2.4/etc/init.d/S05netconfig b/package/base-files/brcm-2.4/etc/init.d/netconfig
index 7c36183..ca52ee7 100755
--- a/package/base-files/brcm-2.4/etc/init.d/S05netconfig
+++ b/package/base-files/brcm-2.4/etc/init.d/netconfig
@@ -1,6 +1,8 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
+START=05
+
start() {
[ -e /etc/config/network ] && exit 0
diff --git a/package/base-files/brcm-2.6/etc/init.d/S05netconfig b/package/base-files/brcm-2.6/etc/init.d/netconfig
index 8465626..7a818dc 100755
--- a/package/base-files/brcm-2.6/etc/init.d/S05netconfig
+++ b/package/base-files/brcm-2.6/etc/init.d/netconfig
@@ -1,6 +1,7 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
+START=05
start() {
[ -e /etc/config/network ] && exit 0
diff --git a/package/base-files/default/etc/init.d/S10boot b/package/base-files/default/etc/init.d/boot
index 77b5ca7..a5c8603 100755
--- a/package/base-files/default/etc/init.d/S10boot
+++ b/package/base-files/default/etc/init.d/boot
@@ -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
diff --git a/package/base-files/default/etc/init.d/S60cron b/package/base-files/default/etc/init.d/cron
index a450c36..a450c36 100755
--- a/package/base-files/default/etc/init.d/S60cron
+++ b/package/base-files/default/etc/init.d/cron
diff --git a/package/base-files/default/etc/init.d/S50httpd b/package/base-files/default/etc/init.d/httpd
index a05b10c..a05b10c 100755
--- a/package/base-files/default/etc/init.d/S50httpd
+++ b/package/base-files/default/etc/init.d/httpd
diff --git a/package/base-files/default/etc/init.d/S40network b/package/base-files/default/etc/init.d/network
index c772036..45d5311 100755
--- a/package/base-files/default/etc/init.d/S40network
+++ b/package/base-files/default/etc/init.d/network
@@ -1,6 +1,7 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
+START=40
start() {
setup_switch() { return 0; }
diff --git a/package/base-files/default/etc/init.d/rcS b/package/base-files/default/etc/init.d/rcS
index 7fae7f5..27bc34b 100755
--- a/package/base-files/default/etc/init.d/rcS
+++ b/package/base-files/default/etc/init.d/rcS
@@ -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 >&-
diff --git a/package/base-files/default/etc/init.d/S50telnet b/package/base-files/default/etc/init.d/telnet
index 228eac2..228eac2 100755
--- a/package/base-files/default/etc/init.d/S50telnet
+++ b/package/base-files/default/etc/init.d/telnet
diff --git a/package/base-files/default/etc/rc.common b/package/base-files/default/etc/rc.common
index 20d1efa..a08f5e5 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"