chiark / gitweb /
Support system_bus_socket to be found in /var/run/dbus as well as /run/dbus.
authorChristoph Willing <chris.willing@linux.com>
Wed, 26 Sep 2018 13:14:02 +0000 (23:14 +1000)
committerSven Eden <yamakuzure@gmx.net>
Wed, 26 Sep 2018 16:25:46 +0000 (18:25 +0200)
Currently the path to system_bus_socket is hardcoded to
  /run/dbus/system_bus_socket
which works everywhere for systemd.

However, distributions which do no symlink /var/run on /run will have
it only accessible via
  /run/dbus/system_bus_socket
which should be supported by elogind, too.

Closes #77

Signed-off-by: Christoph Willing <chris.willing@linux.com>
Sigend-off-by: Sven Eden <sven.eden@prydeworx.com>
meson.build
src/basic/def.h
src/libelogind/sd-bus/test-bus-vtable.c

index 45262dcffe503b45ba79795b18b3976d6f2b50fa..550d7a6743e6239578c80324a5c67a56558d0b89 100644 (file)
@@ -204,6 +204,12 @@ if dbussystemservicedir == ''
         dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
 endif
 
+#if 1 /// Will elogind find system_bus_socket in /run/dbus or /var/run/dbus ?
+varrunissymllink = run_command('test', '-L', '/var/run').returncode() == 0
+message('Setting VARRUN_IS_SYMLINK to: @0@'.format(varrunissymllink))
+conf.set10('VARRUN_IS_SYMLINK', varrunissymllink)
+#endif // 1
+
 pamlibdir = get_option('pamlibdir')
 if pamlibdir == ''
         pamlibdir = join_paths(rootlibdir, 'security')
index 45b53c2481949c8c64c7757ba53892ccc1cb2988..ee4c672acb85fa6ca413171616262d3fbd6c7cb4 100644 (file)
 
 /* Note that we use the new /run prefix here (instead of /var/run) since we require them to be aliases and that way we
  * become independent of /var being mounted */
+#if 0 /// elogind should support both /run/dbus & /var/run/dbus (per Linux FHS)
 #define DEFAULT_SYSTEM_BUS_ADDRESS "unix:path=/run/dbus/system_bus_socket"
+#else
+/* Not all systems have dbus hierarchy in /run (as preferred by systemd) */
+#if VARRUN_IS_SYMLINK
+  #define DEFAULT_SYSTEM_BUS_ADDRESS "unix:path=/run/dbus/system_bus_socket"
+#else
+  #define DEFAULT_SYSTEM_BUS_ADDRESS "unix:path=/var/run/dbus/system_bus_socket"
+#endif // VARRUN_IS_SYMLINK
+#endif // 0
 #define DEFAULT_USER_BUS_ADDRESS_FMT "unix:path=%s/bus"
 
 #define PLYMOUTH_SOCKET {                                       \
index fd9ad8121742faf55c97eb31d239e7fe4969005b..5604aa668e251bc86f82af3f1cb246fe8ce109ca 100644 (file)
@@ -8,7 +8,15 @@
 
 #include "sd-bus-vtable.h"
 
+#if 0 /// elogind should support both /run/dbus & /var/run/dbus (per Linux FHS)
 #define DEFAULT_BUS_PATH "unix:path=/run/dbus/system_bus_socket"
+#else
+#if VARRUN_IS_SYMLINK
+  #define DEFAULT_BUS_PATH "unix:path=/run/dbus/system_bus_socket"
+#else
+  #define DEFAULT_BUS_PATH "unix:path=/var/run/dbus/system_bus_socket"
+#endif // VARRUN_IS_SYMLINK
+#endif // 0
 
 struct context {
         bool quit;