Commit Graph

726 Commits

Author SHA1 Message Date
Simon McVittie
3acdb37fc6 doc: Mention how to get a compatible ~/.local/state with older versions
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-11-15 11:07:57 +01:00
Simon McVittie
871e684eab doc: Mention that setting XDG_STATE_HOME is a new feature
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-11-15 11:07:57 +01:00
Lionir
0fda062c96 Add XDG_STATE_HOME and HOST_XDG_STATE_HOME env variables
This gives new support for the new XDG_STATE_HOME addition to XDG_BASE_DIRS
which allows applications to use this without breaking because they would
assume $HOME/.local/state which may be unavailable to the flatpak

This adds it as .local/state as to make --persist=.local/state the same behaviour
as in new flatpak. This in turn means that the transition should be seamless between
old and new flatpak.

This also has the benefit of working if the application doesn't follow XDG spec thanks
to --persist=.local/state.

This fixes https://github.com/flatpak/flatpak/issues/4477

[smcv: Don't call nonexistent g_get_user_state_dir(); fix a reference
to XDG_STATE_DIR]
2021-11-15 11:07:57 +01:00
Phaedrus Leeds
71a09d47d5 doc/flatpakrepo: Fix a typo 2021-10-25 14:10:43 -07:00
Phaedrus Leeds
b098191252 Fix capitalization of "false" in flatpakref keyfiles
g_key_file_get_boolean() only accepts lower case "true" and "false", so
correct some instances of "False" in key files. This makes no functional
difference as long as the error pointer isn't checked since
g_key_file_get_boolean() also returns false when it can't parse the
value as a boolean. But it still seems good to be correct, and someone
could interpret the existence of "IsRuntime=False" as implying that
"IsRuntime=True" will work, which it doesn't.
2021-10-15 00:38:15 +01:00
Phaedrus Leeds
f94721bef2 doc: Clarify default setting of noenumerate/nodeps options 2021-10-14 01:31:13 +01:00
Simon McVittie
dd6b99d0d3 .gitignore: Ignore more generated files
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-25 12:07:08 +01:00
Simon McVittie
f2b4edc558 Improve release checklist
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-06-15 14:09:21 +01:00
Simon McVittie
4c7d74ac57 doc: Add a release checklist for maintainers
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-05-17 10:02:51 +02:00
Simon McVittie
cb47d83b72 run: Add option to share /dev/shm between instances of an app-ID
Similar to /tmp, applications might well use /dev/shm as an IPC
rendezvous between instances, which wouldn't have worked without
--device=shm until now.

Because /dev/shm has specific characteristics (in particular it's
meant to always be a tmpfs), we offload the actual storage into a
subdirectory of the real /dev/shm. Because /dev/shm is a shared
directory between all uids, we have to be extra-careful how we
do this, which is why the test coverage here is important.

This is done on an opt-in basis because of its extra complexity.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-04-16 08:57:20 +02:00
Simon McVittie
3ebf371fc2 run: Allow caller to replace /app and/or /usr
The pressure-vessel container tool in Steam will want to use this, to
replace /usr with a Steam Runtime container supplied by the Steam CDN,
instead of using the same Flatpak runtime that is used to run the Steam
client and non-containerized games.

If a custom /usr is used, the "official" Flatpak runtime is still the
one reflected in the metadata. It is also mounted at /run/parent,
with all its extensions, so that pressure-vessel has the option of using
its graphics drivers (by populating the custom /usr with symlinks into
/run/parent and/or /run/host).

When doing this, we need to put an empty directory on /app, because
the real /app expects to be run on top of the real runtime. It would
also be reasonable to substitute a custom replacement for /app, so
I've included support for that too.

Partially addresses #3797.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-04-07 09:52:50 +02:00
Phaedrus Leeds
79a91b5cf6 Make flatpak --help output use consistent verbiage
Use present tense consistently rather than gerunds for some headings in
"flatpak --help". Also tweak flatpak(1) to use similar wording but with
gerunds.
2021-03-10 10:27:31 +01:00
Phaedrus Leeds
bc39bb59c4 doc: Add info -l docs 2021-02-09 09:37:32 +01:00
Jan Tojnar
2bdd687bd7 doc: Unify DocBook versions again
Fixes a regression in version monoculture that occurred since the first attempt in
https://github.com/flatpak/flatpak/pull/3760
2021-02-01 23:16:25 +01:00
Simon McVittie
d0d5794621 doc: Mention some typical tags
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-01-21 14:18:21 +01:00
Simon McVittie
4108e02245 context: Add --unset-env option and a corresponding override
This follows up from GHSA-4ppf-fxf6-vxg2 to fix missing functionality
that I noticed while resolving that vulnerability, but is not required
for fixing the vulnerability.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-01-14 09:33:24 +01:00
Simon McVittie
6e5ae7a109 context: Add --env-fd option
This allows environment variables to be added to the context without
making their values visible to processes running under a different uid,
which might be significant if the variable's value is a token or some
other secret value.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Part-of: https://github.com/flatpak/flatpak/security/advisories/GHSA-4ppf-fxf6-vxg2
2021-01-14 09:33:24 +01:00
Simon McVittie
bbf6debec2 Add an option to share the pid namespace with the parent flatpak
As with flatpak run --parent-expose-pids, this will only work if we have
a working, non-setuid bwrap. Systems where user namespace creation is
restricted and bwrap needs to be setuid (Debian 10, RHEL/CentOS 7,
Arch Linux linux-hardened kernel) will have degraded functionality.

