From 3f05e52f25d8220d953f8322f121aed53de9001e Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Mon, 02 Jun 2014 22:45:21 -0400 Subject: /etc/rc.common: Add enable and disable commands. --- 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 "${@}" -- cgit v0.9.1