diff options
author | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-11-05 19:23:07 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-01-28 16:56:33 +0000 |
commit | aee9c2c28bf8d90f2bd30834b6d9f51141837338 (patch) | |
tree | 824d1cce7fb6ce384030acc9edaec03f4b536e8a /meta | |
parent | 7800f42e94fefb1644664384f569af0df87cc721 (diff) | |
download | openembedded-core-aee9c2c28bf8d90f2bd30834b6d9f51141837338.tar.gz openembedded-core-aee9c2c28bf8d90f2bd30834b6d9f51141837338.tar.bz2 openembedded-core-aee9c2c28bf8d90f2bd30834b6d9f51141837338.zip |
systemd-systemctl-native: handle Install wildcards
Handle the %i wildcard appearing in a dependency in the Install section
of a template unit, e.g.
$ cat foo@.service
[Install]
WantedBy=bar@%i.target
Using the real systemctl something like:
$ systemctl enable foo@baz.service
will create a symlink in /etc/systemd/system/bar@baz.target.wants.
Detect wildcards in templates and make the appropriate substitution.
(From OE-Core rev: 22ed19292d160461042d4a2294fe2ec0b953873e)
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'meta')
-rwxr-xr-x | meta/recipes-core/systemd/systemd-systemctl/systemctl | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl b/meta/recipes-core/systemd/systemd-systemctl/systemctl index 6e5a1b7181..2bc6489617 100755 --- a/meta/recipes-core/systemd/systemd-systemctl/systemctl +++ b/meta/recipes-core/systemd/systemd-systemctl/systemctl @@ -84,11 +84,7 @@ for service in $services; do else echo "Try to find location of template $service_base_file of instance $service..." service_template=true - if [ -z `echo $service | sed 's/^.\+@\(.*\)\.[^.]\+/\1/'` ]; then - instance_specified=false - else - instance_specified=true - fi + instance_specified=`echo $service | sed 's/^.\+@\(.*\)\.[^.]\+/\1/'` fi # find service file @@ -139,9 +135,14 @@ for service in $services; do fi for r in $dependency_list; do echo "$dependency=$r found in $service" + if [ -n "$instance_specified" ]; then + # substitute wildcards in the dependency + r=`echo $r | sed "s/%i/$instance_specified/g"` + fi + if [ "$action" = "enable" ]; then enable_service=$service - if [ "$service_template" = true -a "$instance_specified" = false ]; then + if [ "$service_template" = true -a -z "$instance_specified" ]; then default_instance=$(sed '/^DefaultInstance[[:space:]]*=/s,[^=]*=,,p;d' "$ROOT/$service_file") if [ -z $default_instance ]; then echo "Template unit without instance or DefaultInstance directive, nothing to enable" @@ -155,7 +156,7 @@ for service in $services; do ln -s $service_file $ROOT/etc/systemd/system/$r.$suffix/$enable_service echo "Enabled $enable_service for $r." else - if [ "$service_template" = true -a "$instance_specified" = false ]; then + if [ "$service_template" = true -a -z "$instance_specified" ]; then disable_service="$ROOT/etc/systemd/system/$r.$suffix/`echo $service | sed 's/@/@*/'`" else disable_service="$ROOT/etc/systemd/system/$r.$suffix/$service" |