From 5d00b7c5f74fce0ce71f6ff75b2e7042d93bce47 Mon Sep 17 00:00:00 2001 From: Jan Macku Date: Tue, 23 Aug 2022 12:32:39 +0200 Subject: service: Exit when `/etc/init.d` is missing Symlink /etc/init.d -> rc.d/init.d is provided by initscripts package. --- usr/sbin/service | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'usr/sbin') diff --git a/usr/sbin/service b/usr/sbin/service index 4f0acc07..59099346 100755 --- a/usr/sbin/service +++ b/usr/sbin/service @@ -46,7 +46,8 @@ while [ $# -gt 0 ]; do ;; *) if [ -z "${SERVICE}" ] && [ $# -eq 1 ] && [ "${1}" = "--status-all" ]; then - cd ${SERVICEDIR} + # symlink /etc/init.d -> rc.d/init.d is provided by initscripts package + cd ${SERVICEDIR} || { echo $"Support for initscripts isn't installed" >&2 ; exit 4 ; } for SERVICE in * ; do case "${SERVICE}" in functions | halt | killall | single| linuxconf| kudzu) @@ -61,6 +62,9 @@ while [ $# -gt 0 ]; do done exit 0 elif [ $# -eq 2 ] && [ "${2}" = "--full-restart" ]; then + # symlink /etc/init.d -> rc.d/init.d is provided by initscripts package + [ -L "${SERVICEDIR}" ] || { echo $"Support for initscripts isn't installed" >&2 ; exit 4 ; } + SERVICE="${1}" if [ -x "${SERVICEDIR}/${SERVICE}" ]; then env -i PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" stop -- cgit v1.2.1