Commit Graph

573 Commits (3ff6d312de1125e24ce958e3b31d49968bc73df1)

Author SHA1 Message Date
Mario Sanchez Prada 2e1740297c Report progress for extra data downloads, as we do for OSTree pulls
Otherwise, clients such as GNOME Software won't be able to report
any progress once the flatpak application has been downloaded and
we enter the stage to download the extra data.
2017-02-14 09:00:57 +01:00
Mario Sanchez Prada ca952b0f21 Use the thread's default context to download extra data, not a new one
Otherwise, all the progress reporting for the extra data being downloaded
won't work, as the main context used by OstreeAsyncProgress will not be
the same than the one from the nested main loop used to download this.
2017-02-14 09:00:57 +01:00
Alexander Larsson 521e7e6a37 Don't user user namespaces when bubblewrap is setuid
It turns out that it is impossible for to get ptrace capabilities
for child user namespaces in the current kernel if the user
namespace is created as root, which is what happens when bwrap
is setuid root (see https://github.com/flatpak/flatpak/issues/557
for details).

This is very problematic, as ptrace rights controls access to
/proc/$pid/root which is what we base the detection of peer
app id and rights on for portals.

For now, we disable user namespaces (except for the case of
unprivileged user namespaces, where it is necessary and works).
2017-02-13 15:03:00 +01:00
Alexander Larsson 08ea3baf49 builder: Download files and archives directly to disk, don't keep them in memory.
This works much better for larger sources.
2017-02-09 12:26:05 +01:00
Alexander Larsson bf316c1a82 builder: Compute SHA256 while downloading archives 2017-02-09 12:17:10 +01:00
Alexander Larsson 763a686d87 dri: Fix nvidia driver with shared network
If we have network access, then nvidia talks to the xserver
and for some reason it then also needs /dev/nvidia-modeset.
So, lets add that to the dri device list.
2017-02-08 16:43:14 +01:00
Alexander Larsson 02202b9e76 utils: Add flatpak_copy_bytes
This copies data from one fd to another.
2017-02-07 16:39:23 +01:00
Alexander Larsson 2e453048e0 extensions: Support enable/install-if=active-gl-driver
Only use/download this extension if it matches an active gl driver.
2017-02-03 09:49:05 +01:00
Alexander Larsson d4d15c7211 Initial flatpak_get_gl_drivers() implementation
This is supposed to list all the currently loaded "non-standard" gl drivers.
If FLATPAK_GL_DRIVERS is set, then that is used, otherwise it looks
for an nvidia driver and if so, uses that, and always adding "default"
at the end which is meant to resolve to a stable mesa fallback build, as
well as "host" which can be used if you have a host-side driver
as an unmaintained extension.
2017-02-03 09:48:16 +01:00
Alexander Larsson 160f3a9820 extensions: Handle priorities with merge-dirs 2017-02-03 08:17:22 +01:00
Alexander Larsson c88f1aa835 extensions: Support merge-dirs=list..
This causes the listed directories to become symlink farms
into all the subdirectory extensions.
2017-02-02 13:56:34 +01:00
Alexander Larsson 5e1d456b8b extensions: Support subdirectory-suffix=foo
If directory is "foo" and the extension id ends with ".ext" and
subdirectory-suffix is "sub" then the extension point will
be "/usr/foo/ext/sub" rather than just "/usr/foo/ext".

This is very useful when the extension point naming scheme is
"reversed". For instance, this happens for the /usr/share/themes directory.
An extension point for a gtk3 theme would be in /usr/share/themes/$NAME/gtk-3.0,
which could be achived by using subdirectory-suffix=gtk-3.0.
2017-02-01 19:59:12 +01:00
Alexander Larsson a3da0b3da8 extensions: Add add_ld_path property
If your extension points set this, then each extension will have
the corresponding subdirectory added to LD_LIBRARY_PATH.

