Hello,

if you have both a systemd unit and a SysV init script with the same
name, systemctl {en,dis}able currently diverts to chkconfig and
friends *only*, without actually enabling/disabling the native unit.
This is a non-issue for Fedora packages which eliminated init.d
scripts, but still an issue for e. g. Debian or third-party packages
which want to support multiple init systems.

This patch calls both chkconfig (or install_initd with the previous
patch) and handles the native unit in that case.

Thanks for considering,

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
From 09727b82df8d84d3350ff1339cffc0bb24a3e7ca Mon Sep 17 00:00:00 2001
From: Martin Pitt <[email protected]>
Date: Wed, 27 May 2015 14:52:17 +0200
Subject: [PATCH 2/2] systemctl: Don't skip native units when
 enabling/disabling SysV init.d scripts

If there is both a SysV init.d script and a systemd unit for a given name, we
want to do the same enable/disable operation for both, instead of just on the
SysV unit. In particular, we do not want to assume that chkconfig, update-rc.d,
install_initd etc. know about how to handle systemd units with all their
features (like Alias= links).
---
 src/systemctl/systemctl.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 9c87045..a5316e9 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -5153,9 +5153,6 @@ static int enable_sysv_units(const char *verb, char **args) {
                                 break;
                 }
 
-                if (found_native)
-                        continue;
-
                 p = path_join(arg_root, SYSTEM_SYSVINIT_PATH, name);
                 if (!p)
                         return log_oom();
@@ -5191,7 +5188,10 @@ static int enable_sysv_units(const char *verb, char **args) {
                 argv[c++] = p;
 #endif
 
-                log_info("%s is not a native service, redirecting to %s.", name, argv[0]);
+                if (found_native)
+                        log_info("Synchronizing state of %s with SysV init with %s...", name, argv[0]);
+                else
+                        log_info("%s is not a native service, redirecting to %s.", name, argv[0]);
 
                 argv[c] = NULL;
 
@@ -5233,6 +5233,9 @@ static int enable_sysv_units(const char *verb, char **args) {
                 } else
                         return -EPROTO;
 
+                if (found_native)
+                        continue;
+
                 /* Remove this entry, so that we don't try enabling it as native unit */
                 assert(f > 0);
                 f--;
-- 
2.1.4

Attachment: signature.asc
Description: Digital signature

_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to