diff options
author | Bob Henz <robert_henz@jabil.com> | 2022-09-19 22:02:58 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-09-28 07:59:35 +0100 |
commit | 8ede0083c28fadf1e83c9256618190b931edd306 (patch) | |
tree | 854242dcb9acdc1a53cc3d2be5a4e424b32ec256 /meta/recipes-core/systemd/systemd-systemctl/systemctl | |
parent | 976fe5e3fb630e9daf5bbde79ee2148a7a97694a (diff) | |
download | openembedded-core-contrib-8ede0083c28fadf1e83c9256618190b931edd306.tar.gz |
systemd-systemctl: Fix WantedBy processing
An empty string assignment to WantedBy should clear all prior WantedBy
settings. This matches behavior of the current systemd implementation.
Signed-off-by: Bob Henz <robert_henz@jabil.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/systemd/systemd-systemctl/systemctl')
-rwxr-xr-x | meta/recipes-core/systemd/systemd-systemctl/systemctl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl b/meta/recipes-core/systemd/systemd-systemctl/systemctl index 6d19666d82..cddae75a06 100755 --- a/meta/recipes-core/systemd/systemd-systemctl/systemctl +++ b/meta/recipes-core/systemd/systemd-systemctl/systemctl @@ -26,6 +26,9 @@ locations = list() class SystemdFile(): """Class representing a single systemd configuration file""" + + _clearable_keys = ['WantedBy'] + def __init__(self, root, path, instance_unit_name): self.sections = dict() self._parse(root, path) @@ -80,6 +83,14 @@ class SystemdFile(): v = m.group('value') if k not in section: section[k] = list() + + # If we come across a "key=" line for a "clearable key", then + # forget all preceding assignments. This works because we are + # processing files in correct parse order. + if k in self._clearable_keys and not v: + del section[k] + continue + section[k].extend(v.split()) def get(self, section, prop): |