aboutsummaryrefslogtreecommitdiff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorWORLDofPEACE <worldofpeace@protonmail.ch>2020-09-14 00:37:09 -0400
committerGitHub <noreply@github.com>2020-09-14 00:37:09 -0400
commit4085eee678dc52d158f2fd667a8cdaeac876535e (patch)
tree37a592750f2a8c39a090e58ba235215f68c99a84 /pkgs/build-support
parent333ab52783c24d9d115537108e31a71c4f6687b4 (diff)
parentf292a27f442d10de4827800d064a3a8c64d05cee (diff)
Merge pull request #97801 from rycee/user-session-dbus2
Make socket activated user dbus session mandatory
Diffstat (limited to 'pkgs/build-support')
-rwxr-xr-xpkgs/build-support/setup-hooks/move-systemd-user-units.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/pkgs/build-support/setup-hooks/move-systemd-user-units.sh b/pkgs/build-support/setup-hooks/move-systemd-user-units.sh
new file mode 100755
index 000000000000..5963d87c7515
--- /dev/null
+++ b/pkgs/build-support/setup-hooks/move-systemd-user-units.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+# This setup hook, for each output, moves everything in
+# $output/lib/systemd/user to $output/share/systemd/user, and replaces
+# $output/lib/systemd/user with a symlink to
+# $output/share/systemd/user.
+
+fixupOutputHooks+=(_moveSystemdUserUnits)
+
+_moveSystemdUserUnits() {
+ if [ "${dontMoveSystemdUserUnits:-0}" = 1 ]; then return; fi
+ if [ ! -e "${prefix:?}/lib/systemd/user" ]; then return; fi
+ local source="$prefix/lib/systemd/user"
+ local target="$prefix/share/systemd/user"
+ echo "moving $source/* to $target"
+ mkdir -p "$target"
+ (
+ shopt -s dotglob
+ for i in "$source"/*; do
+ mv "$i" "$target"
+ done
+ )
+ rmdir "$source"
+ ln -s "$target" "$source"
+}