summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2013-03-05 14:12:50 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-03-26 22:43:03 +0000
commit7bb060ebd0fd803710c20df3559fdd5a66e4d58e (patch)
tree370b915b5fcc4061436fc50504a0366e2aee70ff /meta
parent49ae578774851beed2e98cabda3101d88869ed9f (diff)
downloadpoky-7bb060ebd0fd803710c20df3559fdd5a66e4d58e.tar.gz
systemd: check for systemctl first, and don't force systemd to be installed.
With both sysvinit and systemd features enabled these postinsts may actually run on a target without systemd, so check that systemctl is present before using it. (From OE-Core rev: ac00e56cb9daacef17a6fdebe7b8ca1667b7e1c4) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/systemd.bbclass27
1 files changed, 11 insertions, 16 deletions
diff --git a/meta/classes/systemd.bbclass b/meta/classes/systemd.bbclass
index 564cd727df..cca2152927 100644
--- a/meta/classes/systemd.bbclass
+++ b/meta/classes/systemd.bbclass
@@ -24,19 +24,23 @@ if [ -n "$D" ]; then
24 OPTS="--root=$D" 24 OPTS="--root=$D"
25fi 25fi
26 26
27systemctl $OPTS ${SYSTEMD_AUTO_ENABLE} ${SYSTEMD_SERVICE} 27if type systemctl >/dev/null; then
28 systemctl $OPTS ${SYSTEMD_AUTO_ENABLE} ${SYSTEMD_SERVICE}
28 29
29if [ -z "$D" -a "${SYSTEMD_AUTO_ENABLE}" = "enable" ]; then 30 if [ -z "$D" -a "${SYSTEMD_AUTO_ENABLE}" = "enable" ]; then
30 systemctl start ${SYSTEMD_SERVICE} 31 systemctl start ${SYSTEMD_SERVICE}
32 fi
31fi 33fi
32} 34}
33 35
34systemd_prerm() { 36systemd_prerm() {
35if [ -z "$D" ]; then 37if type systemctl >/dev/null; then
36 systemctl stop ${SYSTEMD_SERVICE} 38 if [ -z "$D" ]; then
37fi 39 systemctl stop ${SYSTEMD_SERVICE}
40 fi
38 41
39systemctl disable ${SYSTEMD_SERVICE} 42 systemctl disable ${SYSTEMD_SERVICE}
43fi
40} 44}
41 45
42python systemd_populate_packages() { 46python systemd_populate_packages() {
@@ -56,14 +60,6 @@ python systemd_populate_packages() {
56 bb.error('%s does not appear in package list, please add it' % pkg_systemd) 60 bb.error('%s does not appear in package list, please add it' % pkg_systemd)
57 61
58 62
59 # Add a runtime dependency on systemd to pkg
60 def systemd_add_rdepends(pkg):
61 rdepends = d.getVar('RDEPENDS_' + pkg, True) or ""
62 if not 'systemd' in rdepends.split():
63 rdepends = '%s %s' % (rdepends, 'systemd')
64 d.setVar('RDEPENDS_' + pkg, rdepends)
65
66
67 def systemd_generate_package_scripts(pkg): 63 def systemd_generate_package_scripts(pkg):
68 bb.debug(1, 'adding systemd calls to postinst/postrm for %s' % pkg) 64 bb.debug(1, 'adding systemd calls to postinst/postrm for %s' % pkg)
69 65
@@ -156,7 +152,6 @@ python systemd_populate_packages() {
156 systemd_check_package(pkg) 152 systemd_check_package(pkg)
157 if d.getVar('SYSTEMD_SERVICE_' + pkg, True): 153 if d.getVar('SYSTEMD_SERVICE_' + pkg, True):
158 systemd_generate_package_scripts(pkg) 154 systemd_generate_package_scripts(pkg)
159 systemd_add_rdepends(pkg)
160 systemd_check_services() 155 systemd_check_services()
161} 156}
162 157