diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2025-01-18 19:00:03 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2025-01-18 19:00:03 +0100 |
| commit | 3eb4d872f7157b67691fb5a98e2cf53f716c5457 (patch) | |
| tree | f8a994a39e359e2620ff01baa2e1096f7e0da633 /guides/sysadmin/apps-demo/activate | |
| parent | 9398b60e08f07022cf02bb290f36718b1c744eae (diff) | |
| download | memory-leaks-3eb4d872f7157b67691fb5a98e2cf53f716c5457.tar.xz | |
Resume gratuitous shuffling
Diffstat (limited to 'guides/sysadmin/apps-demo/activate')
| -rw-r--r-- | guides/sysadmin/apps-demo/activate | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/guides/sysadmin/apps-demo/activate b/guides/sysadmin/apps-demo/activate new file mode 100644 index 0000000..b8c9138 --- /dev/null +++ b/guides/sysadmin/apps-demo/activate @@ -0,0 +1,34 @@ +# Hey Emacs; this is a -*- shell-script -*-. +# Hopefully invoked by bash 🤞 + +_apps_dir=$(realpath --no-symlinks $(dirname ${BASH_SOURCE})) + +_apps_PATH=$( + shopt -s nullglob + bins=( "${_apps_dir}"/*/bin ) + IFS=: eval 'echo "${bins[*]}"' +) +export PATH=${_apps_PATH}:${PATH} + +_apps_XDG_DATA_DIRS=$( + shopt -s nullglob + # We could set globstar and let Bash loose, searching the depths + # of _apps_dir for + # **/{applications/*.desktop,systemd/user/*.service} + # but it seems like asking for trouble. Make some assumptions + # about where applications typically dump their XDG-related files. + datadirs=($( + { + for dkentry in "${_apps_dir}"/*/share/applications/*.desktop + do + echo ${dkentry%/applications/*.desktop} + done + for unit in "${_apps_dir}"/*/lib*/systemd/user/*.service + do + echo ${unit%/systemd/user/*.service} + done + } | sort -u + )) + IFS=: eval 'echo "${datadirs[*]}"' +) +export XDG_DATA_DIRS="${_apps_XDG_DATA_DIRS}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" |
