Patchwork [2/5] update-rc.d: don't do anything if systemd.bbclass is inherited

login
register
mail settings
Submitter Ross Burton
Date Feb. 8, 2013, 10:43 p.m.
Message ID <2f3ac96fb6a599b3c8a62eb68417dd8e26b21676.1360360346.git.ross.burton@intel.com>
Download mbox | patch
Permalink /patch/44393/
State Not Applicable, archived
Headers show

Comments

Ross Burton - Feb. 8, 2013, 10:43 p.m.
We need the update-rc.d class to work when systemd is being used so that
packages that only have SysV init scripts still work.  However if a recipe
supports both we don't want to install SysV and systemd files under systemd.

To solve this, before doing real work in update-rc.d check if the systemd class
has been inherited and don't do anything if it has.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/classes/update-rc.d.bbclass |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

Patch

diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass
index f9d55fb..51ad8b1 100644
--- a/meta/classes/update-rc.d.bbclass
+++ b/meta/classes/update-rc.d.bbclass
@@ -75,12 +75,15 @@  python populate_packages_updatercd () {
         postrm += d.getVar('updatercd_postrm', True)
         d.setVar('pkg_postrm_%s' % pkg, postrm)
 
-    pkgs = d.getVar('INITSCRIPT_PACKAGES', True)
-    if pkgs == None:
-        pkgs = d.getVar('UPDATERCPN', True)
-        packages = (d.getVar('PACKAGES', True) or "").split()
-        if not pkgs in packages and packages != []:
-            pkgs = packages[0]
-    for pkg in pkgs.split():
-        update_rcd_package(pkg)
+    # If the systemd class has also been inherited, then don't do anything as
+    # the systemd units will override anything created by update-rc.d.
+    if not d.getVar("SYSTEMD_BBCLASS_ENABLED", True):
+        pkgs = d.getVar('INITSCRIPT_PACKAGES', True)
+        if pkgs == None:
+            pkgs = d.getVar('UPDATERCPN', True)
+            packages = (d.getVar('PACKAGES', True) or "").split()
+            if not pkgs in packages and packages != []:
+                pkgs = packages[0]
+        for pkg in pkgs.split():
+            update_rcd_package(pkg)
 }