public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH] systemd.bbclass: Introduce do_install_append and use systemd unitdir
@ 2013-02-12 17:42 Khem Raj
  2013-02-12 21:05 ` Burton, Ross
  2013-02-12 21:24 ` Richard Purdie
  0 siblings, 2 replies; 7+ messages in thread
From: Khem Raj @ 2013-02-12 17:42 UTC (permalink / raw)
  To: openembedded-core

systemd always uses /lib and /usr/lib to store unit files
so using libdir and base_libdir is incorrect. It will work
where libdir is usr/lib and base_libdir is /lib but wont work
when say its /lib64

Additionally introduce the install append from meta-oe
lot of recipe appends in meta-systemd depend on that

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/classes/systemd.bbclass |   21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/meta/classes/systemd.bbclass b/meta/classes/systemd.bbclass
index e0ea65c..32cc5c2 100644
--- a/meta/classes/systemd.bbclass
+++ b/meta/classes/systemd.bbclass
@@ -115,11 +115,9 @@ def systemd_populate_packages(d):
 
     # Check service-files and call systemd_add_files_and_parse for each entry
     def systemd_check_services():
-        base_libdir = d.getVar('base_libdir', True)
-        searchpaths = [oe.path.join(d.getVar("sysconfdir", True), "systemd", "system"),]
-        searchpaths.append(oe.path.join(d.getVar("base_libdir", True), "systemd", "system"))
-        searchpaths.append(oe.path.join(d.getVar("libdir", True), "systemd", "system"))
-        searchpaths.append(oe.path.join(d.getVar("libdir", True), "systemd", "user"))
+        searchpaths = '/etc/systemd/system/' + ' '
+        searchpaths += '/lib/systemd/system/' + ' '
+        searchpaths += '/usr/lib/systemd/system/' + ' '
         systemd_packages = d.getVar('SYSTEMD_PACKAGES', True)
         has_exactly_one_service = len(systemd_packages.split()) == 1
         if has_exactly_one_service:
@@ -133,7 +131,7 @@ def systemd_populate_packages(d):
         for pkg_systemd in systemd_packages.split():
             for service in get_package_var(d, 'SYSTEMD_SERVICE', pkg_systemd).split():
                 path_found = ''
-                for path in searchpaths:
+                for path in searchpaths.split():
                     if os.path.exists(oe.path.join(d.getVar("D", True), path, service)):
                         path_found = path
                         break
@@ -156,3 +154,14 @@ python populate_packages_prepend () {
     if oe.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d):
         systemd_populate_packages (d)
 }
+# automatically install all *.service and *.socket supplied in recipe's SRC_URI
+do_install_append() {
+	for service in `find ${WORKDIR} -maxdepth 1 -name '*.service' -o -name '*.socket'` ; do
+	# ensure installing systemd-files only (e.g not avahi *.service)
+		if grep -q '\[Unit\]' $service ; then
+			install -d ${D}${systemd_unitdir}/system
+			install -m 644 $service ${D}${systemd_unitdir}/system
+		fi
+	done
+}
+
-- 
1.7.9.5




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

end of thread, other threads:[~2013-02-14  2:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-12 17:42 [PATCH] systemd.bbclass: Introduce do_install_append and use systemd unitdir Khem Raj
2013-02-12 21:05 ` Burton, Ross
2013-02-12 21:24 ` Richard Purdie
2013-02-12 23:55   ` Andreas Müller
2013-02-13  0:14     ` Richard Purdie
2013-02-13 17:52     ` Phil Blundell
2013-02-14  2:23       ` Khem Raj

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