diff options
author | P. J. McDermott <pj@pehjota.net> | 2014-06-02 22:45:21 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2014-06-02 22:45:21 (EDT) |
commit | 3f05e52f25d8220d953f8322f121aed53de9001e (patch) | |
tree | 177d5573ad6a85a15a1023679084412f7006c229 | |
parent | 341404a5f3ca4c5743fd619099d8627572d30099 (diff) |
/etc/rc.common: Add enable and disable commands.
-rw-r--r-- | src.etc/rc.common | 22 |
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 "${@}" |