Skip to contentSkip to conversation

restorecond: Rename restorecond-user.service to restorecond_user.service

PATCH In review Petr Lautrbach 2 participants 4 messages Apr 30, 2020 – May 4, 2020 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 restorecond: Rename restorecond-user.service to restorecond_user.service

Make user restorecond systemd service consistent with restorecond_user.conf file used by restorecond -u

---
 restorecond/Makefile                                            | 2 +-
 restorecond/org.selinux.Restorecond.service                     | 2 +-
 .../{restorecond-user.service => restorecond_user.service}      | 0
 3 files changed, 2 insertions(+), 2 deletions(-)
 rename restorecond/{restorecond-user.service => restorecond_user.service} (100%)
restorecond/Makefile +1 -1
index 501f89dfca57..4de9642b0f6a 100644
@@ -51,7 +51,7 @@ install: all
 	-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/
+	install -m 644 restorecond_user.service $(DESTDIR)$(SYSTEMDDIR)/user/
 relabel: install
 	/sbin/restorecon $(DESTDIR)$(SBINDIR)/restorecond 
 
restorecond/org.selinux.Restorecond.service +1 -1
index 55989a9cbbd0..45aeb7aac806 100644
@@ -1,4 +1,4 @@
 [D-BUS Service]
 Name=org.selinux.Restorecond
 Exec=/usr/sbin/restorecond -u
-SystemdService=restorecond-user.service
+SystemdService=restorecond_user.service
restorecond/restorecond_user.service renamed from restorecond/restorecond-user.service +0 -0
similarity index 100%
rename from restorecond/restorecond-user.service
rename to restorecond/restorecond_user.service
Signature · 1 line
2.26.2
#1 lore raw

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

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.

---
 restorecond/Makefile | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
restorecond/Makefile +6 -5
index 4de9642b0f6a..8e9a5ef1cfa1 100644
@@ -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 
 
Signature · 1 line
2.26.2
Acked-by on v1 2/2
#2 lore raw

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

Quoted 7 lines · Petr Lautrbach

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.

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:

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

Quoted 36 lines
---
 restorecond/Makefile | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
restorecond/Makefile +6 -6
index 4de9642b0f6a..8e9a5ef1cfa1 100644
@@ -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

#3 lore raw

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

Quoted 14 lines · Nicolas Iooss
Quoted 7 lines · Petr Lautrbach

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.

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.

Quoted 7 lines

For both patches:

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

Thanks.

Both applied.

Quoted 38 lines
Quoted 37 lines
---
 restorecond/Makefile | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
restorecond/Makefile +6 -6
index 4de9642b0f6a..8e9a5ef1cfa1 100644
@@ -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

Signature · 2 lines
()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments