diff options
| -rw-r--r-- | meta/classes/update-rc.d.bbclass | 18 |
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" | |||
| 13 | INIT_D_DIR = "${sysconfdir}/init.d" | 13 | INIT_D_DIR = "${sysconfdir}/init.d" |
| 14 | 14 | ||
| 15 | updatercd_postinst() { | 15 | updatercd_postinst() { |
| 16 | if test "x$D" != "x"; then | 16 | IN_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 | ||
| 20 | if 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 | ||
| 30 | fi | ||
| 31 | |||
| 32 | if [ ! $IN_TARGET ]; then | ||
| 17 | OPT="-r $D" | 33 | OPT="-r $D" |
| 18 | else | 34 | else |
| 19 | OPT="-s" | 35 | OPT="-s" |
