From ae7568facee0b0d93d7bd1433a0d8840e98f6fb6 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 20 Jun 2017 15:03:37 +0100 Subject: [PATCH] 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 Reviewed-by: Philip Withnall Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101570 --- .gitignore | 1 + bus/Makefile.am | 8 +++++++- bus/tmpfiles.d/dbus.conf.in | 5 +++++ configure.ac | 1 + 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 bus/tmpfiles.d/dbus.conf.in diff --git a/.gitignore b/.gitignore index 8d74682..6398e77 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 6de6d0a..271887c 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 = \ @@ -317,7 +318,8 @@ SCRIPT_IN_FILES += \ dbus.socket.in \ systemd-user/dbus.service.in \ systemd-user/dbus.socket.in \ - sysusers.d/dbus.conf.in + sysusers.d/dbus.conf.in \ + tmpfiles.d/dbus.conf.in \ $(NULL) systemdsystemunit_DATA = \ @@ -326,6 +328,10 @@ systemdsystemunit_DATA = \ nodist_systemdsysusers_DATA = \ sysusers.d/dbus.conf + +nodist_systemdtmpfiles_DATA = \ + tmpfiles.d/dbus.conf \ + $(NULL) 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 0000000..754f022 --- /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 1561c94..60e31f6 100644 --- a/configure.ac +++ b/configure.ac @@ -1883,6 +1883,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.7.4