All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jeremy Lainé" <jeremy.laine@bolloretelecom.eu>
To: openembedded-devel@lists.openembedded.org
Subject: [PATCH][RFC] update-rc.d.bbclass vs dpkg issues
Date: Fri, 23 Oct 2009 10:09:25 +0200	[thread overview]
Message-ID: <4AE164B5.20001@bolloretelecom.eu> (raw)

[-- 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
 }
 
 

             reply	other threads:[~2009-10-23  8:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-23  8:09 Jeremy Lainé [this message]
2009-10-23  8:37 ` [PATCH][RFC] update-rc.d.bbclass vs dpkg issues Phil Blundell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AE164B5.20001@bolloretelecom.eu \
    --to=jeremy.laine@bolloretelecom.eu \
    --cc=openembedded-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.