[oe-commits] Jeremy Lainé : update-rc.d.bbclass: make prerm and postrm dpkg-compatible

git version control git at git.openembedded.org
Tue Oct 27 09:47:29 UTC 2009


Module: openembedded.git
Branch: koen/static-libs-rework
Commit: 1f7a632a9689fb9b6e03eefd0781f3e39c6f12e5
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=1f7a632a9689fb9b6e03eefd0781f3e39c6f12e5

Author: Jeremy Lainé <jeremy.laine at m4x.org>
Date:   Mon Oct 26 09:49:20 2009 +0100

update-rc.d.bbclass: make prerm and postrm dpkg-compatible

* prerm : only stop service at the "upgrade" and "remove" steps
* postrm : only remove symlinks at the "remove" and "purge" steps, after
  checking the init script no longer exists

---

 classes/update-rc.d.bbclass |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/classes/update-rc.d.bbclass b/classes/update-rc.d.bbclass
index 91af859..00ec37c 100644
--- a/classes/update-rc.d.bbclass
+++ b/classes/update-rc.d.bbclass
@@ -16,17 +16,27 @@ update-rc.d $OPT ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS}
 
 updatercd_prerm() {
 if test "x$D" = "x"; then
-	${INIT_D_DIR}/${INITSCRIPT_NAME} stop
+	if test "$1" = "upgrade" -o "$1" = "remove"; then
+		${INIT_D_DIR}/${INITSCRIPT_NAME} stop
+	fi
 fi
 }
 
+# Note: to be Debian compliant, we should only invoke update-rc.d remove
+# at the "purge" step, but opkg does not support it. So instead we also
+# run it at the "remove" step if the init script no longer exists.
+
 updatercd_postrm() {
 if test "x$D" != "x"; then
 	OPT="-r $D"
 else
 	OPT=""
 fi
-update-rc.d $OPT ${INITSCRIPT_NAME} remove
+if test "$1" = "remove" -o "$1" = "purge"; then
+	if ! test -e "${INIT_D_DIR}/${INITSCRIPT_NAME}"; then
+		update-rc.d $OPT ${INITSCRIPT_NAME} remove
+	fi
+fi
 }
 
 





More information about the Openembedded-commits mailing list