From 8faaa3060b652002b56f616e16d550a4a9e77a6f Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 16 Feb 2011 23:08:41 +0100
Subject: systemctl: honour $SYSTEMCTL_IGNORE_DEPENDENCIES

Here's a patch for initscripts:

If SYSTEMCTL_IGNORE_DEPENDENCIES is set, pass --ignore-dependencies to
systemctl. This allows programs which invoke /sbin/service to get more
SysV-like behaviour, i.e. where starting a service does not pull in any
dependencies and honours no ordering.

By default we continue to honour the dependencies since this is usually
safe and allows other software to hook into all services regardless by
who they are started.

This is the result of a discussion with the IPA people, Simo Sorce in
particular.
---
 rc.d/init.d/functions | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'rc.d/init.d/functions')

diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions
index 1256d10e..3f2cbc50 100644
--- a/rc.d/init.d/functions
+++ b/rc.d/init.d/functions
@@ -26,6 +26,7 @@ systemctl_redirect () {
 	local s
 	local prog=${1##*/}
         local command=$2
+        local options=""
 
 	case "$command" in
 	start)
@@ -42,7 +43,11 @@ systemctl_redirect () {
 		;;
 	esac
 
-	action "$s" /bin/systemctl $command "$prog.service"
+        if [ -n "$SYSTEMCTL_IGNORE_DEPENDENCIES" ] ; then
+                options="--ignore-dependencies"
+        fi
+
+	action "$s" /bin/systemctl $options $command "$prog.service"
 }
 
 # Get a sane screen width
-- 
cgit v1.2.1