systemd: add sysusers.d snippet for booting up with unpopulated /etc
authorLennart Poettering <lennart@poettering.net>
Tue, 20 Dec 2016 17:14:11 +0000 (18:14 +0100)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Mon, 13 Feb 2017 14:49:52 +0000 (14:49 +0000)
This adds a "sysusers.d" snippet for creating the system user "dbus" at
boot, if it is missing, in order to support stateless systems that boot
up with an empty /etc and need static information for determining which
system users to create.

This is only installed on systemd-based systems.

Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=99162

bus/Makefile.am
bus/sysusers.d/dbus.conf.in [new file with mode: 0644]
configure.ac

index 268c6f0..b347d46 100644 (file)
@@ -1,6 +1,8 @@
 dbusdatadir=$(datadir)/dbus-1
 legacydbusdatadir=$(sysconfdir)/dbus-1
 dbus_daemon_execdir = $(DBUS_DAEMONDIR)
+# Always lib, even if ${libdir} is lib64 or lib/x86_64-linux-gnu
+systemdsysusersdir = $(prefix)/lib/sysusers.d
 
 DBUS_BUS_LIBS = \
        $(CODE_COVERAGE_LDFLAGS) \
@@ -316,11 +318,15 @@ SCRIPT_IN_FILES += \
        dbus.socket.in \
        systemd-user/dbus.service.in \
        systemd-user/dbus.socket.in \
+       sysusers.d/dbus.conf.in
        $(NULL)
 
 systemdsystemunit_DATA = \
        dbus.service \
        dbus.socket
+
+nodist_systemdsysusers_DATA = \
+       sysusers.d/dbus.conf
 endif
 
 if DBUS_ENABLE_USER_SESSION
diff --git a/bus/sysusers.d/dbus.conf.in b/bus/sysusers.d/dbus.conf.in
new file mode 100644 (file)
index 0000000..fb35702
--- /dev/null
@@ -0,0 +1,5 @@
+# sysusers.d snippet for creating the D-Bus system user automatically
+# at boot on systemd-based systems that ship with an unpopulated
+# /etc. See sysusers.d(5) for details.
+
+u @DBUS_USER@ - "System Message Bus"
index 71a0855..c7c762e 100644 (file)
@@ -1876,6 +1876,7 @@ bus/dbus.service
 bus/dbus.socket
 bus/systemd-user/dbus.service
 bus/systemd-user/dbus.socket
+bus/sysusers.d/dbus.conf
 Makefile
 dbus/Makefile
 bus/Makefile