Having recently switch from opkg to dpkg, I encountered some problems when
upgrading
packages which use the update-rc.d class. The problem are that update-rc.d :
a/ unconditionally calls "${INIT_D_DIR}/${INITSCRIPT_NAME} stop" in the prerm
script. This
is wrong, it should only do so when the prerm script is called for the
"upgrade" and
"remove" steps.
b/ unconditionally calls "update-rc.d $OPT ${INITSCRIPT_NAME} remove" in the
postrm
script. This is wrong, it should only do so when the prerm script is called for
the
"purge" step. However, "opkg" does not seem to support the "purge" step so I
suggest
calling it both for the "remove" and "purge" steps, after checking that the
init script no
longer exists.
You can find a description of how maintainer scripts are called by dpkg at:
http://www.debian.org/doc/debian-policy/ch-maintainerscripts.html
Attached is a patch which fixes both issues. I'd appreciate comments on this
one as
update-rc.d.bbclass is widely used.
--
Jeremy LAINE
Bolloré telecom | 11bis, rue Scribe | F-75009 Paris
diff --git a/classes/update-rc.d.bbclass b/classes/update-rc.d.bbclass
index 91af859..4744806 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
+# in the "purge" step, but opkg does not support it. So instead we also
+# run it at the "remove" step in 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
}
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel