summaryrefslogtreecommitdiff
path: root/profile
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2018-10-05 15:07:39 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2019-01-08 00:26:17 +0000
commit30c29196247103283b1f2c43e2d59b26930a8f8c (patch)
treecf0f56ced34e7155c1aba0b0139d24618aceabcd /profile
parent880c613b472a91a3fdf7c3ce2966b9cea46df8d4 (diff)
downloadflatpak-30c29196247103283b1f2c43e2d59b26930a8f8c.tar.gz
profile: Use flatpak --installations
This ensures that we end up with the same installations in XDG_DATA_DIRS, regardless which way this variable gets set. Closes: #2122 Approved by: matthiasclasen
Diffstat (limited to 'profile')
-rw-r--r--profile/flatpak.sh.in14
1 files changed, 11 insertions, 3 deletions
diff --git a/profile/flatpak.sh.in b/profile/flatpak.sh.in
index 8b350e85..6b21aa49 100644
--- a/profile/flatpak.sh.in
+++ b/profile/flatpak.sh.in
@@ -1,7 +1,15 @@
# @sysconfdir@/profile.d/flatpak.sh - set XDG_DATA_DIRS
-if [ "${XDG_DATA_DIRS#*flatpak}" = "${XDG_DATA_DIRS}" ]; then
- XDG_DATA_DIRS="${XDG_DATA_HOME:-"$HOME/.local/share"}/flatpak/exports/share:@localstatedir@/lib/flatpak/exports/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
-fi
+new_dirs=
+while read -r install_path
+do
+ share_path=$install_path/exports/share
+ case ":$XDG_DATA_DIRS:" in
+ *":$share_path:"*) :;;
+ *":$share_path/:"*) :;;
+ *) new_dirs=${new_dirs:+${new_dirs}:}$share_path;;
+ esac
+done < <(echo "${XDG_DATA_HOME:-"$HOME/.local/share"}/flatpak"; flatpak --installations)
export XDG_DATA_DIRS
+XDG_DATA_DIRS="${new_dirs:+${new_dirs}:}${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"