Re: [systemd-devel] [PATCH 2/2] systemctl: Don't skip native units when enabling/disabling SysV init.d scripts

2015-05-28 Thread Dimitri John Ledkov
On 28 May 2015 at 12:31, Lennart Poettering lenn...@poettering.net wrote:
 On Wed, 27.05.15 15:13, Martin Pitt (martin.p...@ubuntu.com) wrote:

 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.

 Hmm? THis sounds the wrong way round. What currently happens should be
 this: if both are available systemd ignores the sysv script, and only
 considers the native unit. Is that what you are trying to say?

 And you now want everything to be applied to both the sysv script and
 the native unit?

 What happens if we query the state of things with is-enabled, then?

Debian supports rebooting with either sysv-init or systemd hence
the key point here multiple init systems, simultaneously within single
install.

-- 
Regards,

Dimitri.
Pura Vida!

https://clearlinux.org
Open Source Technology Center
Intel Corporation (UK) Ltd. - Co. Reg. #1134945 - Pipers Way, Swindon SN3 1RJ.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 2/2] systemctl: Don't skip native units when enabling/disabling SysV init.d scripts

2015-05-28 Thread Lennart Poettering
On Wed, 27.05.15 15:13, Martin Pitt (martin.p...@ubuntu.com) wrote:

 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.

Hmm? THis sounds the wrong way round. What currently happens should be
this: if both are available systemd ignores the sysv script, and only
considers the native unit. Is that what you are trying to say?

And you now want everything to be applied to both the sysv script and
the native unit?

What happens if we query the state of things with is-enabled, then?

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH 2/2] systemctl: Don't skip native units when enabling/disabling SysV init.d scripts

2015-05-27 Thread Martin Pitt
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 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 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



signature.asc
Description: Digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel