]> code.ossystems Code Review - openembedded-core.git/commitdiff
systemd: Add partial support of drop-in configuration files to systemd-systemctl...
authorFrederic Ouellet <fredericouellet@eaton.com>
Thu, 25 Jul 2019 19:58:50 +0000 (15:58 -0400)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 26 Jul 2019 07:40:59 +0000 (08:40 +0100)
Support for serive-name.service.d/ folders containing .conf files
It don't support all the partial folder names

See https://www.freedesktop.org/software/systemd/man/systemd.unit.html

Signed-off-by: Frederic Ouellet <fredericouellet@eaton.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/systemd/systemd-systemctl/systemctl

index 8d7b3ba32d622f68ca9f1ff4aedf2c9469bfcdec..8837f54e16605bb211dba51e2710c79e9d57bd2f 100755 (executable)
@@ -28,6 +28,10 @@ class SystemdFile():
     def __init__(self, root, path):
         self.sections = dict()
         self._parse(root, path)
+        dirname = os.path.basename(path.name) + ".d"
+        for location in locations:
+            for path2 in sorted((root / location / "system" / dirname).glob("*.conf")):                
+                self._parse(root, path2)
 
     def _parse(self, root, path):
         """Parse a systemd syntax configuration file
@@ -56,8 +60,11 @@ class SystemdFile():
                 line = line.rstrip("\n")
                 m = section_re.match(line)
                 if m:
-                    section = dict()
-                    self.sections[m.group('section')] = section
+                    if m.group('section') not in self.sections:
+                        section = dict()
+                        self.sections[m.group('section')] = section
+                    else:
+                        section = self.sections[m.group('section')]
                     continue
 
                 while line.endswith("\\"):