2011-06-17 01:46:40

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH v2] build: Add support for systemd service configuration

---
.gitignore | 1 +
Makefile.am | 8 +++++++-
configure.ac | 11 ++++++++++-
src/bluetooth.service.in | 12 ++++++++++++
4 files changed, 30 insertions(+), 2 deletions(-)
create mode 100644 src/bluetooth.service.in

diff --git a/.gitignore b/.gitignore
index 2ef7cb5..2ce99e7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -93,3 +93,4 @@ doc/version.xml
doc/xml
doc/html
src/bluetoothd.8
+src/bluetooth.service
diff --git a/Makefile.am b/Makefile.am
index 4659c80..85f3d5f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -35,6 +35,12 @@ conf_DATA =
statedir = $(localstatedir)/lib/bluetooth

state_DATA =
+
+if SYSTEMD
+systemdunitdir = @SYSTEMD_UNITDIR@
+
+systemdunit_DATA = src/bluetooth.service
+endif
endif

plugindir = $(libdir)/bluetooth/plugins
@@ -385,7 +391,7 @@ pkgconfigdir = $(libdir)/pkgconfig

pkgconfig_DATA = bluez.pc

-DISTCHECK_CONFIGURE_FLAGS = --disable-udevrules
+DISTCHECK_CONFIGURE_FLAGS = --disable-udevrules --with-systemdunitdir=

DISTCLEANFILES = $(pkgconfig_DATA)

diff --git a/configure.ac b/configure.ac
index 2ce4acf..138a38f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,5 +57,14 @@ if (test "${enable_capng}" = "yes"); then
AC_DEFINE(HAVE_CAPNG, 1, [Define to 1 if you have capabilities library.])
fi

+AC_ARG_WITH([systemdunitdir], AC_HELP_STRING([--with-systemdunitdir=DIR],
+ [path to systemd system service directory]), [path_systemdunit=${withval}],
+ [path_systemdunit="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"])
+if (test -n "${path_systemdunit}"); then
+ SYSTEMD_UNITDIR="${path_systemdunit}"
+ AC_SUBST(SYSTEMD_UNITDIR)
+fi
+AM_CONDITIONAL(SYSTEMD, test -n "${path_systemdunit}")
+
AC_OUTPUT(Makefile scripts/bluetooth.rules doc/version.xml
- src/bluetoothd.8 bluez.pc)
+ src/bluetoothd.8 src/bluetooth.service bluez.pc)
diff --git a/src/bluetooth.service.in b/src/bluetooth.service.in
new file mode 100644
index 0000000..02b6707
--- /dev/null
+++ b/src/bluetooth.service.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=Bluetooth service
+After=syslog.target
+
+[Service]
+Type=dbus
+BusName=org.bluez
+ExecStart=@prefix@/sbin/bluetoothd -n
+StandardOutput=syslog
+
+[Install]
+WantedBy=bluetooth.target
--
1.7.5.2



2011-06-30 19:44:04

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH v2] build: Add support for systemd service configuration

Hi Lucas,

> >> -DISTCHECK_CONFIGURE_FLAGS = --disable-udevrules
> >> +DISTCHECK_CONFIGURE_FLAGS = --disable-udevrules --with-systemdunitdir=
> >
> > can we please do it the same way I did it for oFono and ConnMan. I have
> > no idea what you are doing here. If --with-systemdunitdir is not given,
> > then it should be disabled and it should be that by default.
>
> This is indeed the same code as in oFono and ConnMann. If
> `--with-systemdunitdir' is not given it defaults to checking
> `pkg-config --variable systemdsystemunitdir systemd'. So in case we
> call `make distcheck' and systemd is installed, this will fail, as it
> will in oFono and ConnMann. The difference is that there we have
> `DISTCHECK_CONFIGURE_FLAGS = --disable-datafiles'. I may do the same
> and let `DISTCHECK_CONFIGURE_FLAGS = --disable-configfiles'. What do
> you think? Then I think I could remove the `--disable-udevrules' as
> well.

lets do the same as we have done in ConnMan and oFono.

We might just rename --disable-configfiles into --disable-datafiles to
bring all three projects in sync here.

The --disable-udevrules has to stay since otherwise we would install
into a system directory. However we can put that under the DATAFILES
conditional.

