]> code.ossystems Code Review - openembedded-core.git/commitdiff
systemd: Remove init.d dir if systemd unit file is present and sysvinit not a distro...
authorMuhammad Shakeel <muhammad_shakeel@mentor.com>
Mon, 29 Jul 2013 08:09:51 +0000 (13:09 +0500)
committerSaul Wold <sgw@linux.intel.com>
Tue, 30 Jul 2013 14:25:39 +0000 (07:25 -0700)
If systemd is supported DISTRO_FEATURE and sysvinit is not and also if
systemd_unitdir contains anything then no need to keep init.d scripts
for sysvinit compatibility.

Signed-off-by: Muhammad Shakeel <muhammad_shakeel@mentor.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
meta/classes/systemd.bbclass

index 9763faae63887ae972f396be9fb61a643cd0f340..76f0e7da1f38ce74832b59cd337e102f4f1f054f 100644 (file)
@@ -170,3 +170,18 @@ python rm_systemd_unitdir (){
             shutil.rmtree(systemd_unitdir)
 }
 do_install[postfuncs] += "rm_systemd_unitdir "
+
+python rm_sysvinit_initddir (){
+    import shutil
+    sysv_initddir = oe.path.join(d.getVar("D", True), (d.getVar('INIT_D_DIR', True) or "/etc/init.d"))
+
+    if ("systemd" in d.getVar("DISTRO_FEATURES", True).split() and
+        "sysvinit" not in d.getVar("DISTRO_FEATURES", True).split() and
+        os.path.exists(sysv_initddir)):
+        systemd_unitdir = oe.path.join(d.getVar("D", True), d.getVar('systemd_unitdir', True), "system")
+
+        # If systemd_unitdir contains anything, delete sysv_initddir
+        if (os.path.exists(systemd_unitdir) and os.listdir(systemd_unitdir)):
+            shutil.rmtree(sysv_initddir)
+}
+do_install[postfuncs] += "rm_sysvinit_initddir "