From 358e81a42faed7ee7192ce54e4230232f93ddb21 Mon Sep 17 00:00:00 2001 From: Christoph Willing Date: Wed, 26 Sep 2018 23:14:02 +1000 Subject: [PATCH] Support system_bus_socket to be found in /var/run/dbus as well as /run/dbus. 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 Sigend-off-by: Sven Eden --- meson.build | 6 ++++++ src/basic/def.h | 9 +++++++++ src/libelogind/sd-bus/test-bus-vtable.c | 8 ++++++++ 3 files changed, 23 insertions(+) diff --git a/meson.build b/meson.build index 45262dcff..550d7a674 100644 --- a/meson.build +++ b/meson.build @@ -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') diff --git a/src/basic/def.h b/src/basic/def.h index 45b53c248..ee4c672ac 100644 --- a/src/basic/def.h +++ b/src/basic/def.h @@ -48,7 +48,16 @@ /* 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 { \ diff --git a/src/libelogind/sd-bus/test-bus-vtable.c b/src/libelogind/sd-bus/test-bus-vtable.c index fd9ad8121..5604aa668 100644 --- a/src/libelogind/sd-bus/test-bus-vtable.c +++ b/src/libelogind/sd-bus/test-bus-vtable.c @@ -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; -- 2.30.2