Care to send a new set of patches?

Regards

Marcel



2011-06-22 11:13:30

by Bastien Nocera

[permalink] [raw]
Subject: Re: [PATCH v2] build: Add support for systemd service configuration

On Thu, 2011-06-16 at 22:46 -0300, Lucas De Marchi wrote:
> ---
> .gitignore | 1 +
> Makefile.am | 8 +++++++-
> configure.ac | 11 ++++++++++-
> src/bluetooth.service.in | 12 ++++++++++++
> 4 files changed, 30 insertions(+), 2 deletions(-)
> create mode 100644 src/bluetooth.service.in

It seems to be pretty much the same as Lennart's patch which I posted
last year:
http://thread.gmane.org/gmane.linux.bluez.kernel/8645

Any reasons why you cooked up your own? What are the differences?


2011-06-17 11:51:41

by Lucas De Marchi

[permalink] [raw]
Subject: Re: [PATCH v2] build: Add support for systemd service configuration

Hi Marcel,

On Fri, Jun 17, 2011 at 1:15 AM, Marcel Holtmann <[email protected]> wrote:
>> -DISTCHECK_CONFIGURE_FLAGS = --disable-udevrules
>> +DISTCHECK_CONFIGURE_FLAGS = --disable-udevrules --with-systemdunitdir=
>
> can we please do it the same way I did it for oFono and ConnMan. I have
> no idea what you are doing here. If --with-systemdunitdir is not given,
> then it should be disabled and it should be that by default.

This is indeed the same code as in oFono and ConnMann. If
`--with-systemdunitdir' is not given it defaults to checking
`pkg-config --variable systemdsystemunitdir systemd'. So in case we
call `make distcheck' and systemd is installed, this will fail, as it
will in oFono and ConnMann. The difference is that there we have
`DISTCHECK_CONFIGURE_FLAGS = --disable-datafiles'. I may do the same
and let `DISTCHECK_CONFIGURE_FLAGS = --disable-configfiles'. What do
you think? Then I think I could remove the `--disable-udevrules' as
well.


Regards
Lucas De Marchi

2011-06-17 04:15:08

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH v2] build: Add support for systemd service configuration

Hi Lucas,

> .gitignore | 1 +
> Makefile.am | 8 +++++++-
> configure.ac | 11 ++++++++++-
> src/bluetooth.service.in | 12 ++++++++++++
> 4 files changed, 30 insertions(+), 2 deletions(-)
> create mode 100644 src/bluetooth.service.in
>
> diff --git a/.gitignore b/.gitignore
> index 2ef7cb5..2ce99e7 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -93,3 +93,4 @@ doc/version.xml
> doc/xml
> doc/html
> src/bluetoothd.8
> +src/bluetooth.service
> diff --git a/Makefile.am b/Makefile.am
> index 4659c80..85f3d5f 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -35,6 +35,12 @@ conf_DATA =
> statedir = $(localstatedir)/lib/bluetooth
>
> state_DATA =
> +
> +if SYSTEMD
> +systemdunitdir = @SYSTEMD_UNITDIR@
> +
> +systemdunit_DATA = src/bluetooth.service
> +endif
> endif
>
> plugindir = $(libdir)/bluetooth/plugins
> @@ -385,7 +391,7 @@ pkgconfigdir = $(libdir)/pkgconfig
>
> pkgconfig_DATA = bluez.pc
>
> -DISTCHECK_CONFIGURE_FLAGS = --disable-udevrules
> +DISTCHECK_CONFIGURE_FLAGS = --disable-udevrules --with-systemdunitdir=

can we please do it the same way I did it for oFono and ConnMan. I have
no idea what you are doing here. If --with-systemdunitdir is not given,
then it should be disabled and it should be that by default.

Regards

Marcel



2011-07-02 02:38:38

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH v2] build: Add support for systemd service configuration

Hi Lucas,

