Commit Graph

604 Commits

Author SHA1 Message Date
Matthias Clasen
153dd18a7d Implement file forwarding for flatpak_run_app
Add a flag that triggers extra processing of the 'rest'
commandline arguments, as follows: When we see arguments
that are enclosed in a pair of '@@' arguments, we interpret
them as file paths, export them in the document store, and
pass the resulting document path to the launched application.

Currently, the files are exported non-persistent (i.e. only
for the current session), and with read and write permissions
for the app.
2017-05-03 13:27:52 +02:00
Matthias Clasen
75b84b4bfe Include the generated document portal code in common
Move the sources from app/ to common/. We will use this
code from common/ in subsequent commits.
2017-05-03 13:27:52 +02:00
Alexander Larsson
6711b56794 Unset TMPDIR in the sandbox
Its quite possible that a custom TMPDIR is not mapped
in the sandbox, and /tmp is per-app anyway, so it doesn't
really make sense to use the custom one.

Fixes https://github.com/alexlarsson/spotify-app/issues/41
2017-05-03 13:25:35 +02:00
Matthias Clasen
e76761e827 Don't crash if there's more titles than columns
This was crashing when running flatpak list for
an empty installation.
2017-05-03 12:40:14 +02:00
Alexander Larsson
fb6695e9a4 Add macros for common ANSI tty escape codes 2017-05-03 11:17:41 +02:00
Matthias Clasen
ea93b3977d table printer: Use localeconv for decimal point
This gives us a chance of working correctly in exotic locales.
2017-05-03 11:06:43 +02:00
Matthias Clasen
5635adea29 Add table printer api for number columns
This is better than open-coding the decimal point
check in all the callers.
2017-05-03 11:06:43 +02:00
Matthias Clasen
b07240f525 Use the new output helper
Instead of open-coding isatty(), use flatpak_fancy_output().
2017-05-03 11:06:43 +02:00
Matthias Clasen
ecc90b95e7 Add a helper for formatted output
For now this just uses isatty(), but we might
allow overriding this with an environment variable
in the future.
2017-05-03 11:06:43 +02:00
Joaquim Rocha
de2c6cc85b Add the possibility of installing/updating without static deltas
Sometimes we need to pull a commit without using static deltas to e.g.
make sure that an app with a corrupted commit can still be updated by
pulling the new commit in full.

This option has been added to the FlatpakUpdateFlags,
FlatpakInstallFlags, as well as a parameter for the CLI.
2017-05-02 15:05:48 +02:00
Matthias Clasen
70a56f9d60 Add an API to get the summary of a remote
This will be used by flatpak remote-ls in subsequent commits.
2017-05-02 15:00:07 +02:00
Matthias Clasen
62b8ae2953 table printer: move to its own source files
This is a pretty standalone object, and it is nicer to
have it in its own files. All users have been updated
to include the new flatpak-table-printer.h header.
2017-05-02 14:56:04 +02:00
Matthias Clasen
1998acb18e table printer: Only show titles on ttys
Avoid showing column titles unless stdout is a tty.
2017-05-02 14:56:04 +02:00
Matthias Clasen
be92e4aa7e table printer: Support column titles
Add an api to set column titles, and format them in bold.
2017-05-02 14:56:04 +02:00
Matthias Clasen
2a5ce5a05e table printer: Support column alignment
Add support for aligning columns at a certain position.
This will be used to line up numbers at the decimal point,
in future commits.
2017-05-02 14:56:04 +02:00
Matthias Clasen
fbcaf05362 table printer: Introduce a cell struct
No functional change here, simply some data structure reorg,
so we can have more data for each cell in the future.
2017-05-02 14:56:04 +02:00
Colin Walters
c50648a594 libglnx: Bump to latest master, use new file copy API
The new `glnx_regfile_copy_bytes()` is better than the previous
`flatpak_copy_bytes()` in that it will use reflink/sendfile if available.

More information in 3a4d0f4684
2017-04-28 10:04:22 -04:00
Georges Basile Stavracas Neto
0007edb7bd Ensure commits are available when checking for extra-data
After the introduction of linear progress reports based on
heuristics, Flatpak still couldn't make precise reports for
the extra-data field is contained in the commits. When we
were setting extra-data up, Flatpak didn't have the commits,
so it always failed.

