Hello,

same rationale and patch as before, just unfuzzed against the updated
"systemctl: drop hardcoded chkconfig invocation".

Martin
-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
>From 2ec8c55f4c37a95d7fdaba5241970d8b1334117f Mon Sep 17 00:00:00 2001
From: Martin Pitt <martin.p...@ubuntu.com>
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 2a81032..b922aca 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -5149,9 +5149,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();
@@ -5161,7 +5158,10 @@ static int enable_sysv_units(const char *verb, char **args) {
                 if (!found_sysv)
                         continue;
 
-                log_info("%s is not a native service, redirecting to systemd-sysv-install", name);
+                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 systemd-sysv-install", name);
 
                 if (!isempty(arg_root))
                         argv[c++] = q = strappend("--root=", arg_root);
@@ -5208,6 +5208,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

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to