summaryrefslogtreecommitdiffstats
path: root/meta/classes/update-rc.d.bbclass
diff options
context:
space:
mode:
authorFelipe F. Tonello <eu@felipetonello.com>2013-10-03 14:42:00 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-10-14 16:55:26 +0100
commit86bb78cc5364ffc2f6d1da116b17f92c0eb2acb2 (patch)
treea9fa291dd0541d01693bb38bc562ed197fea1643 /meta/classes/update-rc.d.bbclass
parent7266015ef26e8f3e6ed779d6bc814cf4560bf214 (diff)
downloadpoky-86bb78cc5364ffc2f6d1da116b17f92c0eb2acb2.tar.gz
update-rc: Stop and remove service if updating package
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. (From OE-Core rev: d91b08f3a27baa49ae35dc20dba1b2d76e6abd64) Signed-off-by: Felipe F. Tonello <eu@felipetonello.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/update-rc.d.bbclass')
-rw-r--r--meta/classes/update-rc.d.bbclass18
1 files changed, 17 insertions, 1 deletions
diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass
index f726f2f4b1..d44d36cb5b 100644
--- a/meta/classes/update-rc.d.bbclass
+++ b/meta/classes/update-rc.d.bbclass
@@ -13,7 +13,23 @@ INITSCRIPT_PARAMS ?= "defaults"
13INIT_D_DIR = "${sysconfdir}/init.d" 13INIT_D_DIR = "${sysconfdir}/init.d"
14 14
15updatercd_postinst() { 15updatercd_postinst() {
16if test "x$D" != "x"; then 16IN_TARGET=`test "x$D" = "x"`
17
18# test if there is a previous init script there, ie, we are updating the package
19# if so, we stop the service and remove it before we install from the new package
20if type update-rc.d >/dev/null 2>/dev/null; then
21 if [ $IN_TARGET -a `test -f "${INIT_D_DIR}/${INITSCRIPT_NAME}"` ]; then
22 ${INIT_D_DIR}/${INITSCRIPT_NAME} stop
23 fi
24 if [ ! $IN_TARGET ]; then
25 OPT="-f -r $D"
26 else
27 OPT="-f"
28 fi
29 update-rc.d $OPT ${INITSCRIPT_NAME} remove
30fi
31
32if [ ! $IN_TARGET ]; then
17 OPT="-r $D" 33 OPT="-r $D"
18else 34else
19 OPT="-s" 35 OPT="-s"