We also support a priority property in the ExtensionOf group
in the extensions themselves to set the search order.
2017-02-01 19:46:25 +01:00
Alexander Larsson 7f8ad5b3a1 extensions: Make extension tmpfs requirement independent on order
If we sort, or subset the extensions we use, then we can't just
set need_tmpfs on the first one, instead do the checking
for the first one when we're applying the extensions.
2017-02-01 19:42:57 +01:00
Alexander Larsson 475dcb178a Support extra-data for runtime extensions too
This is very interesting for e.g. the nvidia drivers
2017-01-30 17:00:53 +01:00
Mario Sanchez Prada bfd43c1f98 Check if symlink target for /etc/localtime exists in the runtime
On unmonitored systems (if the session helper is not available), we
currently decide whether to create a symlink or a read-only bind mount
for /etc/localtime based on whether that's a symlink in the host or
not, but we don't check whether that symlink would be reachable in
the sandboxed environment, which might lead to bad situations.

This patch adds some extra checks relying on GFile's API to check
whether that symlink would be reachable before making the final
decision: if it's not, then do a bind mount despite of the file
being a symlink in the host.

https://github.com/flatpak/flatpak/issues/409
2017-01-30 14:35:04 +01:00
Mario Sanchez Prada 1d7357616b Don't ignore OSTree errors when fetching the extra-data sources
In extract_extra_data(), flatpak currently returns TRUE whenever
flatpak_repo_get_extra_data_sources() returns NULL, which is correct
most of the times since that's usually caused by the extra-data
finish-args argument not being present.

However, that operation relies on OSTree's ostree_repo_load_variant()
too, which could fail for unrelated reasons. And in those cases flatpak
would still keep returning TRUE here even in cases where the extra-data
sources could be there, but an error happened while retrieving it.

This seems to be a bug leading to unlikely -yet possible- situations,
where the user would end up with an "external app" like Spotify reported
to be succesfully installed but without the files/extra directory, which
is useless.
2017-01-30 12:25:39 +01:00
Alexander Larsson 84aed615da run: Fix e.g. --filesystem=xdg-config/foo without :create
Fixes https://github.com/flatpak/flatpak/issues/463
2017-01-27 10:43:59 +01:00
Alexander Larsson bc5ea57226 Run: Make sure all mounted sources are read-only
It turned out that some sources where bind-mounted read-write
which should have been read-only:

 * Extensions
 * Fonts
 * resolv.conf
 * localtime
 * machine-id

Many of these are not generally writable by the user, but
some are, which is pretty bad. For instance if the an
app is user-installed it will be able to write to its
locale data.

We fix this by using --ro-bind where needed.
2017-01-26 18:19:46 +01:00
Alexander Larsson ab446ebac5 Make /etc writable when building a runtime
We make /etc just a symlink to /usr/etc when we're building a runtime
and /etc is supposed to be writable. Otherwise the bind-mount we
normally have there don't allow use to replace existing files in /etc.
2017-01-25 15:28:42 +01:00
Alexander Larsson 0bea92bd73 dbus-proxy: Make it work if XDG_RUNTIME_DIR not set
The socket directory then ended up in $HOME which was read-only, so
we couldn't create the socket. We solve this by putting the sockets
in a subdirectory and always making this directory writable in the
proxy.
2017-01-23 18:27:00 +01:00
Matt Watson ee83b5a70d install: handle arch when installing from a flatpakref
Before this commit
$ flatpak install --arch someArch --from some.flatpakref
Would completely ignore the arch argument and only install for the
default flatpak architecture. Since flatpakref files don't include
an arch field, there's no reason we can't attempt to install the
arch specified on the command line.
2017-01-20 15:28:11 +01:00
Juan Pablo Ugarte cc0c6354a2 --device=dri added support for Mali drivers 2017-01-20 15:03:56 +01:00
Alexander Larsson c329e60d73 Create the homedir last to avoid symlink issues
If the homedir is on a symlink (say /home -> /var/home) but the homedir
is in /home, then we shouldn't create a directory in /home because
then the symlink creation will fail. Instead we move the homedir
creation to the end, where we will create it in the symlink if needed.

