Patchwork [meta-oe,v2] 05/22] automatically install all *.service and *.socket supplied in recipe's SRC_URI

login
register
mail settings
Submitter Andreas Müller
Date Feb. 16, 2012, 2:02 a.m.
Message ID <1329357796-27398-6-git-send-email-schnitzeltony@googlemail.com>
Download mbox | patch
Permalink /patch/21293/
State Superseded, archived
Headers show

Comments

Andreas Müller - Feb. 16, 2012, 2:02 a.m.
Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
Acked-by: Otavio Salvador <otavio@ossystems.com.br>
---
 meta-oe/classes/systemd.bbclass |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
Martin Jansa - Feb. 17, 2012, 9:34 a.m.
On Thu, Feb 16, 2012 at 03:02:59AM +0100, Andreas Müller wrote:
> Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
> Acked-by: Otavio Salvador <otavio@ossystems.com.br>


After reading today's gentoo systemd news:
We have decided to move our systemd installation into /usr prefix.
After the upgrade, the main systemd executable will be installed
as /usr/bin/systemd and the unit files will be installed
to /usr/lib/systemd; however, systemd will still look for unit files
in the /lib location.

I think we should abstract
${base_libdir}/systemd
to some variable inside systemd.bbclass, so if we ever decide to move it
to /usr/lib too, then not only automatically installed *.service files
from SRC_URI are installalled to right directory.

Cheers,

> ---
>  meta-oe/classes/systemd.bbclass |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/meta-oe/classes/systemd.bbclass b/meta-oe/classes/systemd.bbclass
> index 0ea03ee..b2cf775 100644
> --- a/meta-oe/classes/systemd.bbclass
> +++ b/meta-oe/classes/systemd.bbclass
> @@ -78,6 +78,17 @@ python __anonymous() {
>      systemd_after_parse(d)
>  }
>  
> +# automatically install all *.service and *.socket supplied in recipe's SRC_URI
> +do_install_append() {
> +    install -d ${D}${base_libdir}/systemd/system
> +    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 -m 644 $service ${D}${base_libdir}/systemd/system
> +	fi
> +    done
> +}
> +
>  python populate_packages_prepend () {
>  	def systemd_generate_package_scripts(pkg):
>  		bb.debug(1, 'adding systemd calls to postinst/postrm for %s' % pkg)
> -- 
> 1.7.4.4
> 
> 
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
Andreas Müller - Feb. 17, 2012, 6:44 p.m.
On Fri, Feb 17, 2012 at 10:34 AM, Martin Jansa <martin.jansa@gmail.com> wrote:
> On Thu, Feb 16, 2012 at 03:02:59AM +0100, Andreas Müller wrote:
>> Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
>> Acked-by: Otavio Salvador <otavio@ossystems.com.br>
>
>
> After reading today's gentoo systemd news:
> We have decided to move our systemd installation into /usr prefix.
> After the upgrade, the main systemd executable will be installed
> as /usr/bin/systemd and the unit files will be installed
> to /usr/lib/systemd; however, systemd will still look for unit files
> in the /lib location.
>
> I think we should abstract
> ${base_libdir}/systemd
> to some variable inside systemd.bbclass, so if we ever decide to move it
> to /usr/lib too, then not only automatically installed *.service files
> from SRC_URI are installalled to right directory.
>
I would like to take this in for V3. To avoid further iterations:

* I the name 'systemd_unitdir' OK?
* Would it make sense to abstract "${base_libdir}/systemd/system" (too)

Andreas
Otavio Salvador - Feb. 17, 2012, 7:05 p.m.
On Fri, Feb 17, 2012 at 16:44, Andreas Müller
<schnitzeltony@googlemail.com>wrote:

> * I the name 'systemd_unitdir' OK?
> * Would it make sense to abstract "${base_libdir}/systemd/system" (too)


I think systemd_unitdir only is enough.
Martin Jansa - Feb. 17, 2012, 10:28 p.m.
On Fri, Feb 17, 2012 at 05:05:03PM -0200, Otavio Salvador wrote:
> On Fri, Feb 17, 2012 at 16:44, Andreas Müller
> <schnitzeltony@googlemail.com>wrote:
> 
> > * I the name 'systemd_unitdir' OK?
> > * Would it make sense to abstract "${base_libdir}/systemd/system" (too)
> 
> 
> I think systemd_unitdir only is enough.

agreed

Cheers,

Patch

diff --git a/meta-oe/classes/systemd.bbclass b/meta-oe/classes/systemd.bbclass
index 0ea03ee..b2cf775 100644
--- a/meta-oe/classes/systemd.bbclass
+++ b/meta-oe/classes/systemd.bbclass
@@ -78,6 +78,17 @@  python __anonymous() {
     systemd_after_parse(d)
 }
 
+# automatically install all *.service and *.socket supplied in recipe's SRC_URI
+do_install_append() {
+    install -d ${D}${base_libdir}/systemd/system
+    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 -m 644 $service ${D}${base_libdir}/systemd/system
+	fi
+    done
+}
+
 python populate_packages_prepend () {
 	def systemd_generate_package_scripts(pkg):
 		bb.debug(1, 'adding systemd calls to postinst/postrm for %s' % pkg)