From 5886fa922c419663bbf67bb62c9482bb2de52775 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 20 Jun 2017 15:03:37 +0100 Subject: [PATCH 09/49] Install a systemd tmpfiles.d snippet to create /var/lib/dbus/machine-id On systemd systems, /etc/machine-id is guaranteed to exist and has the same format as the D-Bus machine ID. The major D-Bus implementations read /etc/machine-id if it exists, but some less up-to-date implementations still only read /var/lib/dbus/machine-id. We can be nice to those implementations by ensuring /var/lib/dbus/machine-id is a symlink; this way, the two files can never get out of sync. Signed-off-by: Simon McVittie --- .gitignore | 1 + bus/Makefile.am | 5 +++++ bus/tmpfiles.d/dbus.conf.in | 5 +++++ configure.ac | 1 + 4 files changed, 12 insertions(+) create mode 100644 bus/tmpfiles.d/dbus.conf.in diff --git a/.gitignore b/.gitignore index 8d746822..6398e77c 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,7 @@ config.h.in *.gcda *.gcno tags +/bus/tmpfiles.d/dbus.conf /dbus-1.*/ /dbus-1.*.tar.* /lcov.html/ diff --git a/bus/Makefile.am b/bus/Makefile.am index 6de6d0a8..b2885f31 100644 --- a/bus/Makefile.am +++ b/bus/Makefile.am @@ -2,6 +2,7 @@ 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 +systemdtmpfilesdir = $(prefix)/lib/tmpfiles.d systemdsysusersdir = $(prefix)/lib/sysusers.d DBUS_BUS_LIBS = \ @@ -318,6 +319,7 @@ SCRIPT_IN_FILES += \ systemd-user/dbus.service.in \ systemd-user/dbus.socket.in \ sysusers.d/dbus.conf.in + tmpfiles.d/dbus.conf.in $(NULL) systemdsystemunit_DATA = \ @@ -326,6 +328,9 @@ systemdsystemunit_DATA = \ nodist_systemdsysusers_DATA = \ sysusers.d/dbus.conf + +nodist_systemdtmpfiles_DATA = \ + tmpfiles.d/dbus.conf endif if DBUS_ENABLE_USER_SESSION diff --git a/bus/tmpfiles.d/dbus.conf.in b/bus/tmpfiles.d/dbus.conf.in new file mode 100644 index 00000000..754f0220 --- /dev/null +++ b/bus/tmpfiles.d/dbus.conf.in @@ -0,0 +1,5 @@ +# Fields: type; path; mode; uid; gid; age; argument (symlink target) + +# Make ${localstatedir}/lib/dbus/machine-id a symlink to /etc/machine-id +# if it does not already exist +L @EXPANDED_LOCALSTATEDIR@/lib/dbus/machine-id - - - - /etc/machine-id diff --git a/configure.ac b/configure.ac index 903adcd5..a87a107d 100644 --- a/configure.ac +++ b/configure.ac @@ -1895,6 +1895,7 @@ bus/dbus.socket bus/systemd-user/dbus.service bus/systemd-user/dbus.socket bus/sysusers.d/dbus.conf +bus/tmpfiles.d/dbus.conf Makefile dbus/Makefile bus/Makefile -- 2.11.0