summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src.etc/rc.common97
1 files changed, 44 insertions, 53 deletions
diff --git a/src.etc/rc.common b/src.etc/rc.common
index 50c6020..9db482b 100644
--- a/src.etc/rc.common
+++ b/src.etc/rc.common
@@ -17,37 +17,25 @@ EXTRA_COMMANDS=''
START=''
STOP=''
-main()
-{
- local action=
- local es=
-
- SCRIPT="${1}"
-
- . "${SCRIPT}"
+# Default function definitions
+stop() { :; }
+restart() { stop; start; }
- ALL_CMDS=" start stop restart ${EXTRA_COMMANDS} "
- if [ "x${START:+set}" = 'xset' ] || [ "x${STOP:+set}" = 'xset' ]; then
- ALL_CMDS="${ALL_CMDS} enable disable "
- fi
+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/K${STOP}${name}"
+}
- if [ ${#} -ne 2 ]; then
- usage
- return 1
- fi
- action="${2:-<unknown>}"
- if [ "x${ALL_CMDS#* ${action} }" != "x${ALL_CMDS}" ]; then
- [ "x${action%able}" = "x${action}" ] && \
- [ -f /etc/rc.policy ] && \
- [ "x$(cat /etc/rc.policy)" = 'xdisabled' ] && return 0
- ${action}
- es=${?}
- log_end ${es}
- return ${es}
- else
- usage
- return 1
- fi
+disable()
+{
+ local name="${SCRIPT##*/}"
+ name="${name#[SK][0-9][0-9]}"
+ rm -f /etc/rc.d/[SK][0-9][0-9]"${name}"
}
tty_printf()
@@ -95,34 +83,37 @@ log_end()
esac
}
-# Default function definitions
-
-stop()
+main()
{
- :
-}
+ local action=
+ local es=
-restart()
-{
- stop
- start
-}
+ SCRIPT="${1}"
-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/K${STOP}${name}"
-}
+ . "${SCRIPT}"
-disable()
-{
- local name="${SCRIPT##*/}"
- name="${name#[SK][0-9][0-9]}"
- rm -f /etc/rc.d/[SK][0-9][0-9]"${name}"
+ 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 [ ${#} -ne 2 ]; then
+ usage
+ return 1
+ fi
+ action="${2:-<unknown>}"
+ if [ "x${ALL_CMDS#* ${action} }" != "x${ALL_CMDS}" ]; then
+ [ "x${action%able}" = "x${action}" ] && \
+ [ -f /etc/rc.policy ] && \
+ [ "x$(cat /etc/rc.policy)" = 'xdisabled' ] && return 0
+ ${action}
+ es=${?}
+ log_end ${es}
+ return ${es}
+ else
+ usage
+ return 1
+ fi
}
main "${@}"