Commit Graph

15 Commits

Author SHA1 Message Date
Ross Timson
a48f46f314 profile: Fix for openbsd ksh.
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
2019-06-11 19:20:25 +00:00
Simon McVittie
684b19e719 profile: Only alter XDG_DATA_DIRS if flatpak is still installed
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: #2840

Closes: #2849
Approved by: alexlarsson
2019-04-25 08:12:35 +00:00
Debarshi Ray
7c8f21e0a4 profile: Unbreak XDG_DATA_DIRS when debug logging is enabled
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 30c2919624

Closes: #2673
Approved by: alexlarsson
2019-02-01 16:30:52 +00:00
Simon McVittie
2a25ecf6ee profile: Don't rely on bash syntax
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
2019-01-16 00:08:21 +00:00
Matthias Clasen
6cac94e706 Simplify profile.d handling
There is no need to generate this script when the
only variable part in it is a comment. Reword the
comment.

Closes: #2122
Approved by: matthiasclasen
2019-01-08 00:26:17 +00:00
Matthias Clasen
30c2919624 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
2019-01-08 00:26:17 +00:00
Simon McVittie
e572311a26 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>
2017-03-14 21:48:58 +01:00
Alexander Larsson
93347f4a6d profile: Don't add flatpak to XDG_DATA_DIRS if its already there
(cherry picked from commit f09d6b3aa6)
2017-03-10 11:29:29 +01:00
Elvis Angelaccio
a9acdc0532 Append flatpak data dirs if XDG_DATA_DIRS is already set (#611)
* 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
2017-03-08 08:38:47 +01:00
Alexander Larsson
e9c67ec47f Get the system installation dir right in XDG_DATA_DIRS
Its in /var/lib/flatpak, not /var/flatpak
2016-05-20 09:21:19 +02:00
Alexander Larsson
5e9b247d26 Migrate ~/.local/share/xdg-app to ~/.local/share/flatpak 2016-05-09 12:21:28 +02:00
Alexander Larsson
8abbc0186e Rename everything but the on-disk location to flatpak 2016-05-09 11:11:55 +02:00
Alexander Larsson
c7a05ae781 profile: Don't override pre-existing XDG_DATA_DIRS env vars 2015-06-24 09:31:50 +02:00
Alexander Larsson
c5a2bb2b07 xdg-app.sh: /usr/local/share is also in the default XDG_DATA_DIRS 2015-06-23 11:38:55 +02:00
David King
27fdae4153 Add a simple profile.d snippet for XDG_DATA_DIRS
https://github.com/alexlarsson/xdg-app/issues/74
2015-05-15 17:00:38 +01:00