* [PATCH][RFC] update-rc.d.bbclass vs dpkg issues
@ 2009-10-23 8:09 Jeremy Lainé
2009-10-23 8:37 ` Phil Blundell
0 siblings, 1 reply; 2+ messages in thread
From: Jeremy Lainé @ 2009-10-23 8:09 UTC (permalink / raw)
To: openembedded-devel
[-- Attachment #1: Type: text/plain, Size: 1073 bytes --]
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
[-- Attachment #2: update-rc-d-class.patch --]
[-- Type: text/x-diff, Size: 988 bytes --]
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
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-10-23 8:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-23 8:09 [PATCH][RFC] update-rc.d.bbclass vs dpkg issues Jeremy Lainé
2009-10-23 8:37 ` Phil Blundell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.