summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Oberritter <obi@opendreambox.org>2014-09-13 13:29:02 +0200
committerAndreas Oberritter <obi@opendreambox.org>2015-02-23 17:15:52 +0100
commit668480e46416b16ce22d2f0584b2c7f65e78a6c8 (patch)
treec72e03de6fe84f8584af31198ba9551da8e01979
parente7db2c7136a041f584c18ca178aa2556d7e1159e (diff)
downloadopenembedded-core-contrib-668480e46416b16ce22d2f0584b2c7f65e78a6c8.tar.gz
openembedded-core-contrib-668480e46416b16ce22d2f0584b2c7f65e78a6c8.tar.bz2
openembedded-core-contrib-668480e46416b16ce22d2f0584b2c7f65e78a6c8.zip
update-rc.d.bbclass: ignore initscript in prerm and preinst when systemd is active
In hybrid systemd/sysvinit builds, if the recipe inherits systemd and systemd is installed, we can safely assume that the service gets stopped by the prerm script fragment from systemd.bbclass. This fixes deinstallation of packages with initscripts returning errors when no running service was found. The preinst shouldn't run the initscript either, because postinst will call systemctl restart. This works by running 'systemctl is-enabled <initscript>', which outputs the current enable status, if the script name is handled by systemd, either because it's masked or because a systemd unit exists with that name. Otherwise, or if systemctl doesn't exist, no output is generated. Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
-rw-r--r--meta/classes/update-rc.d.bbclass4
1 files changed, 2 insertions, 2 deletions
diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass
index ec88bc3c20..c3d2d0519b 100644
--- a/meta/classes/update-rc.d.bbclass
+++ b/meta/classes/update-rc.d.bbclass
@@ -13,7 +13,7 @@ INITSCRIPT_PARAMS ?= "defaults"
INIT_D_DIR = "${sysconfdir}/init.d"
updatercd_preinst() {
-if [ -z "$D" -a -f "${INIT_D_DIR}/${INITSCRIPT_NAME}" ]; then
+if [ -z "$D" -a -f "${INIT_D_DIR}/${INITSCRIPT_NAME}" -a -z "`systemctl is-enabled ${INITSCRIPT_NAME} 2>/dev/null`" ]; then
${INIT_D_DIR}/${INITSCRIPT_NAME} stop
fi
if type update-rc.d >/dev/null 2>/dev/null; then
@@ -38,7 +38,7 @@ fi
}
updatercd_prerm() {
-if [ -z "$D" ]; then
+if [ -z "$D" -a -z "`systemctl is-enabled ${INITSCRIPT_NAME} 2>/dev/null`" ]; then
${INIT_D_DIR}/${INITSCRIPT_NAME} stop
fi
}