From 30c29196247103283b1f2c43e2d59b26930a8f8c Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 5 Oct 2018 15:07:39 -0400 Subject: 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 --- profile/flatpak.sh.in | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'profile') 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}" -- cgit v1.2.1