Commit Graph

468 Commits

Author SHA1 Message Date
Mario Sanchez Prada
22e3f83fb6 Remove internal API flatpak_dir_get(gboolean user)
User and system installations is no longer a binary decision, so remove
this API to force explicit calls to either flatpak_dir_get_system_default()
or flatpak_dir_get_system_list() when dealing with system installations.
2016-12-16 19:17:18 +00:00
Mario Sanchez Prada
44a2d73c98 Rename flatpak_get_system_base_dir_location(void) for the default case
It will be called flatpak_get_system_default_base_dir_location() now, to
distinguish it from the one that retrieves all the system directories.
2016-12-16 19:17:16 +00:00
Mario Sanchez Prada
521c3fcd4b Rename flatpak_dir_get_system() into flatpak_dir_get_system_default()
There will be a way to retrieve the list of all system installations,
not just the default one, so we rename this for backward compatibility.

Note that some (most?) of the places where we will be now using this
renamed function will likely have to migrate to using specific system
installations, but we don't have the necessary APIs yet so we do this
as an initial step to all the incremental changes that will come next.
2016-12-16 19:17:13 +00:00
Alexander Larsson
e1bf3eff52 Flatpak[ref|repo]: Add Version field
If this is set it has to be 1, or we fail.
This lets us later introduce incompatible changes.
2016-12-13 15:54:14 +01:00
Alexander Larsson
f3b188cef3 flatpak-json: Correctly handle NULL in json_to_node 2016-12-13 13:52:09 +01:00
Alexander Larsson
da897250cc Avoid interactive prompts when redirected, assume no 2016-12-13 11:45:16 +01:00
Alexander Larsson
1e854ddc11 Fix all clang warnings 2016-12-13 10:20:28 +01:00
Alexander Larsson
c756534b19 utils: Add and use FLATPAK_VARIANT_DICT_INITIALIZER
This fixes warnings on some versions of glib due to a private struct
change.
2016-12-13 10:08:26 +01:00
Alexander Larsson
9ddc4aca48 Support flatpak install --oci to install apps from OCI 2016-12-12 16:22:16 +01:00
Alexander Larsson
53c28de636 utils: Add VARIANT_BUILDER_INITIALIZER and new_empty_string_dict 2016-12-12 12:23:13 +01:00
Alexander Larsson
cf0cd287c6 Add flatpak_table_printer_add_column_len 2016-12-12 12:22:50 +01:00
Alexander Larsson
aa9640af7e Add flatpak_pull_from_oci helper 2016-12-09 14:44:25 +01:00
Alexander Larsson
63c1aace83 Import OCI initial support to common/* 2016-12-08 17:43:03 +01:00
Alexander Larsson
186ff0f002 Add flatpak_download_http_uri util function 2016-12-08 16:41:20 +01:00
Alexander Larsson
9865ed8989 utils: Disable automatic gzip content decoding in session
This was interacting badly with the OCI layer downloading, by
automatically uncompressing the gzip:ed layers.
2016-12-08 16:41:20 +01:00
Alexander Larsson
e514dc2e14 Add flatpak_create_soup_session 2016-12-08 16:41:20 +01:00
Alexander Larsson
d3715463f2 Don't export symlinks from the host into /usr and /app
These make no sense, we don't want to modify the runtime, and
we can't create parent directories there anyway which can cause
issues like https://github.com/flatpak/flatpak/pull/433
2016-12-07 19:50:14 +01:00
Alexander Larsson
efc8458165 run: Record in the flatpak-info file if dbus is proxied 2016-12-07 11:31:45 +01:00
Alexander Larsson
c5856dd4e5 run: Fix xauth support
We need to lseek the fd *after* the fclose has
flushed the output.
2016-12-07 11:18:27 +01:00
Alexander Larsson
bb6e1d535f install: Support RuntimeRepo= key in flatpakref files
This allows an app to point to the repo where the runtime it uses
comes from, and the user will be asked to add that if its not
already configured.
2016-12-02 16:31:14 +01:00
Alexander Larsson
8a152b7bb0 dir: Make flatpak_dir_remote_fetch_summary error if there is no summary
This was manully checked in some places, which can now be dropped, but
also the places that didn't check it before were buggy and needed
to check this, so better just fail early.
2016-12-01 09:39:57 +01:00
Alexander Larsson
6a5d6d4970 Json autoptr stuff was added in 1.1.2, not 1.2.0 2016-11-30 11:30:40 +01:00
Alexander Larsson
31ca19eb99 pull: Exit early on error without aborting transaction
At this point we have not set up repo yet, so aborting would crash.
2016-11-29 16:59:48 +01:00
Alexander Larsson
b744cd2493 Add backport of g_autoptr support for json-glib 2016-11-29 10:14:33 +01:00
Alexander Larsson
ddb40187c6 Fix various leaks found by valgrind 2016-11-28 15:17:04 +01:00
Alexander Larsson
c7776d0a6f Require new ostree and drop old workaroung
OSTree 2016.4 fixes the scanning and purging issues that
forced us to do a double-pull during sudir installs.
2016-11-28 12:25:59 +01:00
Mario Sanchez Prada
8193b9f282 Extra checks mounting /etc/{resolv.conf|localtime} without session helper
When no session helper is available (e.g. running flatpak run from a
socket-activated service unit), we need to be extra careful before
making these two files appear inside the sandbox. Otherwise, if they
are not reachable on the host system (or just symlinks to non-existent
targets), flatpak won't be able to create the sandbox, which will fail
due to a "No such file or directory error".

https://github.com/flatpak/flatpak/issues/409
2016-11-25 08:46:48 +01:00
Alexander Larsson
cc36dbcbbf run: Allow --filesystem=foo to expose sockets
We already kind of support this by exposing the parent directory,
so this isn't really less secure, and you should not be able to
access it unless your user is allowed to anyway.
2016-11-22 11:39:58 +01:00
Alexander Larsson
60b8a0eb47 run: Make /var/run symlink relative
This lets it work during early setup phase when the new root is at
/newroot. This allows us to create things in /var/run with
e.g. --filesystem=/var/run/foo.
2016-11-22 11:37:45 +01:00
Alexander Larsson
ca99d5be58 build-init: Give error if initializing with a partial dependency
If you're building a runtime and have a base runtime with expected
extensions, fail to build if the actually installed extension is
partial (i.e. if it has a subdir specified).

Fixes https://github.com/flatpak/flatpak/issues/390
2016-11-15 11:11:00 +01:00
Alexander Larsson
2acb3f81a5 Special handling of accesible XDG_XYZ_HOME subdirs
If the app is explictitly given access to a subdirectory of
one of the xdg config/cache/data directories, with read-write
(or create) access, then also bind-mount that directory
into the corresponding .var/app/$APPID directory.

This allows apps that want it to keep re-using global directories
for storing per-app information.

For instance, if your app uses "~/.config/foo" to store configuration
data, then you can use --filesystem=xdg-config/foo, which will look
for the directory, and if it exist, let the app access it, as well
as mirror the content in ~/.var/app/$appid/config/foo.

You can also use a ":create" to enforce the directory to be created
and thus always do the mapping.
2016-11-14 18:58:44 +01:00
Alexander Larsson
a07a146827 Allow filesystem options for xdg-[config,cache,data] for the regular xdg dirs
This means you can give access to e.g. ~/.config/dconf as --xdg-config/dconf
which then also respects XDG_CONFIG_DIR settings.
2016-11-14 18:58:44 +01:00
Alexander Larsson
2dd9b8627a Add support for --filesystem=XXX:create
This means the same as XXX:rw, but if the location doesn't exist
a directory is created there.
2016-11-14 18:58:44 +01:00
Alexander Larsson
b19ea63526 By default, hide the user flatpak directory
This way you can't e.g. modify your or other applications
and runtimes. If you really need to to this, your
app can explicitly request access to this directory.
2016-11-14 18:58:44 +01:00
Alexander Larsson
e1d1a29a6f run: Hide ~/.var/app (except your dir)
Unless you specifically set --filesystem=~/.var/app you will not
have any access to files from other apps
2016-11-14 18:58:44 +01:00
Alexander Larsson
e32612f1c9 Handle bind-mounts of locations that are symlinks
If we're specifying --filesystem=/some/path, where the final element
in the path is a symlink we need to special case this. We used
to rely on bubblewrap resolving the symlink for the source and
creating a bind mount directly to that, but this does not work
if the parent directory is already visible in the sandbox, because
we can't bind-mount on top of the pre-existing symlink.

Instead we detect this the symlink early, resolve the target and
bind mount in that, then we create a real symlink in its place.
However, that doesn't work if the paren't *doesn't* exist, so
we have to check for this and not create the symlink if it is
already going to be visible in the sandbox.
2016-11-11 22:21:07 +01:00
Alexander Larsson
18ad54b4a0 utils: Add utils to read and resolve symlinks 2016-11-11 22:17:56 +01:00
Alexander Larsson
e175774d35 flatpak_run_add_x11_args: Only use tmp_fd inside != -1 check 2016-11-11 10:59:00 +01:00
Alexander Larsson
9a2e68406c flatpak_number_prompt: Add missing va_end 2016-11-11 10:44:11 +01:00
Alexander Larsson
6c0fd7d16c flatpak_yes_no_prompt: Add missing va_end 2016-11-11 10:43:27 +01:00
Mario Sanchez Prada
472150fa6c Don't modify remotes when updating metadata when there are no changes
This avoids an unnecessary call to flatpak_dir_modify_remote() or to
the system helper's D-Bus method ConfigureRemote, which also prevents
bothering the user to authenticate via PolKit for no reason.
2016-11-09 15:01:57 +01:00
Mario Sanchez Prada
ca581ad6a1 Integrate flatpak_dir_update_remote_configuration() with the system helper
Add logic in flatpak_dir_update_remote_configuration() so that the step of
configuring the local remotes after fetching the required date from the
server's summary file is performed via the system helper when present.

Note this will require the user authorizing the action by introducing
the password explicitly when asked, but this is necessary as updating
the local remotes configuration is something that can't be allowed
without explicit authentication.
2016-11-09 15:01:57 +01:00
Matthias Clasen
a180d067ad Avoid a crash during update --appstream
It turns out that flatpak_dir_remote_fetch_summary can return TRUE,
yet leave summary_bytes NULL. The code further down does not deal
gracefully with summary_bytes being NULL, so error out early instead
of crashing.
2016-10-31 14:03:47 +01:00
Alexander Larsson
a709be6021 install --from: Try to reuse existing remotes
We don't really need to create an origin remote if the same
uri is already there for an enumeratable remote, we can
just reuse that. Having multiple remotes for a single
repository just means we'll be downloading the summary file
multiple times.
2016-10-27 10:18:47 +02:00
Matthew Leeds
2641504d5b common: Don't segfault w/o org.freedesktop.Flatpak.SystemHelper
Without this patch flatpak-remote-add (and anything else that uses this
section of code) segfaults if org.freedesktop.Flatpak.SystemHelper is
unavailable because it tries to cast an integer to a GDbusProxy.
2016-10-27 08:18:59 +02:00
Alexander Larsson
339a130e50 Sort available branches in "multiple branches available" message 2016-10-26 08:46:51 +02:00
Alexander Larsson
81c55d752a Add backport of SoupRequestHTTP autoptr support 2016-10-25 16:14:44 +02:00
Alexander Larsson
95bab6cd91 common: Minor whitespace cleanup 2016-10-25 10:29:51 +02:00
Jan Jedelský
47e9283450 Add support for unmaintained extensions (#361)
See https://github.com/flatpak/flatpak/issues/167
2016-10-25 10:25:15 +02:00
Alexander Larsson
6f1709c849 install: Show entire ref in the multiple-branches error message 2016-10-24 15:34:59 +02:00