All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] systemd: allow dots in arguments to template units
@ 2017-11-23 12:24 Martin Hundebøll
  0 siblings, 0 replies; only message in thread
From: Martin Hundebøll @ 2017-11-23 12:24 UTC (permalink / raw)
  To: OE-core

When installing systemd template units with an argument, the current code
removes characters between the '@' and the '.' from service names in
SYSTEMD_SERVICE_${PN}, e.g.:

  getty@tty1.service -> getty@.service

This fails for services with dots in the argument (which is perfectly
legal in systemd), since the code searches only until the first dot.
E.g.:

  vlan@eth0.1.service -> vlan@1.service

This is obviously wrong, and fails in systemd_populate_packages(), where
it fails to find the unit file.

Fix this by reworking the removal of the argument part of the service
name, so that parts before '@' and after teh last '.' are used as base
name.

Signed-off-by: Martin Hundebøll <mnhu@prevas.dk>
---
 meta/classes/systemd.bbclass | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/meta/classes/systemd.bbclass b/meta/classes/systemd.bbclass
index c4b4bb9b70..1b134322fb 100644
--- a/meta/classes/systemd.bbclass
+++ b/meta/classes/systemd.bbclass
@@ -154,8 +154,10 @@ python systemd_populate_packages() {
                 # Deal with adding, for example, 'ifplugd@eth0.service' from
                 # 'ifplugd@.service'
                 base = None
-                if service.find('@') != -1:
-                    base = re.sub('@[^.]+.', '@.', service)
+                at = service.find('@')
+                if at != -1:
+                    ext = service.rfind('.')
+                    base = service[:at] + '@' + service[ext:]
 
                 for path in searchpaths:
                     if os.path.exists(oe.path.join(d.getVar("D"), path, service)):
-- 
2.15.0



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-11-23 12:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-23 12:24 [PATCH] systemd: allow dots in arguments to template units Martin Hundebøll

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.