[oe-commits] Felipe F. Tonello : update-rc: Stop and remove service if updating package
git at git.openembedded.org
git at git.openembedded.org
Mon Oct 14 15:46:31 UTC 2013
Module: openembedded-core.git
Branch: master-next
Commit: d91b08f3a27baa49ae35dc20dba1b2d76e6abd64
URL: http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=d91b08f3a27baa49ae35dc20dba1b2d76e6abd64
Author: Felipe F. Tonello <eu at felipetonello.com>
Date: Thu Oct 3 14:42:00 2013 -0700
update-rc: Stop and remove service if updating package
Since when updating packages packages managers do not remove the previous package,
it just replaces new files and run pre/post install scripts. This causes not
to update update-rc scripts if they were changed.
This patch is useful in case the newer package version updated the update-rc
script.
Signed-off-by: Felipe F. Tonello <eu at felipetonello.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
meta/classes/update-rc.d.bbclass | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass
index f726f2f..d44d36c 100644
--- a/meta/classes/update-rc.d.bbclass
+++ b/meta/classes/update-rc.d.bbclass
@@ -13,7 +13,23 @@ INITSCRIPT_PARAMS ?= "defaults"
INIT_D_DIR = "${sysconfdir}/init.d"
updatercd_postinst() {
-if test "x$D" != "x"; then
+IN_TARGET=`test "x$D" = "x"`
+
+# test if there is a previous init script there, ie, we are updating the package
+# if so, we stop the service and remove it before we install from the new package
+if type update-rc.d >/dev/null 2>/dev/null; then
+ if [ $IN_TARGET -a `test -f "${INIT_D_DIR}/${INITSCRIPT_NAME}"` ]; then
+ ${INIT_D_DIR}/${INITSCRIPT_NAME} stop
+ fi
+ if [ ! $IN_TARGET ]; then
+ OPT="-f -r $D"
+ else
+ OPT="-f"
+ fi
+ update-rc.d $OPT ${INITSCRIPT_NAME} remove
+fi
+
+if [ ! $IN_TARGET ]; then
OPT="-r $D"
else
OPT="-s"
More information about the Openembedded-commits
mailing list