Commit Graph

904 Commits

Author SHA1 Message Date
Alexander Larsson
d6911d9318 Remove unused variables
Closes: #1374
Approved by: alexlarsson
2018-02-05 14:31:30 +00:00
Alexander Larsson
3b1b9c65cd Move chunk of filesystem setup from flatpak-run.c to FlatpakContext
This way the filesystem setup is centralized in one place.

Closes: #1374
Approved by: alexlarsson
2018-02-05 14:31:30 +00:00
Alexander Larsson
38e2a5decc Rename some FlatpakContext functions
Since flatpak_export_paths_export_context and flatpak_exports_from_context
are now in flatpak-context.c we make them begin with flatpak_context_

Closes: #1374
Approved by: alexlarsson
2018-02-05 14:31:30 +00:00
Alexander Larsson
01156880dc Move flatpak_export_paths_export_context & flatpak_exports_from_context
These make more sense in flatpak-context.c, as they touch its FlatpakContext

Closes: #1374
Approved by: alexlarsson
2018-02-05 14:31:30 +00:00
Alexander Larsson
1230ee85cc Move FlatpakExport to its own file
This is pure code motion

Closes: #1374
Approved by: alexlarsson
2018-02-05 14:31:30 +00:00
Alexander Larsson
69d81df46f Add flatpak_exports_add_home_expose
This means we don't have to poke at exports internals

Closes: #1374
Approved by: alexlarsson
2018-02-05 14:31:30 +00:00
Alexander Larsson
8ef735369d Break out FlatpakBwrap to its own file
This is pure code motion

Closes: #1374
Approved by: alexlarsson
2018-02-05 14:31:30 +00:00
Alexander Larsson
eb692a9bb8 Move buffer_to_sealed_memfd_or_tmpfile to flatpak-utils.h
Closes: #1374
Approved by: alexlarsson
2018-02-05 14:31:30 +00:00
Alexander Larsson
71648bb1bf flatpak-run: Rename and expose some FlatpakExports functions
This is in preparation for moving the implementation to another file.

Closes: #1374
Approved by: alexlarsson
2018-02-05 14:31:30 +00:00
Alexander Larsson
58b25843b5 Add and use flatpak_context_allows_features
This lets us avoid directly dereferencing FlatpakContext

Closes: #1374
Approved by: alexlarsson
2018-02-05 14:31:30 +00:00
Alexander Larsson
0a09db6c1c flatpak-run: Use flatpak_context_get_needs_system_bus_proxy
Closes: #1374
Approved by: alexlarsson
2018-02-05 14:31:30 +00:00
Alexander Larsson
6296987a45 Move dbus filter argument generation to flatpak-context
Closes: #1374
Approved by: alexlarsson
2018-02-05 14:31:30 +00:00
Alexander Larsson
447a8d0537 Extract FlatpakContext to a separate file
This is basically a code motion only, no changes to behaviour.

Closes: #1374
Approved by: alexlarsson
2018-02-05 14:31:30 +00:00
Alexander Larsson
d745b14d60 Add flatpak_context_load_for_deploy()
Closes: #1374
Approved by: alexlarsson
2018-02-05 14:31:30 +00:00
Daniel Aleksandersen
1deff2544a common/table-printer: separate columns with tab in non-TTY stdout
Makes table output parsable for scripting.

Closes: #1354
Approved by: mwleeds
2018-02-02 16:17:06 +00:00
Robert McQueen
f73357cc5b extract_appstream: debug if an exported appstream is skipped
We had missing icons for a few apps due to this - if this ever happens
it means something very weird is going on with the export process in
a flatpak, so it's probably worth alerting the repo admin.

Closes: #1367
Approved by: pwithnall
2018-01-31 18:34:18 +00:00
Robert McQueen
6ab657b910 extract_appstream: allow component IDs not to end in .desktop
The appstream spec suggests that IDs should end in .desktop, but does
not require it. Make the repo appstream update process permit this
so that the appstream and icons are extracted correctly.

Closes: #1367
Approved by: pwithnall
2018-01-31 18:34:18 +00:00
Kalev Lember
bffca5733e common/dir: Fix a memory leak
Closes: #1369
Approved by: mwleeds
2018-01-31 18:03:16 +00:00
Alexander Larsson
858534069e Ignore unknown permission requests
When loading data from e.g. an installed app we ignore any permissions
it requests that we don't know about, rather than failing. This allows
us to later add permissions in an optional way. If the added permissions
are not optional you can use the flatpak-version key to request a specific
flatpak version that supports them.

