systemd/0008-sysv-generator-translate-Required-Start-into-a-Wants.patch
2024-04-25 09:12:22 +00:00

58 lines
2.4 KiB
Diff

From 6eb24d1fcf8ea676bd0f0e32a9afda7431eafd77 Mon Sep 17 00:00:00 2001
From: Thomas Blume <Thomas.Blume@suse.com>
Date: Wed, 4 May 2016 17:40:04 +0200
Subject: [PATCH] sysv-generator: translate "Required-Start" into a "Wants"
dependency
'Required-Start:' used to be supported by insserv but this functionality was
dropped when insserv was rewritten into a compat perl wrapper (insserv-compat),
which happened when systemd was introduced in SUSE, I guess.
It's been decided to add back the support in systemd instead of insserv-compat,
see the comments in bsc#857204.
[tblume: Port of SLES12SP1 patch 0018-Make-LSB-Skripts-know-about-Required-and-Should.patch]
[fbui: patch sysv-generator-test.py to take this SUSE's specifity into account]
[wfink: fixes bsc#857204]
---
src/sysv-generator/sysv-generator.c | 7 ++++++-
test/sysv-generator-test.py | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index 4485e2e368..e0833a7179 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -412,8 +412,13 @@ static int handle_dependencies(SysvStub *s, unsigned line, const char *full_text
return log_oom();
r = strv_extend(&s->wants, m);
- } else
+ } else {
r = strv_extend(is_before ? &s->before : &s->after, m);
+
+ if (startswith_no_case(full_text, "Required-Start:"))
+ r = strv_extend(&s->wants, m);
+ }
+
if (r < 0)
return log_oom();
}
diff --git a/test/sysv-generator-test.py b/test/sysv-generator-test.py
index 24fafbaaa4..827d802a17 100755
--- a/test/sysv-generator-test.py
+++ b/test/sysv-generator-test.py
@@ -224,7 +224,7 @@ class SysvGeneratorTest(unittest.TestCase):
self.add_sysv('foo', {'Required-Start': '$named $portmap'})
s = self.run_generator()[1]['foo.service']
self.assertEqual(set(s.options('Unit')),
- set(['Documentation', 'SourcePath', 'Description', 'After']))
+ set(['Documentation', 'SourcePath', 'Description', 'After', 'Wants']))
self.assertEqual(s.get('Unit', 'After').split(), ['nss-lookup.target', 'rpcbind.target'])
def test_lsb_deps(self):
--
2.35.3