When using OpenBSD ksh `flatpak.sh` gives the following error:
/etc/profile.d/flatpak.sh[16]: syntax error: `;;' unexpected
By adding in the POSIX compliant optional opening parentheses for the
case statement branches the profile can be made more portable. This
still works with them more common shells such as bash and zsh and also
still passes `shellcheck` checks.
Aware that using OpenBSD ksh on Linux might be an edge case but there
are probably BSD users who need to use Linux for work such as myself but
still want to use the OBSD shell which has been ported to Linux:
https://github.com/dimkr/loksh
Many thanks to @gumnos for pointing out the fix here via Twitter.
Closes: #2947
Approved by: mwleeds
In some OSs, removing a package does not immediately remove its
configuration files in /etc. In particular, `dpkg --remove` or
`apt-get remove` in Debian derivatives leaves configuration files intact
so that the package can be reinstalled later without having to
reconfigure it, with `dpkg --purge` or `apt-get purge` used to remove
the configuration files too.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Closes: #2840Closes: #2849
Approved by: alexlarsson
If G_MESSAGES_DEBUG is set in the shell's start-up scripts, then the
"flatpak --installations" output is contaminated with these strings:
(flatpak:4558): flatpak-DEBUG: ...
Fallout from 30c2919624Closes: #2673
Approved by: alexlarsson
In Debian, we reuse flatpak.sh in /etc/X11/Xsession.d (which is sourced
by /bin/sh, normally dash) so that these environment variables become
part of the X11 session environment. We might also have
non-bash-compatible shells that read profile.d (I'm not sure).
Fixes#2594
Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #2597
Approved by: matthiasclasen
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
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>
* Append flatpak data dirs if XDG_DATA_DIRS is already set
Otherwise it will be impossible to run flatpak apps from desktop menus.
This issue can happen if another app (e.g. snapd) wants to add custom
folders to XDG_DATA_DIRS through /etc/profile.d
If XDG_DATA_DIRS is empty or unset, define it as before.
Fixes#606