From f203ba854e5e6b847c43350c722c9bf22f334c10 Mon Sep 17 00:00:00 2001 From: Chen Qi Date: Tue, 12 Aug 2014 21:58:15 -0400 Subject: update-rc.d: fix logic in populate_packages_updatercd The 'and' logic for the check is wrong. To make things clear, please see the example below. Say that we have a recipe A, which has a sysv-init style init script named initA and no corresponding service file. The recipe inherits update-rc.d, but it doesn't inherit systemd.bbclass. The DISTRO_FEATURES has 'systemd' inside it, but it doesn't have 'sysvinit'. Now if we build an image, with the 'and' logic in the check, the symlinks for initA would not be installed into /etc/rc?.d directory. This is incorrect. Because there's no corresponding service. The symlinks in /etc/rc?.d/ should be created so that the service would be correctly started at boot time. The logic should really be 'or' in the check. This is actually what the code was when it was originally written. Several different situations are listed below to prove the correctness of the 'or' logic. If 'sysvinit' is in DISTRO_FEATURES, the initA script would always be installed with corresponding preisnt/postinst generated and added. If 'sysvinit' is not in DISTRO_FEATURES, we have three situations. 1) A has initA and A.service. In such situation, systemd.bbclass would set INHIBIT_UPDATERCD_BBCLASS, so no preinst/postinst about update-rc.d would be added and the symlinks for initA would not be created. 2) A has initA, and the functionality of initA is not implemented internally in systemd. In such situation, symlinks for initA would be installed. 3) A has initA, and the functionality of initA is implemented internally in systemd or in some other recipe. Examples for such situation are alsa-state and keymaps in OE. In such situation, we need to set INHIBIT_UPDATERCD_BBCLASS in the recipe so that there would be no preinst/postinst scripts about update-rc.d added. Signed-off-by: Chen Qi --- meta/classes/update-rc.d.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass index 19b081d235..3c5414b79b 100644 --- a/meta/classes/update-rc.d.bbclass +++ b/meta/classes/update-rc.d.bbclass @@ -121,7 +121,7 @@ python populate_packages_updatercd () { # Check that this class isn't being inhibited (generally, by # systemd.bbclass) before doing any work. - if bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d) and \ + if bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d) or \ not d.getVar("INHIBIT_UPDATERCD_BBCLASS", True): pkgs = d.getVar('INITSCRIPT_PACKAGES', True) if pkgs == None: -- cgit 1.2.3-korg