* [PATCH] update-rc: Stop and remove service if updating package
@ 2013-10-01 17:19 eu
2013-10-02 23:36 ` Saul Wold
0 siblings, 1 reply; 2+ messages in thread
From: eu @ 2013-10-01 17:19 UTC (permalink / raw)
To: openembedded-core
From: "Felipe F. Tonello" <eu@felipetonello.com>
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@felipetonello.com>
---
meta/classes/update-rc.d.bbclass | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass
index 5588569..773ca60 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"
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] update-rc: Stop and remove service if updating package
2013-10-01 17:19 [PATCH] update-rc: Stop and remove service if updating package eu
@ 2013-10-02 23:36 ` Saul Wold
0 siblings, 0 replies; 2+ messages in thread
From: Saul Wold @ 2013-10-02 23:36 UTC (permalink / raw)
To: eu; +Cc: openembedded-core
On 10/01/2013 10:19 AM, eu@felipetonello.com wrote:
> From: "Felipe F. Tonello" <eu@felipetonello.com>
>
> 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.
>
I think this patch might be responsible for some failures I am seeing on
the master_under_test build.
Check out this error log:
http://autobuilder.yoctoproject.org:8011/builders/minnow/builds/169/steps/Building%20Images/logs/stdio
Sau!
> Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
> ---
> meta/classes/update-rc.d.bbclass | 18 +++++++++++++++++-
> 1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass
> index 5588569..773ca60 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"
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-10-02 23:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-01 17:19 [PATCH] update-rc: Stop and remove service if updating package eu
2013-10-02 23:36 ` Saul Wold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox