Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 1/1] systemd.class - Allow enabling of parameterised services
@ 2015-11-19 11:24 Bob Ham
  2015-12-03 11:04 ` Bob Ham
  0 siblings, 1 reply; 2+ messages in thread
From: Bob Ham @ 2015-11-19 11:24 UTC (permalink / raw)
  To: openembedded-core

Currently the systemd.class will check whether a service exists when
it is requested to enabled it.  However, its check does not take into
account that a service like 'foo@eth0.service' can be enabled from a
service named 'foo@.service'.  This patch alters the check function in
systemd.class to look for 'foo@.service' if the normal check fails.

Signed-off-by: Bob Ham <bob.ham@collabora.com>
---
 meta/classes/systemd.bbclass | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/meta/classes/systemd.bbclass b/meta/classes/systemd.bbclass
index 46e72c7..db7873f 100644
--- a/meta/classes/systemd.bbclass
+++ b/meta/classes/systemd.bbclass
@@ -59,6 +59,8 @@ systemd_populate_packages[vardepsexclude] += "OVERRIDES"
 
 
 python systemd_populate_packages() {
+    import re
+
     if not bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d):
         return
 
@@ -144,10 +146,22 @@ python systemd_populate_packages() {
         for pkg_systemd in systemd_packages.split():
             for service in get_package_var(d, 'SYSTEMD_SERVICE', pkg_systemd).split():
                 path_found = ''
+
+                # Deal with adding, for example, 'ifplugd@eth0.service' from
+                # 'ifplugd@.service'
+                base = None
+                if service.find('@') != -1:
+                    base = re.sub('@[^.]+.', '@.', service)
+
                 for path in searchpaths:
                     if os.path.exists(oe.path.join(d.getVar("D", True), path, service)):
                         path_found = path
                         break
+                    elif base is not None:
+                        if os.path.exists(oe.path.join(d.getVar("D", True), path, base)):
+                            path_found = path
+                            break
+
                 if path_found != '':
                     systemd_add_files_and_parse(pkg_systemd, path_found, service, keys)
                 else:
-- 
2.1.4



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

* Re: [PATCH 1/1] systemd.class - Allow enabling of parameterised services
  2015-11-19 11:24 [PATCH 1/1] systemd.class - Allow enabling of parameterised services Bob Ham
@ 2015-12-03 11:04 ` Bob Ham
  0 siblings, 0 replies; 2+ messages in thread
From: Bob Ham @ 2015-12-03 11:04 UTC (permalink / raw)
  To: openembedded-core

On Thu, 2015-11-19 at 11:24 +0000, Bob Ham wrote:
> CThis patch alters the check function
> in systemd.class to look for 'foo@.service' if the normal check
> fails.

*ping*

-- 
Bob Ham <bob.ham@collabora.com>
Software Engineer

>>>>>>>>
Open First 
Collabora is hiring!
Please check out our latest opportunities here:
http://bit.ly/Collabora-Careers
<<<<<<<<




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

end of thread, other threads:[~2015-12-03 11:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-19 11:24 [PATCH 1/1] systemd.class - Allow enabling of parameterised services Bob Ham
2015-12-03 11:04 ` Bob Ham

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