diff options
| -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 cddae75a06..b45a2dc2f7 100755 --- a/meta/recipes-core/systemd/systemd-systemctl/systemctl +++ b/meta/recipes-core/systemd/systemd-systemctl/systemctl | |||
| @@ -195,12 +195,19 @@ class SystemdUnit(): | |||
| 195 | 195 | ||
| 196 | raise SystemdUnitNotFoundError(self.root, unit) | 196 | raise SystemdUnitNotFoundError(self.root, unit) |
| 197 | 197 | ||
| 198 | def _process_deps(self, config, service, location, prop, dirstem): | 198 | def _process_deps(self, config, service, location, prop, dirstem, instance): |
| 199 | systemdir = self.root / SYSCONFDIR / "systemd" / "system" | 199 | systemdir = self.root / SYSCONFDIR / "systemd" / "system" |
| 200 | 200 | ||
| 201 | target = ROOT / location.relative_to(self.root) | 201 | target = ROOT / location.relative_to(self.root) |
| 202 | try: | 202 | try: |
| 203 | for dependent in config.get('Install', prop): | 203 | for dependent in config.get('Install', prop): |
| 204 | # determine whether or not dependent is a template with an actual | ||
| 205 | # instance (i.e. a '@%i') | ||
| 206 | dependent_is_template = re.match(r"[^@]+@(?P<instance>[^\.]*)\.", dependent) | ||
| 207 | if dependent_is_template: | ||
| 208 | # if so, replace with the actual instance to achieve | ||
| 209 | # svc-wants@a.service.wants/svc-wanted-by@a.service | ||
| 210 | dependent = re.sub(dependent_is_template.group('instance'), instance, dependent, 1) | ||
| 204 | wants = systemdir / "{}.{}".format(dependent, dirstem) / service | 211 | wants = systemdir / "{}.{}".format(dependent, dirstem) / service |
| 205 | add_link(wants, target) | 212 | add_link(wants, target) |
| 206 | 213 | ||
| @@ -240,8 +247,8 @@ class SystemdUnit(): | |||
| 240 | else: | 247 | else: |
| 241 | service = self.unit | 248 | service = self.unit |
| 242 | 249 | ||
| 243 | self._process_deps(config, service, path, 'WantedBy', 'wants') | 250 | self._process_deps(config, service, path, 'WantedBy', 'wants', instance) |
| 244 | self._process_deps(config, service, path, 'RequiredBy', 'requires') | 251 | self._process_deps(config, service, path, 'RequiredBy', 'requires', instance) |
| 245 | 252 | ||
| 246 | try: | 253 | try: |
| 247 | for also in config.get('Install', 'Also'): | 254 | for also in config.get('Install', 'Also'): |
