diff mbox series

[2/2] restorecond: Use pkg-config to get locations for systemd units

Message ID 20200430110835.138643-2-plautrba@redhat.com (mailing list archive)
State Accepted
Headers show
Series [1/2] restorecond: Rename restorecond-user.service to restorecond_user.service | expand

Commit Message

Petr Lautrbach April 30, 2020, 11:08 a.m. UTC
The user systemd service file could be installed in an other location than the
system ones. In debian for example, the system files are installed
/lib/systemd/system and the user ones in /usr/lib/systemd/user.

Suggested-by: Laurent Bigonville <bigon@bigon.be>
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
---
 restorecond/Makefile | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Nicolas Iooss May 1, 2020, 7:45 a.m. UTC | #1
On Thu, Apr 30, 2020 at 1:08 PM Petr Lautrbach <plautrba@redhat.com> wrote:
>
> The user systemd service file could be installed in an other location than the
> system ones. In debian for example, the system files are installed
> /lib/systemd/system and the user ones in /usr/lib/systemd/user.
>
> Suggested-by: Laurent Bigonville <bigon@bigon.be>
> Signed-off-by: Petr Lautrbach <plautrba@redhat.com>

I confirm the pkg-config commands work on Arch Linux too. By the way,
on Debian this patch makes building restorecond now require systemd to
be installed (because /usr/share/pkgconfig/systemd.pc is provided by
package "systemd"), but I guess this shouldn't be an issue.

For both patches:

Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org>

You can merge them when you want, or I will do so on Monday.
Thanks,
Nicolas

> ---
>  restorecond/Makefile | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/restorecond/Makefile b/restorecond/Makefile
> index 4de9642b0f6a..8e9a5ef1cfa1 100644
> --- a/restorecond/Makefile
> +++ b/restorecond/Makefile
> @@ -7,7 +7,8 @@ SBINDIR ?= $(PREFIX)/sbin
>  MANDIR = $(PREFIX)/share/man
>  AUTOSTARTDIR = /etc/xdg/autostart
>  DBUSSERVICEDIR = $(PREFIX)/share/dbus-1/services
> -SYSTEMDDIR ?= $(PREFIX)/lib/systemd
> +SYSTEMDSYSTEMUNITDIR ?= $(shell $(PKG_CONFIG) --variable=systemdsystemunitdir systemd)
> +SYSTEMDUSERUNITDIR ?= $(shell $(PKG_CONFIG) --variable=systemduserunitdir systemd)
>
>  autostart_DATA = sealertauto.desktop
>  INITDIR ?= /etc/rc.d/init.d
> @@ -48,10 +49,10 @@ install: all
>         install -m 644 restorecond.desktop $(DESTDIR)$(AUTOSTARTDIR)/restorecond.desktop
>         -mkdir -p $(DESTDIR)$(DBUSSERVICEDIR)
>         install -m 644 org.selinux.Restorecond.service  $(DESTDIR)$(DBUSSERVICEDIR)/org.selinux.Restorecond.service
> -       -mkdir -p $(DESTDIR)$(SYSTEMDDIR)/system
> -       install -m 644 restorecond.service $(DESTDIR)$(SYSTEMDDIR)/system/
> -       -mkdir -p $(DESTDIR)$(SYSTEMDDIR)/user
> -       install -m 644 restorecond_user.service $(DESTDIR)$(SYSTEMDDIR)/user/
> +       -mkdir -p $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
> +       install -m 644 restorecond.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
> +       -mkdir -p $(DESTDIR)$(SYSTEMDUSERUNITDIR)
> +       install -m 644 restorecond_user.service $(DESTDIR)$(SYSTEMDUSERUNITDIR)
>  relabel: install
>         /sbin/restorecon $(DESTDIR)$(SBINDIR)/restorecond
>
> --
> 2.26.2
>
Petr Lautrbach May 4, 2020, 8:46 a.m. UTC | #2
On Fri, May 01, 2020 at 09:45:03AM +0200, Nicolas Iooss wrote:
> On Thu, Apr 30, 2020 at 1:08 PM Petr Lautrbach <plautrba@redhat.com> wrote:
> >
> > The user systemd service file could be installed in an other location than the
> > system ones. In debian for example, the system files are installed
> > /lib/systemd/system and the user ones in /usr/lib/systemd/user.
> >
> > Suggested-by: Laurent Bigonville <bigon@bigon.be>
> > Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
> 
> I confirm the pkg-config commands work on Arch Linux too. By the way,
> on Debian this patch makes building restorecond now require systemd to
> be installed (because /usr/share/pkgconfig/systemd.pc is provided by
> package "systemd"), but I guess this shouldn't be an issue.
> 
> For both patches:
> 
> Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org>
> 
> You can merge them when you want, or I will do so on Monday.
> Thanks,
> Nicolas

