Browse Source

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.
Pawel Marczewski 4 years ago
parent
commit
552b6de862
1 changed files with 9 additions and 0 deletions
  1. 9 0
      qubes-rpc/qubes.GetAppmenus

+ 9 - 0
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