]> code.ossystems Code Review - openembedded-core.git/commitdiff
update-rcd.bbclass: fix host/target test
authorRoss Burton <ross.burton@intel.com>
Wed, 16 Oct 2013 13:07:51 +0000 (14:07 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 16 Oct 2013 13:50:58 +0000 (14:50 +0100)
"update-rc: Stop and remove service if updating package" (oe-core d91b08) had a
bug in it's implementation of a "host or target" test which always resulted in
"target", so the rootfs scripts were attempting to restart daemons on the host.

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/update-rc.d.bbclass

index d44d36cb5b7df235fe3f47eb1aa86f4c7eb5c76a..e14659d118487ab0825a57468cfe4b2a674b5630 100644 (file)
@@ -13,15 +13,13 @@ INITSCRIPT_PARAMS ?= "defaults"
 INIT_D_DIR = "${sysconfdir}/init.d"
 
 updatercd_postinst() {
-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
+       if [ -z "$D" -a `test -f "${INIT_D_DIR}/${INITSCRIPT_NAME}"` ]; then
                ${INIT_D_DIR}/${INITSCRIPT_NAME} stop
        fi
-       if [ ! $IN_TARGET ]; then
+       if [ -n "$D" ]; then
                OPT="-f -r $D"
        else
                OPT="-f"
@@ -29,7 +27,7 @@ if type update-rc.d >/dev/null 2>/dev/null; then
        update-rc.d $OPT ${INITSCRIPT_NAME} remove
 fi
 
-if [ ! $IN_TARGET ]; then
+if [ -n "$D" ]; then
        OPT="-r $D"
 else
        OPT="-s"