Fix that by downloading the commits first, and then setting
up the extra-data fields.

flatpak/flatpak#609
2017-04-27 17:21:29 +02:00
Rafael Fontenelle
09c070f667 flatpak-run.c: valid locations, not types
Some previous g_set_error messages were related to 'unknown type', but this one about 'unknown location'. So it would probably be best to suggest 'valid locations', instead of 'valid types'.
2017-04-27 17:20:40 +02:00
Alexander Larsson
8b13d3c5ee builder: Add progress reporing while downloading 2017-04-24 21:23:46 +02:00
Alexander Larsson
47062137a5 fixup! common: Add flatpak_build_file[_va] helper 2017-04-24 12:23:20 +02:00
Alexander Larsson
4a60c87958 common: Add flatpak_build_file[_va] helper
This makes it easy to construct GFiles
from a base dir and an argument list
of child elements.
2017-04-24 09:02:33 +02:00
Alexander Larsson
b8cd12930a Report full version in http user agent
https://github.com/flatpak/flatpak/issues/635
2017-04-19 20:47:57 +02:00
Alexander Larsson
fe56c08203 build: Always set personality to linux32 when cross-building
This means that autodetection during builds works much better.
Fixes https://github.com/flatpak/flatpak/issues/712
2017-04-19 19:36:55 +02:00
Alexander Larsson
7da0726514 build: Ensure we add the default dbus permissions
When using flatpak build, use the same default dbus
permissions (portal.*) as we do in flatpak run.

Fixes https://github.com/flatpak/flatpak/issues/717
2017-04-19 16:55:01 +02:00
Jonas Ådahl
a1ff20ca0e run: Handle non-default WAYLAND_DISPLAY
WAYLAND_DISPLAY can be other than "wayland-0" for various reasons, such
as using a custom Wayland display server or the session display server
using a custom display name.

Note that for xdg-desktop-portal to support showing portal windows, the
xdg-desktop-portal service MUST use the same WAYLAND_DISPLAY.
2017-04-17 13:55:33 +08:00
Matthias Clasen
0824fc830a Fix a typo in a comment
This comment was obviously copy-pasted from
the previous case without updating it.
2017-04-14 14:21:28 -04:00
Alexander Larsson
b426306884 appstream: Don't strip .desktop extension if thats the actual id
The telegram app is org.telegram.desktop, so we can't assume
the id in the appstream data that ends in .desktop is just a desktop
file extension.
2017-04-12 09:40:04 +02:00
Simon McVittie
646b4c468b Use correct format string for guint64 on 32-bit
Signed-off-by: Simon McVittie <smcv@debian.org>
2017-04-04 12:17:28 +02:00
Emmanuele Bassi
8bbcf0b23b Use ostree's BARE_USER_ONLY flag (#674)
* Use ostree's BARE_USER_ONLY flag

Now that Ostree has a 'bare user only' mode for repositories, we should
use it.

This allows installing Flatpak run times inside different Docker layers.

Original patch by: Alexander Larsson <alexl@redhat.com>
Tested-by: Emmanuele Bassi <ebassi@gmail.com>

* Use the parent mode when creating a child repo

Instead of hard coding the repository mode, query the parent's mode.

* Gate bare-user-only repo creation behind an environment variable

We keep the default of bare-user repositories, but with an environment
variable we change new repositories to bare-user-only.
2017-04-03 16:31:18 +02:00
Alexander Larsson
0dcc7332f7 Handle uris better when detecting .flatpak[repo,ref] suffix
We fully parse the argument as (possibly) a uri, which means
we can handle an argument like:
 https://git.gnome.org/browse/gnome-apps-nightly/plain/gnome-builder.flatpakref?h=stable

Which doesn't work with a simple has_suffix call.
This is important because the flatpak.org site now references
these kinds of uris.

