From 552b6de862a880422c51140d080bd647a27f6c07 Mon Sep 17 00:00:00 2001 From: Pawel Marczewski Date: Tue, 7 Jan 2020 15:45:05 +0100 Subject: [PATCH] GetAppmenus: ensure right app directories The script depends on XDG_DATA_DIRS environment variable being set up correctly, which is not the case when it is running under sudo. As a result, a post-install trigger for apt could remove application entries from other sources (Snap, Flatpak). Fixes QubesOS/qubes-issues#5477. --- qubes-rpc/qubes.GetAppmenus | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/qubes-rpc/qubes.GetAppmenus b/qubes-rpc/qubes.GetAppmenus index d417c56..ca24d2d 100755 --- a/qubes-rpc/qubes.GetAppmenus +++ b/qubes-rpc/qubes.GetAppmenus @@ -6,6 +6,15 @@ # - directories stored on /rw in case of "rw-only" persistence # - 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 + . "$i" >/dev/null + fi +done + if [ -z "$XDG_DATA_HOME" ]; then XDG_DATA_HOME="$HOME/.local/share" fi