public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH] systemd: fix systemctl enable script for template units
@ 2016-01-12 12:55 Enrico Jorns
  0 siblings, 0 replies; only message in thread
From: Enrico Jorns @ 2016-01-12 12:55 UTC (permalink / raw)
  To: openembedded-core

The systemctl script supports enabling template units by evaluating
"DefaultInstance" parameter. Unfortunately, due to the sed replacement
mechanism, all escaping used in the DefaultInstance string, e.g. for
giving path names with dashes, is expanded too early.

Thus for

  DefaultInstance=-path\x2dwith\x2ddashes

a path unit `foobar@.path` will be installed with a symlink named

  foobar@-path-with-dashed.path

that is interpreted as the path `/path/with/dashes` instead of the
intended path nam `/path-with-dashes`.

To fix this behavior additional escaping of the backslashes in the
`DefaultInstance` string is required so that sed does not expand the
escaped characters.

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
---
 meta/recipes-core/systemd/systemd-systemctl/systemctl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl b/meta/recipes-core/systemd/systemd-systemctl/systemctl
index 6e163bd..697fbd5 100755
--- a/meta/recipes-core/systemd/systemd-systemctl/systemctl
+++ b/meta/recipes-core/systemd/systemd-systemctl/systemctl
@@ -136,7 +136,7 @@ for service in $services; do
 					continue
 				else
 					echo "Found DefaultInstance $default_instance, enabling it"
-					enable_service=$(echo $service | sed "s/@/@$default_instance/")
+					enable_service=$(echo $service | sed "s/@/@$(echo $default_instance | sed 's/\\/\\\\/g')/")
 				fi
 			fi
 			mkdir -p $ROOT/etc/systemd/system/$r.wants
-- 
2.6.4



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

only message in thread, other threads:[~2016-01-12 13:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-12 12:55 [PATCH] systemd: fix systemctl enable script for template units Enrico Jorns

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox