1 From f4f01ec146d91cb6943828851d98eee6a1ad4dd9 Mon Sep 17 00:00:00 2001
2 From: Martin Pitt <martin.pitt@ubuntu.com>
3 Date: Wed, 2 Jul 2014 22:00:00 +0200
4 Subject: [PATCH] sysv-generator: Skip init scripts for existing native
7 This avoids taking the SysV init script enablement state into account if we
8 have native units. Otherwise systemctl disable on native unit would not
9 be respected in the presence of an enabled SysV script.
11 Also, there's no need to do all the parsing and creation of service files if we
12 already have a native systemd unit for the processed SysV init script.
14 src/sysv-generator/sysv-generator.c | 8 +++++++-
15 test/sysv-generator-test.py | 12 ++++++++++++
16 2 files changed, 19 insertions(+), 1 deletion(-)
18 diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
19 index 673f04d..6e39b44 100644
20 --- a/src/sysv-generator/sysv-generator.c
21 +++ b/src/sysv-generator/sysv-generator.c
22 @@ -768,6 +768,11 @@ static int enumerate_sysv(LookupPaths lp, Hashmap *all_services) {
26 + if (unit_file_get_state(UNIT_FILE_SYSTEM, NULL, name) >= 0) {
27 + log_debug("Native unit for %s already exists, skipping", name);
31 service = new0(SysvStub, 1);
34 @@ -852,7 +857,8 @@ static int set_dependencies_from_rcnd(LookupPaths lp, Hashmap *all_services) {
36 service = hashmap_get(all_services, name);
38 - log_warning("Could not find init script for %s", name);
39 + log_debug("Ignoring %s symlink in %s, not generating %s.",
40 + de->d_name, rcnd_table[i].path, name);