From 101d531f3b1feb6b1209f9ce169d1427dd6d3824 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Ravier?= Date: Thu, 25 Feb 2021 12:14:36 +0100 Subject: [PATCH] Install rpm-ostree sysusers config and countme units Install the systemd unit, timer and sysusers configuration for Count Me support. We do not enable or pull as a dependency those units by default as this is a decision that should be taken at the distribution level and needs support on the infrastructure side. To enable those units in a disctribution package, you can add the following symlink: $ ln -snf /usr/lib/systemd/system/rpm-ostree-countme.timer /usr/lib/systemd/system/rpm-ostreed.service.wants/ or add the following config snippet to the rpm-ostreed.service unit: Wants=rpm-ostree-countme.timer --- Makefile-daemon.am | 10 +++++++++- packaging/rpm-ostree.spec.in | 1 + .../rpm-ostree-countme.service.in} | 2 +- src/{app => daemon}/rpm-ostree-countme.timer | 0 src/daemon/rpm-ostree.conf | 1 + 5 files changed, 12 insertions(+), 2 deletions(-) rename src/{app/rpm-ostree-countme.service => daemon/rpm-ostree-countme.service.in} (87%) rename src/{app => daemon}/rpm-ostree-countme.timer (100%) create mode 100644 src/daemon/rpm-ostree.conf diff --git a/Makefile-daemon.am b/Makefile-daemon.am index 8324765a..ed8ff56d 100644 --- a/Makefile-daemon.am +++ b/Makefile-daemon.am @@ -59,10 +59,14 @@ systemdunit_service_in_files = \ $(srcdir)/src/daemon/rpm-ostreed.service.in \ $(srcdir)/src/daemon/rpm-ostreed-automatic.service.in \ $(srcdir)/src/daemon/rpm-ostree-bootstatus.service.in \ + $(srcdir)/src/daemon/rpm-ostree-countme.service.in \ $(NULL) systemdunit_service_files = $(systemdunit_service_in_files:.service.in=.service) -systemdunit_timer_files = $(srcdir)/src/daemon/rpm-ostreed-automatic.timer +systemdunit_timer_files = \ + $(srcdir)/src/daemon/rpm-ostreed-automatic.timer \ + $(srcdir)/src/daemon/rpm-ostree-countme.timer \ + $(NULL) systemdunit_DATA = \ $(systemdunit_service_files) \ @@ -78,6 +82,9 @@ endif $(systemdunit_service_files): Makefile $(SED_SUBST) $(daemon_asan_options) $@.in > $@ +systemdsysusers_DATA = $(srcdir)/src/daemon/rpm-ostree.conf +systemdsysusersdir = $(prefix)/lib/sysusers.d + # We keep this stub script around to have SELinux labeling work, # plus some backwards compatibility. libexec_SCRIPTS = rpm-ostreed @@ -107,6 +114,7 @@ EXTRA_DIST += \ $(service_in_files) \ $(systemdunit_service_in_files) \ $(systemdunit_timer_files) \ + $(systemdsysusers_conf_files) \ $(NULL) CLEANFILES += \ diff --git a/packaging/rpm-ostree.spec.in b/packaging/rpm-ostree.spec.in index a9748434..3605e84b 100644 --- a/packaging/rpm-ostree.spec.in +++ b/packaging/rpm-ostree.spec.in @@ -175,6 +175,7 @@ $PYTHON autofiles.py > files \ '%{_datadir}/dbus-1/system.d/*' \ '%{_sysconfdir}/rpm-ostreed.conf' \ '%{_prefix}/lib/systemd/system/*' \ + '%{_prefix}/lib/sysusers.d*' \ '%{_libexecdir}/rpm-ostree*' \ '%{_datadir}/polkit-1/actions/*.policy' \ '%{_datadir}/dbus-1/system-services' \ diff --git a/src/app/rpm-ostree-countme.service b/src/daemon/rpm-ostree-countme.service.in similarity index 87% rename from src/app/rpm-ostree-countme.service rename to src/daemon/rpm-ostree-countme.service.in index 77487f4c..9083e141 100644 --- a/src/app/rpm-ostree-countme.service +++ b/src/daemon/rpm-ostree-countme.service.in @@ -9,4 +9,4 @@ User=rpm-ostree DynamicUser=yes StateDirectory=rpm-ostree-countme StateDirectoryMode=750 -ExecStart=/usr/bin/rpm-ostree countme +ExecStart=@bindir@/rpm-ostree countme diff --git a/src/app/rpm-ostree-countme.timer b/src/daemon/rpm-ostree-countme.timer similarity index 100% rename from src/app/rpm-ostree-countme.timer rename to src/daemon/rpm-ostree-countme.timer diff --git a/src/daemon/rpm-ostree.conf b/src/daemon/rpm-ostree.conf new file mode 100644 index 00000000..7ebb02c2 --- /dev/null +++ b/src/daemon/rpm-ostree.conf @@ -0,0 +1 @@ +u rpm-ostree - "Unprivileged rpm-ostree user"