alsa-state: fix pkg_postinst and set INHIBIT_UPDATERCD_BBCLASS
authorChen Qi <Qi.Chen@windriver.com>
Wed, 3 Sep 2014 07:09:02 +0000 (15:09 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 3 Sep 2014 10:09:04 +0000 (11:09 +0100)
As alsa-state inherits update-rc.d, the update-rc.d part inpostinst script
has already been handled in update-rc.d.bbclass.

Besides, we need to set INHIBIT_UPDATERCD_BBCLASS to "1" if 'sysvinit'
is not in DISTRO_FEATURES. This is because the init script is not installed
in such situation, adding update-rc.d part in the preinst/postinst scripts
just makes no sense.

(From OE-Core rev: 9b9da6667b606a56c89abc1b458f52dcca9774e9)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-bsp/alsa-state/alsa-state.bb

index d2f8ea2..17c2d00 100644 (file)
@@ -18,6 +18,13 @@ SRC_URI = "\
   file://alsa-state-init \
 "
 
+# As the recipe doesn't inherit systemd.bbclass, we need to set this variable
+# manually to avoid unnecessary postinst/preinst generated.
+python __anonymous() {
+    if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
+        d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
+}
+
 inherit update-rc.d
 
 INITSCRIPT_NAME = "alsa-state"
@@ -54,9 +61,5 @@ pkg_postinst_${PN}() {
                then
                        ${sbindir}/alsactl -f ${localstatedir}/lib/alsa/asound.state restore
                fi
-               # INITSCRIPT_PARAMS changed, so remove the old and
-               # install the new setting.
-               update-rc.d -f ${INITSCRIPT_NAME} remove
-               update-rc.d ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS}
        fi
 }