diff options
author | Luca Boccassi <bluca@debian.org> | 2020-12-22 18:47:39 +0100 |
---|---|---|
committer | Luca Boccassi <bluca@debian.org> | 2021-01-01 22:33:16 +0100 |
commit | 53a1c944805bb213cf22df0f65013dbb400d7bf5 (patch) | |
tree | c2a621ad19523651779a000ca8d2b865e2e56c3a /test/test-functions | |
parent | test: update test_create_image (diff) | |
download | systemd-53a1c944805bb213cf22df0f65013dbb400d7bf5.tar.xz systemd-53a1c944805bb213cf22df0f65013dbb400d7bf5.zip |
test: use pkg-config to get user unit dir when installing dbus user socket
Usually on Debian ROOTLIBDIR is /lib/<arch triplet>, which is not the right place.
Use pkg-config since we define it, and then fallback to /usr/lib/systemd/user which is
the canonical location.
On both Debian&friends and Fedora dbus/dbus-broker install the user socket/service
under /usr/lib/systemd/user, not /lib/systemd/systemd/user.
Diffstat (limited to '')
-rw-r--r-- | test/test-functions | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/test/test-functions b/test/test-functions index 482cb7b490..03685f8da4 100644 --- a/test/test-functions +++ b/test/test-functions @@ -1058,8 +1058,14 @@ EOF } install_user_dbus() { - inst $ROOTLIBDIR/user/dbus.socket - inst_symlink /usr/lib/systemd/user/sockets.target.wants/dbus.socket || inst_symlink /etc/systemd/user/sockets.target.wants/dbus.socket + local userunitdir + if ! userunitdir=$(pkg-config --variable=systemduserunitdir systemd); then + echo "WARNING! Cannot determine userunitdir from pkg-config, assuming /usr/lib/systemd/user" >&2 + local userunitdir=/usr/lib/systemd/user + fi + + inst $userunitdir/dbus.socket + inst_symlink $userunitdir/sockets.target.wants/dbus.socket || inst_symlink /etc/systemd/user/sockets.target.wants/dbus.socket # Append the After= dependency on dbus in case it isn't already set up mkdir -p "$initdir/etc/systemd/system/user@.service.d/" @@ -1069,16 +1075,16 @@ After=dbus.service EOF # Newer Fedora versions use dbus-broker by default. Let's install it if it's available. - if [ -f $ROOTLIBDIR/user/dbus-broker.service ]; then - inst $ROOTLIBDIR/user/dbus-broker.service + if [ -f $userunitdir/dbus-broker.service ]; then + inst $userunitdir/dbus-broker.service inst_symlink /etc/systemd/user/dbus.service elif [ -f $ROOTLIBDIR/system/dbus-daemon.service ]; then # Fedora rawhide replaced dbus.service with dbus-daemon.service - inst $ROOTLIBDIR/user/dbus-daemon.service + inst $userunitdir/dbus-daemon.service # Alias symlink inst_symlink /etc/systemd/user/dbus.service else - inst $ROOTLIBDIR/user/dbus.service + inst $userunitdir/dbus.service fi } |