Closes: #1362
Approved by: alexlarsson
2018-01-30 10:37:08 +00:00
Matthew Leeds
01fe49c66b common/dir: Fix typo in debug message 2018-01-29 00:57:10 -08:00
Iceyer
1cea02a2f6 common: Fix division by zero when calculate progress
Closes: #1331
Approved by: alexlarsson
2018-01-23 09:22:36 +00:00
Philip Withnall
7d1da19de2 common/dir: Add a missing OstreeAsyncProgress default key
oci_pull_init_progress() seems to set all the default keys wanted by
ostree_repo_pull_default_console_progress_changed() except the
caught-error key, which was added in OSTree commit 5c4f26bd65b492.

Add that key, just in case something queries for it (if it’s missing
when that happens, an assertion failure will be hit).

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1320
Approved by: cgwalters
2018-01-19 23:01:03 +00:00
Matthew Leeds
ee10c43b66 dir: Fix typos in comments 2018-01-15 22:54:27 -08:00
Philip Withnall
b148160986 common/dir: Use an actual function for autoptr support without P2P
When building with --disable-p2p, we create a stub type for
OstreeRepoFinderResult and OstreeRepoFinderResultv to avoid having to
add #ifdefs around all uses of them throughout the code base. We also
need to create autoptr functions for them so that the code can continue
to use g_autoptr(OstreeRepoFinderResult).

Previously, we were using `void` as the GDestroyNotify function for the
stub types. This wasn’t valid (it’s not a function), but it worked.

Since g_autolist() support has landed in GLib, this has broken. Fix it
by using a static inline no-op function as the GDestroyNotify function
instead. This should never be called, so exists purely to get things to
compile.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://github.com/flatpak/flatpak/issues/1279

Closes: #1293
Approved by: mwleeds
2018-01-04 19:34:19 +00:00
Matthew Leeds
ff3d2097ac dir: Fix a few comments 2017-12-27 18:07:41 -06:00
Alexander Larsson
85282668ec deploy: Create the binary wrappers after having rewritten the exports
Interestingly the telegram appid is "org.telegram.desktop", which means
the wrapper ends up having a .desktop extension which confuses the
desktop file exporter. We fix this by rewriting any exports before
creating the wrappers.

Fixes https://github.com/flathub/org.telegram.desktop/issues/18

Closes: #1270
Approved by: alexlarsson
2017-12-21 09:49:53 +00:00
Alexander Larsson
006a5f2ade Don't crash when installing bundles that have no embedded URIs
Closes: #1268
Approved by: alexlarsson
2017-12-21 08:33:46 +00:00
Philip Withnall
89243b1d9c common/dir: Don’t ignore errors when marking dir as changed
Coverity CID: 1462265

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1267
Approved by: alexlarsson
2017-12-20 13:03:37 +00:00
Philip Withnall
0afa7acf9b common/dir: Don’t ignore errors replacing a file on undeploy
Emit a warning about them rather than ignoring them entirely.

Coverity CID: 1376554

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1267
Approved by: alexlarsson
2017-12-20 13:03:37 +00:00
Philip Withnall
955fbc29bf common/dir: Fix various big and small leaks
Some of these were leaking entire file contents, or the whole of
xa.metadata.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1259
Approved by: mwleeds
2017-12-19 07:12:28 +00:00
Alexander Larsson
64f82ec956 Create and export wrappers for apps
This creates a $flatpakdir/exports/bin directory that contains wrappers
for all active installed applications, named by the application id.

If you add these directories to you $PATH, then this means you can more
easily launch flatpak apps on the commandline.

Closes: #1254
Approved by: alexlarsson
2017-12-15 09:53:28 +00:00
Alexander Larsson
fdd0660379 Never export anything for runtimes
It doesn't really make sense for a runtime to export anything, so
lets just enforce that. Note, this is not necessary a security
issue, because anything exported from runtimes were rewritten
just like apps. It just enforces the expected behaviour of
runtimes.

Closes: #1254
Approved by: alexlarsson
2017-12-15 09:53:28 +00:00
Alexander Larsson
6e17756db6 install: Handle passing a file: uri as remote
Closes: #1244
Approved by: alexlarsson
2017-12-14 09:27:22 +00:00
Alexander Larsson
cd0230e117 common: Expose flatpak_dir_prune_origin_remote
Also make it work with the system helper.

Closes: #1244
Approved by: alexlarsson
2017-12-14 09:27:21 +00:00
Alexander Larsson
b00e6b661f Reuse origin remote if all the details match
Closes: #1244
Approved by: alexlarsson
2017-12-14 09:27:21 +00:00
Alexander Larsson
3ade86b292 install: Add --reinstall
If you're installing something and its already installed, we undeploy
the old install first before deploying the new. This makes it very
easy to switch an application from one remote to another, without
having to uninstall first, which is both painful and could cause
the download to be unnecessary large.

