mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 00:59:48 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
49ae578774
commit
7bb060ebd0
@@ -24,19 +24,23 @@ if [ -n "$D" ]; then
|
|||||||
OPTS="--root=$D"
|
OPTS="--root=$D"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
systemctl $OPTS ${SYSTEMD_AUTO_ENABLE} ${SYSTEMD_SERVICE}
|
if type systemctl >/dev/null; then
|
||||||
|
systemctl $OPTS ${SYSTEMD_AUTO_ENABLE} ${SYSTEMD_SERVICE}
|
||||||
|
|
||||||
if [ -z "$D" -a "${SYSTEMD_AUTO_ENABLE}" = "enable" ]; then
|
if [ -z "$D" -a "${SYSTEMD_AUTO_ENABLE}" = "enable" ]; then
|
||||||
systemctl start ${SYSTEMD_SERVICE}
|
systemctl start ${SYSTEMD_SERVICE}
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
systemd_prerm() {
|
systemd_prerm() {
|
||||||
if [ -z "$D" ]; then
|
if type systemctl >/dev/null; then
|
||||||
systemctl stop ${SYSTEMD_SERVICE}
|
if [ -z "$D" ]; then
|
||||||
fi
|
systemctl stop ${SYSTEMD_SERVICE}
|
||||||
|
fi
|
||||||
|
|
||||||
systemctl disable ${SYSTEMD_SERVICE}
|
systemctl disable ${SYSTEMD_SERVICE}
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
python systemd_populate_packages() {
|
python systemd_populate_packages() {
|
||||||
@@ -56,14 +60,6 @@ python systemd_populate_packages() {
|
|||||||
bb.error('%s does not appear in package list, please add it' % pkg_systemd)
|
bb.error('%s does not appear in package list, please add it' % pkg_systemd)
|
||||||
|
|
||||||
|
|
||||||
# Add a runtime dependency on systemd to pkg
|
|
||||||
def systemd_add_rdepends(pkg):
|
|
||||||
rdepends = d.getVar('RDEPENDS_' + pkg, True) or ""
|
|
||||||
if not 'systemd' in rdepends.split():
|
|
||||||
rdepends = '%s %s' % (rdepends, 'systemd')
|
|
||||||
d.setVar('RDEPENDS_' + pkg, rdepends)
|
|
||||||
|
|
||||||
|
|
||||||
def systemd_generate_package_scripts(pkg):
|
def systemd_generate_package_scripts(pkg):
|
||||||
bb.debug(1, 'adding systemd calls to postinst/postrm for %s' % pkg)
|
bb.debug(1, 'adding systemd calls to postinst/postrm for %s' % pkg)
|
||||||
|
|
||||||
@@ -156,7 +152,6 @@ python systemd_populate_packages() {
|
|||||||
systemd_check_package(pkg)
|
systemd_check_package(pkg)
|
||||||
if d.getVar('SYSTEMD_SERVICE_' + pkg, True):
|
if d.getVar('SYSTEMD_SERVICE_' + pkg, True):
|
||||||
systemd_generate_package_scripts(pkg)
|
systemd_generate_package_scripts(pkg)
|
||||||
systemd_add_rdepends(pkg)
|
|
||||||
systemd_check_services()
|
systemd_check_services()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user