This should fix https://github.com/flatpak/flatpak/issues/493
2017-01-19 15:36:06 +01:00
Alexander Larsson 58a5e146d3 Run: Handle dependencies when exposing symlinks
If you are exposing a symlink, say /link (-> /target) and
also a child of it, say /link/child, then we run into dependency
issues. For instance, the /link symlink is created, pointing to /target,
but then we try to to create /link/child before the /target
bind mount is setup, which will fail.

We work around this by adding a level, and the dependency of a symlink
(/target in the above case) will always be handled first. This isn't
a perfect solution, but is likely to be good enough in practice.
2017-01-19 15:36:06 +01:00
Alexander Larsson b2c7137e73 run: Create symlinks as relative paths to make them work during bwrap setup
During setup the new root is in /newroot, so absolute symlinks don't work.
We make them realtive so that we can resolve the symlinks during setup.
2017-01-19 15:36:06 +01:00
Alexander Larsson 27031df5bf flatpak_resolve_symlink: Properly make paths absolute
We need to use g_build_filename, g_build_path takes a separator
as the first arg, not a path!
2017-01-19 15:36:06 +01:00
Alexander Larsson 592bea2b2e Don't break if exporting paths or symlinks to files in the runtime
For instance like in https://github.com/flatpak/flatpak/issues/494
if there is a /linuxrc -> /bin/busybox symlink, and /bin/busybox
is not in the runtime then we will fail creating it as a mountpoint
for the bind mount.

Fixes https://github.com/flatpak/flatpak/issues/494
2017-01-19 10:43:17 +01:00
Ikey Doherty 605c7ee87b Fix compiler warnings with uninitialised cleanup pointers
This change fixes GCC compiler warnings where a cleanup function was
specified on an uninitialised pointer, which in the view of GCC could
result in an errornous free of uninitialised memory, if the functions
that initialise them do not return NULL.

Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-01-19 10:05:13 +01:00
Alexander Larsson a2810186b8 appstream update: Allow component ids not ending in .desktop
This is needed for runtimes
2017-01-18 13:22:56 +01:00
Alexander Larsson 902fb71399 Use seccomp to filter out TIOCSTI ioctl
This would otherwise let the sandbox add input to the controlling tty.
2017-01-17 16:36:56 +01:00
Alexander Larsson 8152331bd0 Make sure /var/tmp is not on tmpfs
Apps may rely on /var/tmp not being in ram, for instance when
downloading large files. See for instance:

  http://0pointer.net/blog/projects/tmp.html

We make /var/tmp point to ~/.var/app/cache/tmp so that each app get
its own instane, and so that its cleared whe removing xdg-cache-dir
for the app.
2017-01-16 13:04:55 +01:00
Alexander Larsson 4e1bf67bff Print a warning if the remote metadata cache is not found 2017-01-12 10:45:44 +01:00
Joaquim Rocha 5dd952e68e Fix downloading extra data when run from a different thread
The main loop that is initiated while the extra data is being downloaded
needs a different context to be the thread-default one, otherwise the
operations just hang when running from a different thread.
2017-01-12 00:23:39 +01:00
Alexander Larsson 4c686332a3 OCI: Create all-readable layer blobs
Otherwise we can't export these via http
2017-01-11 22:37:26 +01:00
Alexander Larsson fed5cb3667 OCI: Stop using json-glib apis that don't exist in 1.0.x 2016-12-21 14:20:28 +01:00
Alexander Larsson f20e5f7823 bundles: Support dependencies and runtime-repo
If the bundle contains an origin link we can now install related
things from it, such as locale data.