> >> >> -DISTCHECK_CONFIGURE_FLAGS = --disable-udevrules
> >> >> +DISTCHECK_CONFIGURE_FLAGS = --disable-udevrules --with-systemdunitdir=
> >> >
> >> > can we please do it the same way I did it for oFono and ConnMan. I have
> >> > no idea what you are doing here. If --with-systemdunitdir is not given,
> >> > then it should be disabled and it should be that by default.
> >>
> >> This is indeed the same code as in oFono and ConnMann. If
> >> `--with-systemdunitdir' is not given it defaults to checking
> >> `pkg-config --variable systemdsystemunitdir systemd'. So in case we
> >> call `make distcheck' and systemd is installed, this will fail, as it
> >> will in oFono and ConnMann. The difference is that there we have
> >> `DISTCHECK_CONFIGURE_FLAGS = --disable-datafiles'. I may do the same
> >> and let `DISTCHECK_CONFIGURE_FLAGS = --disable-configfiles'. What do
> >> you think? Then I think I could remove the `--disable-udevrules' as
> >> well.
> >
> > lets do the same as we have done in ConnMan and oFono.
> >
> > We might just rename --disable-configfiles into --disable-datafiles to
> > bring all three projects in sync here.
> >
> > The --disable-udevrules has to stay since otherwise we would install
> > into a system directory. However we can put that under the DATAFILES
> > conditional.
> >
> > Care to send a new set of patches?
>
> Ok.
>
> Bastien, are you going to do it or I can do it myself?

just send me an updated patch. I wanna get this merged upstream. I was
under the impression this got already fixed, but I was wrong.

Regards

Marcel



2011-07-01 22:45:01

by Lucas De Marchi

[permalink] [raw]
Subject: Re: [PATCH v2] build: Add support for systemd service configuration

Hi Marcel,

On Thu, Jun 30, 2011 at 4:44 PM, Marcel Holtmann <[email protected]> wrote:
> Hi Lucas,
>
>> >> -DISTCHECK_CONFIGURE_FLAGS = --disable-udevrules
>> >> +DISTCHECK_CONFIGURE_FLAGS = --disable-udevrules --with-systemdunitdir=
>> >
>> > can we please do it the same way I did it for oFono and ConnMan. I have
>> > no idea what you are doing here. If --with-systemdunitdir is not given,
>> > then it should be disabled and it should be that by default.
>>
>> This is indeed the same code as in oFono and ConnMann. If
>> `--with-systemdunitdir' is not given it defaults to checking
>> `pkg-config --variable systemdsystemunitdir systemd'. So in case we
>> call `make distcheck' and systemd is installed, this will fail, as it
>> will in oFono and ConnMann. The difference is that there we have
>> `DISTCHECK_CONFIGURE_FLAGS = --disable-datafiles'. I may do the same
>> and let `DISTCHECK_CONFIGURE_FLAGS = --disable-configfiles'. What do
>> you think? Then I think I could remove the `--disable-udevrules' as
>> well.
>
> lets do the same as we have done in ConnMan and oFono.
>
> We might just rename --disable-configfiles into --disable-datafiles to
> bring all three projects in sync here.
>
> The --disable-udevrules has to stay since otherwise we would install
> into a system directory. However we can put that under the DATAFILES
> conditional.
>
> Care to send a new set of patches?

Ok.

Bastien, are you going to do it or I can do it myself?

Lucas De Marchi

2011-07-01 22:43:39

by Lucas De Marchi

[permalink] [raw]
Subject: Re: [PATCH v2] build: Add support for systemd service configuration

Hi Bastien,

On Wed, Jun 22, 2011 at 8:13 AM, Bastien Nocera <[email protected]> wrote:
> On Thu, 2011-06-16 at 22:46 -0300, Lucas De Marchi wrote:
>> ---
>> ?.gitignore ? ? ? ? ? ? ? | ? ?1 +
>> ?Makefile.am ? ? ? ? ? ? ?| ? ?8 +++++++-
>> ?configure.ac ? ? ? ? ? ? | ? 11 ++++++++++-
>> ?src/bluetooth.service.in | ? 12 ++++++++++++
>> ?4 files changed, 30 insertions(+), 2 deletions(-)
>> ?create mode 100644 src/bluetooth.service.in
>
> It seems to be pretty much the same as Lennart's patch which I posted
> last year:
> http://thread.gmane.org/gmane.linux.bluez.kernel/8645
>
> Any reasons why you cooked up your own? What are the differences?

I didn't see that patch before sending these ones.

But it's a bit different from what we have in ConnMan and oFono. I've
based mine on these other projects since I already participated on
them and I'm starting on BlueZ now.

regards,
Lucas De Marchi