[packages/systemd] Ignore sysv init script when native exists

jajcus jajcus at pld-linux.org
Fri Apr 3 14:35:49 CEST 2015


commit afebd568b7229984e4ae04693dc23eab8a9fba7c
Author: Jacek Konieczny <j.konieczny at eggsoft.pl>
Date:   Fri Apr 3 14:34:13 2015 +0200

    Ignore sysv init script when native exists
    
    Otherwise even disabled systemd units would be started if there is
    a legacy service enabled.
    
    Patch taken from upstream:
    
    https://github.com/systemd/systemd/commit/f4f01ec146d91cb6943828851d98eee6a1ad4dd9?diff=unified

 ignore-sysv-if-native-exists.patch | 44 ++++++++++++++++++++++++++++++++++++++
 systemd.spec                       |  2 ++
 2 files changed, 46 insertions(+)
---
diff --git a/systemd.spec b/systemd.spec
index d6c249d..7c55f2c 100644
--- a/systemd.spec
+++ b/systemd.spec
@@ -57,6 +57,7 @@ Patch1:		config-pld.patch
 Patch2:		shut-sysv-up.patch
 Patch3:		pld-sysv-network.patch
 Patch4:		tmpfiles-not-fatal.patch
+Patch5:		ignore-sysv-if-native-exists.patch
 Patch8:		udev-ploop-rules.patch
 Patch9:		udevadm-in-sbin.patch
 Patch10:	net-rename-revert.patch
@@ -616,6 +617,7 @@ Uzupełnianie parametrów w zsh dla poleceń udev.
 #patch2 -p1
 %patch3 -p1
 %patch4 -p1
+%patch5 -p1
 %patch8 -p1
 %patch9 -p1
 # rejected upstream
diff --git a/ignore-sysv-if-native-exists.patch b/ignore-sysv-if-native-exists.patch
new file mode 100644
index 0000000..90aa462
--- /dev/null
+++ b/ignore-sysv-if-native-exists.patch
@@ -0,0 +1,44 @@
+From f4f01ec146d91cb6943828851d98eee6a1ad4dd9 Mon Sep 17 00:00:00 2001
+From: Martin Pitt <martin.pitt at ubuntu.com>
+Date: Wed, 2 Jul 2014 22:00:00 +0200
+Subject: [PATCH] sysv-generator: Skip init scripts for existing native
+ services
+
+This avoids taking the SysV init script enablement state into account if we
+have native units. Otherwise systemctl disable on native unit would not
+be respected in the presence of an enabled SysV script.
+
+Also, there's no need to do all the parsing and creation of service files if we
+already have a native systemd unit for the processed SysV init script.
+---
+ src/sysv-generator/sysv-generator.c |  8 +++++++-
+ test/sysv-generator-test.py         | 12 ++++++++++++
+ 2 files changed, 19 insertions(+), 1 deletion(-)
+
+diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
+index 673f04d..6e39b44 100644
+--- a/src/sysv-generator/sysv-generator.c
++++ b/src/sysv-generator/sysv-generator.c
+@@ -768,6 +768,11 @@ static int enumerate_sysv(LookupPaths lp, Hashmap *all_services) {
+                         if (!fpath)
+                                 return log_oom();
+ 
++                        if (unit_file_get_state(UNIT_FILE_SYSTEM, NULL, name) >= 0) {
++                                log_debug("Native unit for %s already exists, skipping", name);
++                                continue;
++                        }
++
+                         service = new0(SysvStub, 1);
+                         if (!service)
+                                 return log_oom();
+@@ -852,7 +857,8 @@ static int set_dependencies_from_rcnd(LookupPaths lp, Hashmap *all_services) {
+ 
+                                 service = hashmap_get(all_services, name);
+                                 if (!service){
+-                                        log_warning("Could not find init script for %s", name);
++                                        log_debug("Ignoring %s symlink in %s, not generating %s.",
++                                                  de->d_name, rcnd_table[i].path, name);
+                                         continue;
+                                 }
+ 
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/systemd.git/commitdiff/afebd568b7229984e4ae04693dc23eab8a9fba7c



More information about the pld-cvs-commit mailing list