diff options
Diffstat (limited to 'meta/recipes-core/systemd/systemd-systemctl/systemctl')
| -rwxr-xr-x | meta/recipes-core/systemd/systemd-systemctl/systemctl | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl b/meta/recipes-core/systemd/systemd-systemctl/systemctl index 6d19666d82..1c87beadad 100755 --- a/meta/recipes-core/systemd/systemd-systemctl/systemctl +++ b/meta/recipes-core/systemd/systemd-systemctl/systemctl | |||
| @@ -184,12 +184,19 @@ class SystemdUnit(): | |||
| 184 | 184 | ||
| 185 | raise SystemdUnitNotFoundError(self.root, unit) | 185 | raise SystemdUnitNotFoundError(self.root, unit) |
| 186 | 186 | ||
| 187 | def _process_deps(self, config, service, location, prop, dirstem): | 187 | def _process_deps(self, config, service, location, prop, dirstem, instance): |
| 188 | systemdir = self.root / SYSCONFDIR / "systemd" / "system" | 188 | systemdir = self.root / SYSCONFDIR / "systemd" / "system" |
| 189 | 189 | ||
| 190 | target = ROOT / location.relative_to(self.root) | 190 | target = ROOT / location.relative_to(self.root) |
| 191 | try: | 191 | try: |
| 192 | for dependent in config.get('Install', prop): | 192 | for dependent in config.get('Install', prop): |
| 193 | # determine whether or not dependent is a template with an actual | ||
| 194 | # instance (i.e. a '@%i') | ||
| 195 | dependent_is_template = re.match(r"[^@]+@(?P<instance>[^\.]*)\.", dependent) | ||
| 196 | if dependent_is_template: | ||
| 197 | # if so, replace with the actual instance to achieve | ||
| 198 | # svc-wants@a.service.wants/svc-wanted-by@a.service | ||
| 199 | dependent = re.sub(dependent_is_template.group('instance'), instance, dependent, 1) | ||
| 193 | wants = systemdir / "{}.{}".format(dependent, dirstem) / service | 200 | wants = systemdir / "{}.{}".format(dependent, dirstem) / service |
| 194 | add_link(wants, target) | 201 | add_link(wants, target) |
| 195 | 202 | ||
| @@ -229,8 +236,8 @@ class SystemdUnit(): | |||
| 229 | else: | 236 | else: |
| 230 | service = self.unit | 237 | service = self.unit |
| 231 | 238 | ||
| 232 | self._process_deps(config, service, path, 'WantedBy', 'wants') | 239 | self._process_deps(config, service, path, 'WantedBy', 'wants', instance) |
| 233 | self._process_deps(config, service, path, 'RequiredBy', 'requires') | 240 | self._process_deps(config, service, path, 'RequiredBy', 'requires', instance) |
| 234 | 241 | ||
| 235 | try: | 242 | try: |
| 236 | for also in config.get('Install', 'Also'): | 243 | for also in config.get('Install', 'Also'): |
