summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src.etc/rc.common22
1 files changed, 22 insertions, 0 deletions
diff --git a/src.etc/rc.common b/src.etc/rc.common
index e495e1c..8ccb6f7 100644
--- a/src.etc/rc.common
+++ b/src.etc/rc.common
@@ -14,6 +14,8 @@ SCRIPT=''
ALL_CMDS=''
LOG_MSG=''
EXTRA_COMMANDS=''
+START=''
+STOP=''
main()
{
@@ -25,6 +27,9 @@ main()
. "${SCRIPT}"
ALL_CMDS=" start stop restart ${EXTRA_COMMANDS} "
+ if [ "x${START:+set}" = 'xset' ] || [ "x${STOP:+set}" = 'xset' ]; then
+ ALL_CMDS="${ALL_CMDS} enable disable "
+ fi
if [ "x${ALL_CMDS#* ${action} }" != "x${ALL_CMDS}" ]; then
${action}
@@ -91,4 +96,21 @@ restart()
start
}
+enable()
+{
+ local name="${SCRIPT##*/}"
+ name="${name#[SK][0-9][0-9]}"
+ [ "x${START:+set}" = 'xset' ] && \
+ ln -sf "../init.d/${name}" "/etc/rc.d/S${START}${name}"
+ [ "x${STOP:+set}" = 'xset' ] && \
+ ln -sf "../init.d/${name}" "/etc/rc.d/S${STOP}${name}"
+}
+
+disable()
+{
+ local name="${SCRIPT##*/}"
+ name="${name#[SK][0-9][0-9]}"
+ rm -f /etc/rc.d/[SK][0-9][0-9]"${name}"
+}
+
main "${@}"