Fixes https://github.com/flatpak/flatpak/issues/659
2017-04-03 10:02:28 +02:00
Alexander Larsson
3ff6d312de update: Only allow downgrades if a commit is explicitly specified
If you run "flatpak update" then we will never update to
a commit that is older than the currently installed one. This
protects against a man-in-the-middle attack that would otherwise
let the attacker downgrade to a previously signed version that
may have some vulnerability.
2017-04-03 09:45:45 +02:00
Alexander Larsson
266b9cb6f0 system-helper: Fix check for downgrade
We never want the system-helper to downgrade. If you want to run
not-the-latest version you need to be "real root". However, the
check for this was broken, as it compared the new commit with the
new commit, which was always ok. Instead check the timestamp
on the new commit with the current one.
2017-04-03 08:53:44 +02:00
Alexander Larsson
41d9717113 Fix unused variable errors reported by clang 2017-03-30 10:01:24 +02:00
Alexander Larsson
f42a4d735b Fix ostree autoptr checks for git master
The export g_autoptr changes in ostree will be in the release 2017.4,
but the gnome CI is currently failing due to them also being in current
git master which is called 2017.3 atm. We fix this by checking against
2017.3 instead, which is safe, because the actual OSTREE_CHECK_VERSION
macro was added after the 2017.3 release too.
2017-03-30 10:01:24 +02:00
Colin Walters
d40df323b4 utils: Prepare for libostree 2017.4 defining autocleanups
See: https://github.com/ostreedev/ostree/pull/756
2017-03-29 21:06:09 +02:00
Alexander Larsson
7a6a109720 OCI: Fix signature checks on updates
We can't support updating to a specified digest, we must
always look in the index so that we can find the signature.
2017-03-29 18:04:13 +02:00
Alexander Larsson
5b0ad227e8 OCI: Verify signatures 2017-03-29 17:14:36 +02:00
Alexander Larsson
a7216cedd2 OCI: Add json format for atomic-based signatures 2017-03-29 17:14:36 +02:00
Alexander Larsson
5aeec78311 OCI: Add support for strict and mandatory json properties
Strict means there must be no unknown properties, and
mandatory means a property must be in the json object.
2017-03-29 17:14:36 +02:00
Alexander Larsson
ea803f1f80 OCI: Add flatpak_oci_sign_data 2017-03-29 17:14:36 +02:00
Alexander Larsson
b5c6140c58 update: Don't check for update short-circuit if we're not pulling
There is no need to do this, its just a waste of network bandwidth.
2017-03-29 17:14:19 +02:00
Alexander Larsson
11943e7e40 OCI: Support OCI with system-helper by mirroring OCI repo
This allows us (when we later add signatures) to verify
the signatures of the OCI manifest, and can thus support
the system-helper.
2017-03-29 17:14:19 +02:00
Alexander Larsson
759eee8cea OCI: Verify layer checksum while applying
This means we verify the exact data we use, which is
what was signed. In particular, this means in the
system-helper we don't open us up to the user
manipulating the file while it is being applied.
2017-03-29 17:14:19 +02:00
Alexander Larsson
980bd48f0e OCI: flatpak_pull_from_oci - verify manifest ref
This ensures the actual manifest ref matches what was specified
in the index. This is required as the goal is to sign/trust
the manifest, but not necessarily the index.
2017-03-29 17:14:19 +02:00
Alexander Larsson
c81e115bb2 OCI: Add flatpak_archive_read_open_fd_with_checksum
This will let us do the layer sha256 checksum during
layer apply, which means we don't read it multiple times,
and that its not modified inbetween.
2017-03-29 17:14:19 +02:00
Alexander Larsson
8b01230673 OCI: Add flatpak_oci_registry_mirror_blob
This lets you mirror a blob from a (possibly remote)
OCI registry into a local one. This will be the base
for the system-helper work for OCI.
2017-03-29 17:14:19 +02:00
Alexander Larsson
4a8d77d9af OCI: fstat in local_open_file helper
This verifies that all files are regular,
and avoid each caller having to fstat themselves.
2017-03-29 17:14:19 +02:00
Alexander Larsson
d39491b5fb oci: Break out get_digest_subpath helper function 2017-03-29 17:14:19 +02:00
Alexander Larsson
cac65fb6a1 FlatpakDir: Break out helper flatpak_dir_lookup_ref_from_summary
This just extracts some shared code into a helper funcion
2017-03-29 17:14:19 +02:00