Thanks.

Both applied. 


> 
> > ---
> >  restorecond/Makefile | 11 ++++++-----
> >  1 file changed, 6 insertions(+), 5 deletions(-)
> >
> > diff --git a/restorecond/Makefile b/restorecond/Makefile
> > index 4de9642b0f6a..8e9a5ef1cfa1 100644
> > --- a/restorecond/Makefile
> > +++ b/restorecond/Makefile
> > @@ -7,7 +7,8 @@ SBINDIR ?= $(PREFIX)/sbin
> >  MANDIR = $(PREFIX)/share/man
> >  AUTOSTARTDIR = /etc/xdg/autostart
> >  DBUSSERVICEDIR = $(PREFIX)/share/dbus-1/services
> > -SYSTEMDDIR ?= $(PREFIX)/lib/systemd
> > +SYSTEMDSYSTEMUNITDIR ?= $(shell $(PKG_CONFIG) --variable=systemdsystemunitdir systemd)
> > +SYSTEMDUSERUNITDIR ?= $(shell $(PKG_CONFIG) --variable=systemduserunitdir systemd)
> >
> >  autostart_DATA = sealertauto.desktop
> >  INITDIR ?= /etc/rc.d/init.d
> > @@ -48,10 +49,10 @@ install: all
> >         install -m 644 restorecond.desktop $(DESTDIR)$(AUTOSTARTDIR)/restorecond.desktop
> >         -mkdir -p $(DESTDIR)$(DBUSSERVICEDIR)
> >         install -m 644 org.selinux.Restorecond.service  $(DESTDIR)$(DBUSSERVICEDIR)/org.selinux.Restorecond.service
> > -       -mkdir -p $(DESTDIR)$(SYSTEMDDIR)/system
> > -       install -m 644 restorecond.service $(DESTDIR)$(SYSTEMDDIR)/system/
> > -       -mkdir -p $(DESTDIR)$(SYSTEMDDIR)/user
> > -       install -m 644 restorecond_user.service $(DESTDIR)$(SYSTEMDDIR)/user/
> > +       -mkdir -p $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
> > +       install -m 644 restorecond.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
> > +       -mkdir -p $(DESTDIR)$(SYSTEMDUSERUNITDIR)
> > +       install -m 644 restorecond_user.service $(DESTDIR)$(SYSTEMDUSERUNITDIR)
> >  relabel: install
> >         /sbin/restorecon $(DESTDIR)$(SBINDIR)/restorecond
> >
> > --
> > 2.26.2
> >
>
diff mbox series

Patch

diff --git a/restorecond/Makefile b/restorecond/Makefile
index 4de9642b0f6a..8e9a5ef1cfa1 100644
--- a/restorecond/Makefile
+++ b/restorecond/Makefile
@@ -7,7 +7,8 @@  SBINDIR ?= $(PREFIX)/sbin
 MANDIR = $(PREFIX)/share/man
 AUTOSTARTDIR = /etc/xdg/autostart
 DBUSSERVICEDIR = $(PREFIX)/share/dbus-1/services
-SYSTEMDDIR ?= $(PREFIX)/lib/systemd
+SYSTEMDSYSTEMUNITDIR ?= $(shell $(PKG_CONFIG) --variable=systemdsystemunitdir systemd)
+SYSTEMDUSERUNITDIR ?= $(shell $(PKG_CONFIG) --variable=systemduserunitdir systemd)
 
 autostart_DATA = sealertauto.desktop
 INITDIR ?= /etc/rc.d/init.d
@@ -48,10 +49,10 @@  install: all
 	install -m 644 restorecond.desktop $(DESTDIR)$(AUTOSTARTDIR)/restorecond.desktop
 	-mkdir -p $(DESTDIR)$(DBUSSERVICEDIR)
 	install -m 644 org.selinux.Restorecond.service  $(DESTDIR)$(DBUSSERVICEDIR)/org.selinux.Restorecond.service
-	-mkdir -p $(DESTDIR)$(SYSTEMDDIR)/system
-	install -m 644 restorecond.service $(DESTDIR)$(SYSTEMDDIR)/system/
-	-mkdir -p $(DESTDIR)$(SYSTEMDDIR)/user
-	install -m 644 restorecond_user.service $(DESTDIR)$(SYSTEMDDIR)/user/
+	-mkdir -p $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
+	install -m 644 restorecond.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
+	-mkdir -p $(DESTDIR)$(SYSTEMDUSERUNITDIR)
+	install -m 644 restorecond_user.service $(DESTDIR)$(SYSTEMDUSERUNITDIR)
 relabel: install
 	/sbin/restorecon $(DESTDIR)$(SBINDIR)/restorecond