aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Macku <jamacku@redhat.com>2022-08-23 12:32:39 +0200
committerJan Macku <jamacku@redhat.com>2022-08-24 10:41:41 +0200
commitb6fcff8f7d98b42664a3afd1742ef2e2857d3a26 (patch)
treea50e53ce6e5bd5dd6ed80d0260451644a9f65da1
parentbe62d55831e05dea18f56f8fae4028bf88aced39 (diff)
downloadinitscripts-b6fcff8f7d98b42664a3afd1742ef2e2857d3a26.tar
initscripts-b6fcff8f7d98b42664a3afd1742ef2e2857d3a26.tar.gz
initscripts-b6fcff8f7d98b42664a3afd1742ef2e2857d3a26.tar.bz2
initscripts-b6fcff8f7d98b42664a3afd1742ef2e2857d3a26.tar.xz
initscripts-b6fcff8f7d98b42664a3afd1742ef2e2857d3a26.zip
service: Exit when `/etc/init.d` is missing
Symlink /etc/init.d -> rc.d/init.d is provided by initscripts package. (cherry picked from commit 5d00b7c5f74fce0ce71f6ff75b2e7042d93bce47) Resolves: #2118300
-rwxr-xr-xusr/sbin/service6
1 files changed, 5 insertions, 1 deletions
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