You can also build the bundle with --runtime-repo=URL, where the url
points to a flatpakrepo file for a repo with runtimes. This works
similar to the RuntimeRepo= feature in flatpakref files.
2016-12-20 16:27:57 +01:00
Mario Sanchez Prada 82906a63bd Add support for the FLATPAK_CONFIG_DIR environment variable
This will be useful for testing purposes, so that we can provide
our own versions of the configuration files normally under
/etc/flatpak/installations.d.
2016-12-20 09:54:39 +01:00
Mario Sanchez Prada 15e7f14ca3 Adjusted internal representation for storage types of system installations
I set these as separate bits by mistake when there's no good reason for
them to be like that, as they are not flags that are meant to be combined,
but a list of exclusive values.
2016-12-20 09:52:03 +01:00
Alexander Larsson 5a12917a2f oci: Fix leak in flatpak_pull_from_oci 2016-12-19 14:19:41 +01:00
Alexander Larsson f92f233758 flatpak_bundle_load: Fix leak 2016-12-19 14:19:41 +01:00
Mario Sanchez Prada b704c385c8 Change file extension for installations configuration files to '.conf'
The old '.install' one was probably too specific, so let's move it to
a more generic (and common) extension before making the release.
2016-12-19 12:52:46 +01:00
Alexander Larsson 507e4dd355 flatpak_oci_registry_store_json: Don't leak GBytes 2016-12-19 11:16:27 +01:00
Alexander Larsson b066d863bc Remove unused variables 2016-12-19 10:08:18 +01:00
Mario Sanchez Prada ed1b0e2b23 Add internal API: flatpak_dir_get_name()
This will allow us to refactor some code using in the CLI, when
we want to print the name of a FlatpakDir for detailed listings.
2016-12-17 00:56:10 +00:00
Mario Sanchez Prada d3a9982837 Give the default system installation values for all its properties
This will allow explicitly referring to the default installation
using the 'default' ID, as well as overriding its values via a
configuration file specifying that same ID.
2016-12-17 00:56:06 +00:00
Mario Sanchez Prada 7962d4d145 Ignore system installations configured with a duplicated ID
If a system installation with the same ID than the one being
considered has been added, print a warning and ignore.
2016-12-17 00:32:53 +00:00
Mario Sanchez Prada a663e5ba73 Add public API: implement the other getters required by GNOME Software
Implemented the following functions along with the required internal APIs:

  * flatpak_installation_get_id ()
  * flatpak_installation_get_display_name ()
  * flatpak_installation_get_priority ()
  * flatpak_installation_get_storage_type ()
2016-12-17 00:32:53 +00:00
Mario Sanchez Prada 34cf626029 Support additional configuration fields for system installations
As per the discussion with GNOME Software maintainer Richard Hughes [1],
we need to support a few additional fields in the configuration files
for better integration with external clients. Thus, this commits adds
support for reading "DisplayName", "StorageType" and "Priority" values
from the configuration files, being all of them optional.

Note: priorities are currently used to sort the system installations
list statically stored in flatpak-dir.c (bigger number, bigger priority).

[1] https://mail.gnome.org/archives/gnome-software-list/2016-December/msg00000.html
2016-12-17 00:32:52 +00:00
Mario Sanchez Prada 719616f086 Add support for multiple installations in the system helper
Allow passing an extra string parameter specifying the ID of a
system installation to refer to it, or an empty string for the
default one.
2016-12-17 00:32:50 +00:00
Mario Sanchez Prada 81492a352a Migrate flatpak-<utils|transaction>.c to flatpak_dir_get_system_list()
We need to traverse now the full list of system directories, as
defined in /etc/flatpak/installations.d, not just the default one.
2016-12-17 00:32:45 +00:00
Mario Sanchez Prada 9d97382f82 Add internal API: flatpak_dir_get_system_by_id()
It will return a FlatpakDir by ID, according to the configuration.
2016-12-17 00:32:44 +00:00
Mario Sanchez Prada 1858b8987d Add internal API: flatpak_dir_get_id()
This will be used both from the CLI commands and the public API.
2016-12-17 00:32:44 +00:00
Mario Sanchez Prada d7de3225cc Store the ID for a FlatpakDir when reading the configuration files
This information will be used when querying system-wide installations,
so that we can refer to those pre-configured installations by the id
defined in the configuration files under /etc/flatpak/installations.d
2016-12-17 00:32:43 +00:00
Mario Sanchez Prada d27270635a Add internal API: flatpak_dir_get_system_list()
This will return an array of FlatpakDir instances with all the system
installations configured via key files in an optional drop-in directory
under FLATPAK_CONFIGDIR/installations.d, plus the default one.
2016-12-17 00:32:38 +00:00
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