From 668480e46416b16ce22d2f0584b2c7f65e78a6c8 Mon Sep 17 00:00:00 2001 From: Andreas Oberritter Date: Sat, 13 Sep 2014 13:29:02 +0200 Subject: 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 ', 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 --- meta/classes/update-rc.d.bbclass | 4 ++-- 1 file 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 } -- cgit 1.2.3-korg