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 <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101570
This commit is contained in:
Simon McVittie 2017-06-20 15:03:37 +01:00
parent 3974aa5062
commit ae7568face
4 changed files with 14 additions and 1 deletions

1
.gitignore vendored
View file

@ -37,6 +37,7 @@ config.h.in
*.gcda
*.gcno
tags
/bus/tmpfiles.d/dbus.conf
/dbus-1.*/
/dbus-1.*.tar.*
/lcov.html/

View file

@ -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

View file

@ -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

View file

@ -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