summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorMuhammad Shakeel <muhammad_shakeel@mentor.com>2013-07-29 13:09:51 +0500
committerSaul Wold <sgw@linux.intel.com>2013-07-30 07:25:39 -0700
commit823c90ad344ca2205f3055e2dcae08c6616f29b7 (patch)
tree0637dc7a6007eb9eb391783767ba4269bbd7fd0d /meta/classes
parent3be0967f14a9865215debe7fae666bd92b4968a0 (diff)
downloadopenembedded-core-contrib-823c90ad344ca2205f3055e2dcae08c6616f29b7.tar.gz
systemd: Remove init.d dir if systemd unit file is present and sysvinit not a distro feature
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>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/systemd.bbclass15
1 files changed, 15 insertions, 0 deletions
diff --git a/meta/classes/systemd.bbclass b/meta/classes/systemd.bbclass
index 9763faae638..76f0e7da1f3 100644
--- a/meta/classes/systemd.bbclass
+++ b/meta/classes/systemd.bbclass
@@ -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 "