This option is similar to --expose-pids, except that instead of making
the subsandbox use a nested pid namespace inside the parent's, it makes
the subsandbox share the parent's pid namespace as-is, so that process
IDs in the parent and the subsandbox are interchangeable. This will
be useful if the parent and the subsandbox communicate via protocols
that assume a global view of the process ID namespace, for example
passing process IDs across an AF_UNIX socket or in shared memory.

In particular, this will be useful for Steam's pressure-vessel container
tool: the IPC between the Steam client and the "game overlay" loaded into
Steam games uses process IDs, and becomes confused if they don't match up.

This weakens the security boundary between a subsandbox and the parent,
but that's OK in some cases, especially if the subsandbox is being used
as a way to get a different runtime /usr (flatpak-spawn --latest-version
or #4018) rather than as a security boundary.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-01-12 09:55:23 +01:00
Philip Withnall
9411fe2bca flatpak: Add --print-updated-env option to print environment
This is the environment needed to use flatpaks; a following commit will
hook this up to the systemd environment generator.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-22 14:21:54 +01:00
Tina Müller
297076cd4e docs: Fix typo in flatpak-search usage 2020-12-04 20:42:48 +01:00
Alexander Larsson
c12f4a5b21 Fix build/dist of API docs
We don't want to dist the stamp files, because they are not actually
created.

Also include the AuthenticatorRequest dbus interface in the docs
2020-11-19 11:01:03 +01:00
Alexander Larsson
e5fac1feb8 Add docs for --subset=SUBSET 2020-11-13 10:32:19 +01:00
Alexander Larsson
a0dd41d8c4 docs: Add initial document describing the flatpak summary files. 2020-10-29 17:19:47 +01:00
Simon McVittie
7c29fc6fd6 doc: Include D-Bus APIs in the API reference documentation
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-10-01 11:11:30 +02:00
Phaedrus Leeds
7cd1990196 Automatically pin explicitly installed runtimes
If a runtime is installed explicitly rather than as a dependency, pin it
so it doesn't get automatically removed when unused runtimes are being
removed. We do this because the runtime might be installed for
development or other uses.

This commit also rearranges some code in the mask and pin commands, and
adds a unit test.
2020-08-31 16:29:03 +02:00
Phaedrus Leeds
2325b81401 Minor fixes for mask command 2020-08-31 16:29:03 +02:00
Matthew Leeds
d2d5397cc1 Add pin command to keep unused runtimes
As discussed here [1], we want a way to mark runtimes to be kept even
when they are unused by any apps and we are removing such runtimes.
Currently this is a command that can be run manually; a subsequent
commit will pin runtimes automatically if they are installed
independently of any app.

A unit test is included.

[1] https://github.com/flatpak/flatpak/issues/2639#issuecomment-662311756
2020-08-31 16:29:03 +02:00
Phaedrus Leeds
3f19950936 doc/update: Fix formatting 2020-08-31 16:26:12 +02:00
Simon McVittie
09424423b9 context: Normalize home/path to ~/path, and ~ to home
Historically we didn't accept them, but there's no real reason why not.
They're normalized to the form in which earlier Flatpak releases would
want to see them.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-08-27 17:48:50 +02:00
Matthew Leeds
1aeceb0caf doc: Clarify remote no-enumerate docs 2020-08-17 09:21:30 +02:00
Matthew Leeds
845a877ce1 Prioritize an app's origin for its runtime
Currently when searching for a remote to provide the runtime for an app,
we search remotes in priority order. This commit makes it so we search
the remote providing the app before others with the same priority, and
otherwise still search in priority order.  This means for the common
case where every remote has the default priority of 1, the app's origin
will have the first chance to provide the runtime. This behavior seems
logical, but the impetus for this change was also to keep a unit test
passing in eos-updater[1] after a port to FlatpakTransaction.

Originally the eos-updater unit test was written to prioritize the
origin remote regardless of the priorities on any other remote, but
during code review it was decided to let higher priority remotes stay
above the app's origin.

In practice it's usually true that only one remote provides a runtime
and priorities aren't set at all, so this is an edge case that probably
doesn't come up much.

A unit test and documentation updates are included.

[1] eede0a8b9c/tests/test-update-install-flatpaks.c (L1919)
2020-08-17 09:21:30 +02:00
Phaedrus Leeds
2612e9df18 doc: Update create-usb for sideloading
Update the create-usb man page to reflect the re-worked implementation
that landed in 1.7.1.
2020-08-11 15:22:57 +02:00
Jan Tojnar
eb57c7c07b Unify DocBook DTDs
Previously, there were three different DTDs used. Let's switch to a single one.

We will go with 4.5, since it is latest version that does not have any backwards incompatible changes.
2020-08-10 15:14:38 +02:00
Luca Boccassi
7872935e12 run: implement sandbox host os-release interface
If available, always read-only bind-mount /etc/os-release as
/run/host/os-release (or /usr/lib/os-release as fallback)
as suggested by the os-release specification:

https://www.freedesktop.org/software/systemd/man/os-release.html
2020-07-24 10:28:30 +02:00
Matthew Leeds
01a0f4ffa7 doc: Fix a typo in build-export --include docs 2020-07-21 09:03:21 +02:00
Matthew Leeds
4c198d3c98 doc: Clarify build-bundle docs with respect to format 2020-07-21 09:02:52 +02:00
Matthew Leeds
7584be3944 doc: Tweak remote-ls docs 2020-07-21 09:02:00 +02:00
Matthew Leeds
5a646117c9 Don't mention $FLATPAK_RUN_DIR in docs
We only want the run dir to be overridable in unit tests because we
depend on it being /run/flatpak in flatpak-create-sideload-symlinks.sh,
so don't mention it in the flatpak man page.
2020-06-23 09:37:10 +02:00
Matthew Leeds
e84b75629d Allow sideload-repos to link to the root of a USB
Currently we only support links in /var/lib/flatpak/sideload-repos,
/run/flatpak/sideload-repos, etc. to be actual ostree repos, but this
commit makes it so you can also link to the root directory of a USB,
and Flatpak will check the subpaths "ostree/repo", ".ostree/repo", and
".ostree/repos.d" for compatibility with "flatpak create-usb". This will
allow the logic in the following commit to be much simpler, where we're
linking to hot-plugged drives in a script run by systemd.

Note that we still only allow actual repos in the other places where a
sideload path can be specified, such as the --sideload-repo CLI option.
2020-06-23 09:37:10 +02:00
Matthew Leeds
6397200247 Update documentation for sideload-repos
It is no longer a config option; it was changed to be a directory.
2020-06-18 13:51:16 -07:00
Matthew Leeds
bd04b09f9b create-usb: Include partial commits
Commits 32194f2d2 and b8d2196c2 made create-usb detect partially
installed commits and omit them except when --allow-partial is specified
(and in the case of extensions of related refs omit them
unconditionally). The reasoning was that if on the other computer using
the USB for an installation you need a different subpath of a commit
(such as a different language of a locale extension), the installation
will fail. But in most real world cases the users on both ends will
speak the same language so it will not often be an issue.  Also, if you
are offline and have only your own language's subpaths for your locale
extensions, it makes sense to put them on the USB because you have no
way to get the full locale extension and the receiver probably wants the
same subpath as you.

The way "flatpak create-usb" is most often used in Endless is via
gnome-software which calls it under the hood. So while we could have it
pass --allow-partial that would not accomplish much; it doesn't solve
the problems above.

For the online case we may want to attempt to download the full locale
extensions before copying to the USB, but that is for a later commit.

Fixes https://github.com/flatpak/flatpak/issues/3491
2020-06-15 10:08:34 +02:00
Ryan Gonzalez
f687f6b2eb run: Add --instance-id-fd 2020-06-09 13:51:02 +02:00
Matthew Leeds
a994cdb30e tree-wide: Replace usages of whitelist/blacklist
The terms whitelist and blacklist are hurtful to some people, and per
our code of conduct Flatpak is an inclusive community. Replace them with
allowlist and blocklist which are also more clear. This terminology
change is being implemented more broadly in the software industry; see
e.g. https://go-review.googlesource.com/c/go/+/236857/
2020-06-09 09:24:48 +02:00
Bartłomiej Piotrowski
6d9f9273c8 remote-add: Add --no-follow-redirect 2020-06-08 12:13:20 +02:00
Bartłomiej Piotrowski
5a82a599b1 remote-modify: Add --follow-redirect and --no-follow-redirect 2020-06-08 12:13:20 +02:00
Alexander Larsson
bfa71e208a Add FlatpakZstdDecompressor converter (and libzstd dep)
We will need this to decompress oci deltas.
2020-06-05 09:35:30 +02:00
Matthew Leeds
0ed5477a22 doc: Fix typo in build-update-repo page 2020-05-22 11:12:55 -07:00
Yiannis
e459703b38 Added flatpak remote-modify reference
`flatpak remote-modify --collection-id= ` can be use to set the collection ID of the remote server.
I spent quite a while trying to find how to set it, until I found this blog post:
https://blogs.gnome.org/mclasen/2018/08/26/about-flatpak-installations/
2020-04-01 23:08:20 +03:00
Alexander Larsson
b28271bb5e Merge pull request #3498 from alexlarsson/use-symlinks-for-sideload-config
Use symlinks instead of xa.sideload-repos config option
2020-03-30 16:03:54 +02:00
Alexander Larsson
bae8eef87d docs: Tweaks to sideload repo docs 2020-03-30 15:37:45 +02:00