summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core
diff options
context:
space:
mode:
authorRandy Witt <rewitt@declaratino.com>2013-06-21 00:12:57 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-06-25 17:44:56 +0100
commit44c5b770ab11d0020cd6fff8936215d627d483e9 (patch)
treeb8d73b7ddccb36a4466a4a2671651b096b17428c /meta/recipes-core
parent53553118867529f865a8681408b89a3b442f7278 (diff)
downloadpoky-44c5b770ab11d0020cd6fff8936215d627d483e9.tar.gz
systemctl: Support all unit types in the directives.
The Alias and WantedBy directives can accept all valid unit types when using the systemctl from systemd. And since the systemctl script should match the behavior of systemd as much as possible, add the current set of unit types listed at http://www.freedesktop.org/software/systemd/man/systemd.unit.html to the Alias and WantedBy directives. The deficiency was exposed when trying to use: Alias=default.target in a foo.target. No symlink was created by running "systemctl enable foo.target" during the package's postinst. (From OE-Core rev: 374b9c37b3310cf2a3373633197ca7ba21f6d1bd) Signed-off-by: Randy Witt <rewitt@declaratino.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rwxr-xr-xmeta/recipes-core/systemd/systemd-systemctl/systemctl8
1 files changed, 6 insertions, 2 deletions
diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl b/meta/recipes-core/systemd/systemd-systemctl/systemctl
index 8abbdf6938..f7866565b9 100755
--- a/meta/recipes-core/systemd/systemd-systemctl/systemctl
+++ b/meta/recipes-core/systemd/systemd-systemctl/systemctl
@@ -77,10 +77,14 @@ for service in $services; do
77 fi 77 fi
78 echo "Found $service in $service_file" 78 echo "Found $service in $service_file"
79 79
80 # If any new unit types are added to systemd they should be added
81 # to this regular expression.
82 unit_types_re='\.\(service\|socket\|device\|mount\|automount\|swap\|target\|path\|timer\|snapshot\)$'
83
80 # create the required symbolic links 84 # create the required symbolic links
81 wanted_by=$(sed '/^WantedBy[[:space:]]*=/s,[^=]*=,,p;d' "$ROOT/$service_file" \ 85 wanted_by=$(sed '/^WantedBy[[:space:]]*=/s,[^=]*=,,p;d' "$ROOT/$service_file" \
82 | tr ',' '\n' \ 86 | tr ',' '\n' \
83 | grep '\(\.target$\)\|\(\.service$\)') 87 | grep "$unit_types_re")
84 88
85 for r in $wanted_by; do 89 for r in $wanted_by; do
86 echo "WantedBy=$r found in $service" 90 echo "WantedBy=$r found in $service"
@@ -98,7 +102,7 @@ for service in $services; do
98 # create the required symbolic 'Alias' links 102 # create the required symbolic 'Alias' links
99 alias=$(sed '/^Alias[[:space:]]*=/s,[^=]*=,,p;d' "$ROOT/$service_file" \ 103 alias=$(sed '/^Alias[[:space:]]*=/s,[^=]*=,,p;d' "$ROOT/$service_file" \
100 | tr ',' '\n' \ 104 | tr ',' '\n' \
101 | grep '\.service$') 105 | grep "$unit_types_re")
102 106
103 for r in $alias; do 107 for r in $alias; do
104 if [ "$action" = "enable" ]; then 108 if [ "$action" = "enable" ]; then