Merge remote-tracking branch 'origin/pr/199'

* origin/pr/199:
  qubes.GetAppmenus: handle home directory properly in case of sudo
  Silence shellcheck
  GetAppmenus: ensure right app directories
This commit is contained in:
Marek Marczykowski-Górecki 2020-01-09 01:38:12 +01:00
commit cc68f165bc
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -6,8 +6,24 @@
# - directories stored on /rw in case of "rw-only" persistence # - directories stored on /rw in case of "rw-only" persistence
# - nothing, otherwise # - nothing, otherwise
# Reload scripts in /etc/profile.d/, in case they register additional
# directories in XDG_DATA_DIRS and we forgot them
# (e.g. because we are running under sudo).
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
# shellcheck disable=SC1090
. "$i" >/dev/null
fi
done
if [ -z "$XDG_DATA_HOME" ]; then if [ -z "$XDG_DATA_HOME" ]; then
XDG_DATA_HOME="$HOME/.local/share" user="$(whoami)"
# In case we are running under sudo, use default-user.
if [ "$user" = "root" ]; then
user="$(qubesdb-read /default-user || echo user)"
fi
home="$(eval echo "~$user")"
XDG_DATA_HOME="$home/.local/share"
fi fi
if [ -z "$XDG_DATA_DIRS" ]; then if [ -z "$XDG_DATA_DIRS" ]; then
XDG_DATA_DIRS="/usr/local/share/:/usr/share/" XDG_DATA_DIRS="/usr/local/share/:/usr/share/"