Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] systemd: Remove init.d dir if systemd unit file is present and sysvinit not a distro feature
@ 2013-07-23 10:03 Shakeel, Muhammad
  2013-07-23 10:46 ` Enrico Scholz
  2013-07-25 11:08 ` ChenQi
  0 siblings, 2 replies; 8+ messages in thread
From: Shakeel, Muhammad @ 2013-07-23 10:03 UTC (permalink / raw)
  To: openembedded-core

From: Muhammad Shakeel <muhammad_shakeel@mentor.com>

If systemd is supported DISTRO_FEATURE and sysvinit is not and also if
systemd_unitdir contains a service file(s) then no need to keep init.d scripts
for sysvinit compatibility.

Signed-off-by: Muhammad Shakeel <muhammad_shakeel@mentor.com>
---
 meta/classes/systemd.bbclass |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/meta/classes/systemd.bbclass b/meta/classes/systemd.bbclass
index 9763faa..55f378e 100644
--- a/meta/classes/systemd.bbclass
+++ b/meta/classes/systemd.bbclass
@@ -170,3 +170,22 @@ python rm_systemd_unitdir (){
             shutil.rmtree(systemd_unitdir)
 }
 do_install[postfuncs] += "rm_systemd_unitdir "
+
+python rm_sysvinit_initddir (){
+    import shutil
+    if ("systemd" in d.getVar("DISTRO_FEATURES", True).split() and
+        "sysvinit" not in d.getVar("DISTRO_FEATURES", True).split()):
+        service_file_exists = False
+        systemd_unitdir = oe.path.join(d.getVar("D", True), d.getVar('systemd_unitdir', True), "system")
+        if os.path.exists(systemd_unitdir):
+            for filename in os.listdir(systemd_unitdir):
+                if filename.endswith(".service"):
+                    service_file_exists = True
+                    break
+
+        if service_file_exists:
+            sysv_initddir = oe.path.join(d.getVar("D", True), d.getVar('INIT_D_DIR', True))
+            if os.path.exists(sysv_initddir):
+                shutil.rmtree(sysv_initddir)
+}
+do_install[postfuncs] += "rm_sysvinit_initddir "
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-07-25 11:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-23 10:03 [PATCH] systemd: Remove init.d dir if systemd unit file is present and sysvinit not a distro feature Shakeel, Muhammad
2013-07-23 10:46 ` Enrico Scholz
2013-07-24 13:22   ` Muhammad Shakeel
2013-07-24 13:55     ` Paul Eggleton
2013-07-25  9:56       ` Burton, Ross
2013-07-25 10:10         ` Muhammad Shakeel
2013-07-25 11:08 ` ChenQi
2013-07-25 11:19   ` Muhammad Shakeel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox