diff mbox series

[1/3] package/systemd: add option to enable SysV and utmp compatibility

Message ID 20200710234150.185609-1-nolange79@gmail.com
State Superseded
Headers show
Series [1/3] package/systemd: add option to enable SysV and utmp compatibility | expand

Commit Message

Norbert Lange July 10, 2020, 11:41 p.m. UTC
The option BR2_PACKAGE_SYSTEMD_SYSV enables compatibility with SysV services-

BR2_PACKAGE_SYSTEMD_UTMP adds support for the utmp Database,
which is only used by tools like 'who' and 'last' nowadays AFAIK.

Signed-off-by: Norbert Lange <nolange79@gmail.com>
---
 package/systemd/Config.in  | 12 ++++++++++++
 package/systemd/systemd.mk | 12 ++++++++++++
 2 files changed, 24 insertions(+)

Comments

Thomas Petazzoni July 11, 2020, 10:56 a.m. UTC | #1
On Sat, 11 Jul 2020 01:41:47 +0200
Norbert Lange <nolange79@gmail.com> wrote:

> diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
> index 05c1d1ff9a..05d8cb4934 100644
> --- a/package/systemd/systemd.mk
> +++ b/package/systemd/systemd.mk
> @@ -199,6 +199,18 @@ else
>  SYSTEMD_CONF_OPTS += -Dpcre2=false
>  endif
>  
> +ifeq ($(BR2_PACKAGE_SYSTEMD_SYSV),y)
> +SYSTEMD_CONF_OPTS += -Dsysvinit-path=/etc/init.d -Dsysvrcnd-path=/etc/rc.d

We don't have any /etc/rc.d directory in Buildroot, and when systemd is
selected as the init system, we don't install init scripts in
/etc/init.d. So I'm wondering what is the use case for this option ?

Best regards,

Thomas
Norbert Lange July 11, 2020, 11:25 a.m. UTC | #2
Thomas Petazzoni <thomas.petazzoni@bootlin.com> schrieb am Sa., 11. Juli
2020, 12:56:

> On Sat, 11 Jul 2020 01:41:47 +0200
> Norbert Lange <nolange79@gmail.com> wrote:
>
> > diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
> > index 05c1d1ff9a..05d8cb4934 100644
> > --- a/package/systemd/systemd.mk
> > +++ b/package/systemd/systemd.mk
> > @@ -199,6 +199,18 @@ else
> >  SYSTEMD_CONF_OPTS += -Dpcre2=false
> >  endif
> >
> > +ifeq ($(BR2_PACKAGE_SYSTEMD_SYSV),y)
> > +SYSTEMD_CONF_OPTS += -Dsysvinit-path=/etc/init.d
> -Dsysvrcnd-path=/etc/rc.d
>
> We don't have any /etc/rc.d directory in Buildroot, and when systemd is
> selected as the init system, we don't install init scripts in
> /etc/init.d. So I'm wondering what is the use case for this option ?
>

Removing *support for unit scripts*. those scripts, as you said, don't
exist.
That support comes in form of several services to parse and convert those
script, some code and daemon to allow systemd to communicate with some sysv
tools (initctl, runlevels et all).

Norbert


> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
Norbert Lange July 11, 2020, 11:27 a.m. UTC | #3
Norbert Lange <nolange79@gmail.com> schrieb am Sa., 11. Juli 2020, 13:25:

>
>
>
> Thomas Petazzoni <thomas.petazzoni@bootlin.com> schrieb am Sa., 11. Juli
> 2020, 12:56:
>
>> On Sat, 11 Jul 2020 01:41:47 +0200
>> Norbert Lange <nolange79@gmail.com> wrote:
>>
>> > diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
>> > index 05c1d1ff9a..05d8cb4934 100644
>> > --- a/package/systemd/systemd.mk
>> > +++ b/package/systemd/systemd.mk
>> > @@ -199,6 +199,18 @@ else
>> >  SYSTEMD_CONF_OPTS += -Dpcre2=false
>> >  endif
>> >
>> > +ifeq ($(BR2_PACKAGE_SYSTEMD_SYSV),y)
>> > +SYSTEMD_CONF_OPTS += -Dsysvinit-path=/etc/init.d
>> -Dsysvrcnd-path=/etc/rc.d
>>
>> We don't have any /etc/rc.d directory in Buildroot, and when systemd is
>> selected as the init system, we don't install init scripts in
>> /etc/init.d. So I'm wondering what is the use case for this option ?
>>
>
> Removing *support for unit scripts*. those scripts, as you said, don't
> exist.
> That support comes in form of several services to parse and convert those
> script, some code and daemon to allow systemd to communicate with some sysv
> tools (initctl, runlevels et all).
>
> Norbert
>
>
>> Best regards,
>>
>> Thomas
>> --
>> Thomas Petazzoni, CTO, Bootlin
>> Embedded Linux and Kernel engineering
>> https://bootlin.com
>
>
Hmm, maybe I misunderstood. There is no Boolean to enable this support, but
it is disabled when those paths are empty.

I enable these paths by setting the defaults.
If you want to argue, that we should just disabled the compatibility
without option, I won't object

Norbert
Thomas Petazzoni July 11, 2020, 1:14 p.m. UTC | #4
On Sat, 11 Jul 2020 13:25:08 +0200
Norbert Lange <nolange79@gmail.com> wrote:

> > > +ifeq ($(BR2_PACKAGE_SYSTEMD_SYSV),y)
> > > +SYSTEMD_CONF_OPTS += -Dsysvinit-path=/etc/init.d  
> > -Dsysvrcnd-path=/etc/rc.d
> >
> > We don't have any /etc/rc.d directory in Buildroot, and when systemd is
> > selected as the init system, we don't install init scripts in
> > /etc/init.d. So I'm wondering what is the use case for this option ?
> >  
> 
> Removing *support for unit scripts*. those scripts, as you said, don't
> exist.

Yes, but your patch also keeps support for init scripts enabled when
BR2_PACKAGE_SYSTEMD_SYSV=y, and I don't understand what is the use case.

When systemd is enabled, there will be nothing in /etc/init.d, because
Buildroot only executes the <pkg>_INIT_SYSV commands (that install init
scripts) when the init system is Busybox or SysVinit.

Or do you want to support use cases where some users may install their
own init scripts in /etc/init.d, but are using systemd ?

Thomas
Norbert Lange July 12, 2020, 10:41 p.m. UTC | #5
Am Sa., 11. Juli 2020 um 15:14 Uhr schrieb Thomas Petazzoni
<thomas.petazzoni@bootlin.com>:
>
> On Sat, 11 Jul 2020 13:25:08 +0200
> Norbert Lange <nolange79@gmail.com> wrote:
>
> > > > +ifeq ($(BR2_PACKAGE_SYSTEMD_SYSV),y)
> > > > +SYSTEMD_CONF_OPTS += -Dsysvinit-path=/etc/init.d
> > > -Dsysvrcnd-path=/etc/rc.d
> > >
> > > We don't have any /etc/rc.d directory in Buildroot, and when systemd is
> > > selected as the init system, we don't install init scripts in
> > > /etc/init.d. So I'm wondering what is the use case for this option ?
> > >
> >
> > Removing *support for unit scripts*. those scripts, as you said, don't
> > exist.
>
> Yes, but your patch also keeps support for init scripts enabled when
> BR2_PACKAGE_SYSTEMD_SYSV=y, and I don't understand what is the use case.
>
> When systemd is enabled, there will be nothing in /etc/init.d, because
> Buildroot only executes the <pkg>_INIT_SYSV commands (that install init
> scripts) when the init system is Busybox or SysVinit.
>
> Or do you want to support use cases where some users may install their
> own init scripts in /etc/init.d, but are using systemd ?

I accounted for such usecases, because I thought that's expected with buildroot.
No trouble removing the option from my side.
This goes for utmp aswell (not sure Id want logged in users exposed in
a file amyway)

Norbert
diff mbox series

Patch

diff --git a/package/systemd/Config.in b/package/systemd/Config.in
index dd3b8c534d..5cc22b4b95 100644
--- a/package/systemd/Config.in
+++ b/package/systemd/Config.in
@@ -112,6 +112,18 @@  config BR2_PACKAGE_SYSTEMD_BOOT
 
 	  https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/
 
+config BR2_PACKAGE_SYSTEMD_SYSV
+	bool "Enable compatibility for sysvinit services"
+	help
+	  Enable buildtime options for compatibility with sysv
+	  services, and install tools and services needed.
+
+config BR2_PACKAGE_SYSTEMD_UTMP
+	bool "Enable compatibility for utmp"
+	help
+	  Enable buildtime options for compatibility with
+	  services depending on utmp.
+
 config BR2_PACKAGE_SYSTEMD_BOOT_EFI_ARCH
 	string
 	default "ia32"  if BR2_i386
diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
index 05c1d1ff9a..05d8cb4934 100644
--- a/package/systemd/systemd.mk
+++ b/package/systemd/systemd.mk
@@ -199,6 +199,18 @@  else
 SYSTEMD_CONF_OPTS += -Dpcre2=false
 endif
 
+ifeq ($(BR2_PACKAGE_SYSTEMD_SYSV),y)
+SYSTEMD_CONF_OPTS += -Dsysvinit-path=/etc/init.d -Dsysvrcnd-path=/etc/rc.d
+else
+SYSTEMD_CONF_OPTS += -Dsysvinit-path= -Dsysvrcnd-path=
+endif
+
+ifeq ($(BR2_PACKAGE_SYSTEMD_UTMP),y)
+SYSTEMD_CONF_OPTS += -Dutmp=true
+else
+SYSTEMD_CONF_OPTS += -Dutmp=false
+endif
+
 ifeq ($(BR2_PACKAGE_SYSTEMD_JOURNAL_GATEWAY),y)
 SYSTEMD_DEPENDENCIES += libmicrohttpd
 SYSTEMD_CONF_OPTS += -Dmicrohttpd=true