Closes: #1241
Approved by: alexlarsson
2017-12-14 09:04:38 +00:00
Alexander Larsson
97683cfbe1 override: Support global overrides
This lets you add overrides that affect all applications. Application
overrides have higher priority so will override the global overrides.

Closes: #1245
Approved by: alexlarsson
2017-12-14 08:49:23 +00:00
Alexander Larsson
9aa9825874 run: Properly save --nofilesystem metadata
This means that if you e.g. do
  flatpak run --filesystem=home --nofilesystem=~/foo

Then /.flatpak-info will contain:
filesystems=home;!~/foo

This also makes overrides with --nofilesystem work,
fixing https://github.com/flatpak/flatpak/issues/1232

Closes: #1245
Approved by: alexlarsson
2017-12-14 08:49:23 +00:00
Alexander Larsson
3a99ef46a3 run: Handle --nofilesystem properly
Currently --nofilesystem just means that we undo a similar --filesystem,
so --filesystem=~/foo/bar --nofilesystem=~/foo/bar means we can access foo.
If you did --filesystem=~/foo --nofilesystem=~/foo/bar then the later
would have no effect.

We now handle this by giving access to foo, but hiding bar beneath it.

Closes: #1245
Approved by: alexlarsson
2017-12-14 08:49:23 +00:00
Alexander Larsson
403a7a7518 common: flatpak_dir_check_for_appstream_update
Closes: #1248
Approved by: alexlarsson
2017-12-14 08:20:34 +00:00
Alexander Larsson
13db7f0474 common: Add flatpak_dir_has_remote()
Closes: #1246
Approved by: alexlarsson
2017-12-13 10:03:47 +00:00
Alexander Larsson
81f4802434 Fix kde reading kdeglobals
We regressed on supporting --filesystem=xdg-config/kdeglobals:ro which
would create a "kdeglobals" in the apps own XDG_CONFIG_DIR which has
content from the host one. This broke in
f1df5cb1d9
where we added a symlink resolve, but that breaks when the target file
doesn't exist.

It seems like all callers rely on just the final element of the destination
path being created, so lets just resolve symlinks on the dir part.

Closes: #1229
Approved by: alexlarsson
2017-12-06 10:08:07 +00:00
Matthew Leeds
bc2534fbd5 common: Fix memory leak in flatpak_number_prompt
Closes: #1206
Approved by: alexlarsson
2017-11-28 14:35:46 +00:00
Patrick Griffis
3b78dc66c3 Add "have-intel-gpu" check, useful for VAAPI extension
Closes: #1198
Approved by: alexlarsson
2017-11-24 11:17:47 +00:00
Alexander Larsson
6bb0196ffd Make flatpak remote-add --system work with an empty /var/lib/flatpak
This means flatpak can bootstrap itself from an empty /var on stateless
systems, which fixes https://github.com/flatpak/flatpak/issues/113, at
least for the CLI case.

Closes: #1195
Approved by: alexlarsson
2017-11-24 10:54:25 +00:00
Alexander Larsson
742913856e common: Add flatpak_dir_maybe_ensure_repo
This tries to ensure that FlatpakDir->repo is set, but if the
repo doesn't exists and we're unable to create it that is fine
and we continue running with repo == NULL.

This is useful because there are only a few operations that really
are useful/make sense with no repo set up, and we can ensure these
handle this well.

In particular, we want to allow flatpak remote-add using the
system-helper to work even if /var/lib/flatpak doesn't exist, so that
we can bootstrap a working flathub from a fresh /var.

Closes: #1195
Approved by: alexlarsson
2017-11-24 10:54:25 +00:00
Alexander Larsson
2c41aa5203 Use systemwide config also when running as root
We want to look for remotes in /etc/flatpak also when not
using the system helper

Closes: #1195
Approved by: alexlarsson
2017-11-24 10:54:25 +00:00
Alexander Larsson
9eedc60cd2 run: Expose /usr and /etc if --filesystem=host
Some apps, such as gnome-builder wants to access data from the
host, for instance in builders case the system includes. If you
have full filesystem access it is not really a loss of security
to also have /ect and /usr access, but for technical reasons
we can't expose them in the normal locations. However, we
can expose them in /run/host, so do that.

Closes: #1193
Approved by: alexlarsson
2017-11-24 10:47:36 +00:00
Alexander Larsson
0a9ae464f6 Add remote-info command
This shows information about a ref in a remote. Of particular interest
is the --log option which gives you a history which can be used
with update --commit=XXX to roll back an update.

Closes: #1174
Approved by: alexlarsson
2017-11-21 11:16:06 +00:00
Alexander Larsson
a026da8027 Add flatpak_dir_fetch_remote_commit
Closes: #1174
Approved by: alexlarsson
2017-11-21 11:16:06 +00:00