diff options
author | Simon McVittie <smcv@debian.org> | 2017-03-10 20:01:49 +0000 |
---|---|---|
committer | Alexander Larsson <alexander.larsson@gmail.com> | 2017-03-14 21:48:58 +0100 |
commit | e572311a26911b74e96c593987e250fb4bbc532b (patch) | |
tree | 660b708da1a3f30632ac402d0a0f602f6188be73 /profile | |
parent | 18f27f701b69ed77915c74bbc991ddc9e6739614 (diff) | |
download | flatpak-e572311a26911b74e96c593987e250fb4bbc532b.tar.gz |
Improve and simplify profile snippet
Avoid setting a temporary variable flatpak_dirs which, while not
exported to the environment, would still be defined as a
shell "parameter" (variable) in the login shell itself.
Consistently put the Flatpak directories before other XDG_DATA_DIRS,
rather than putting them last if XDG_DATA_DIRS happens to be already
set.
Expand XDG_DATA_HOME if necessary, rather than assuming it will
always be ~/.local/share.
I don't know exactly which shells source profile.d, but it's possible
that one of them might only implement POSIX test syntax, so prefer
[ x = y ] over [ x == y ].
Fix some insufficient quoting that could have gone wrong if
XDG_DATA_DIRS somehow contained spaces.
Signed-off-by: Simon McVittie <smcv@debian.org>
Diffstat (limited to 'profile')
-rw-r--r-- | profile/flatpak.sh.in | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/profile/flatpak.sh.in b/profile/flatpak.sh.in index cc9c3427..8b350e85 100644 --- a/profile/flatpak.sh.in +++ b/profile/flatpak.sh.in @@ -1,11 +1,7 @@ # @sysconfdir@/profile.d/flatpak.sh - set XDG_DATA_DIRS -flatpak_dirs=$HOME/.local/share/flatpak/exports/share/:@localstatedir@/lib/flatpak/exports/share/ - -if [ -z "${XDG_DATA_DIRS}" ]; then - XDG_DATA_DIRS="$flatpak_dirs:/usr/local/share/:/usr/share/" -elif [ "${XDG_DATA_DIRS#*flatpak}" == ${XDG_DATA_DIRS} ]; then - XDG_DATA_DIRS="$XDG_DATA_DIRS:$flatpak_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 export XDG_DATA_DIRS |