Commit Graph

573 Commits (3ff6d312de1125e24ce958e3b31d49968bc73df1)

Author SHA1 Message Date
Alexander Larsson 90c909a932 Fix clang warnings 2016-05-13 16:26:47 +02:00
Alexander Larsson 1504f7bd7f system-helper: Support add/modify/delete of remotes 2016-05-13 16:23:43 +02:00
Alexander Larsson 2875cdead5 remote-delete: Move to FlatpakDir and add checks for installed refs
You can't remove a remote unless you --force or there are no installs
from it.
2016-05-13 14:17:46 +02:00
Alexander Larsson 753cdc97fd Fix typo: flatpak_dir_modify_remove -> flatpak_dir_modify_remote 2016-05-13 13:59:48 +02:00
Alexander Larsson 392f80a4aa FlatpakDir: Add in-memory summary cache
Remote summary files are cached for 5 minutes.
2016-05-13 13:15:45 +02:00
Alexander Larsson fa6e6c51ef Duplicate ostree_repo_remote_list_refs in FlatpakDir
This way we can later add a local summary cache to it.
2016-05-13 11:32:40 +02:00
Alexander Larsson 0098164cd6 Register dbus errors for FLATPAK_ERROR
This allows us to transparently pass them from the system helper.
2016-05-12 22:03:42 +02:00
Alexander Larsson 29390fff39 Change portal error names to not contain Flatpak 2016-05-12 22:03:09 +02:00
Alexander Larsson 5407b8efc6 system-helper: Support uninstall 2016-05-12 21:23:36 +02:00
Alexander Larsson 3964504438 Fix triggers with installation dir on a symlink 2016-05-12 21:16:40 +02:00
Alexander Larsson fe0a1be5f8 common: Add flags for flatpak_dir_uninstall
This is better than a list of booleans.
2016-05-12 19:52:48 +02:00
Alexander Larsson c5e178f339 Use flatpak_dir_uninstall for app and lib 2016-05-12 17:18:14 +02:00
Alexander Larsson 712fc9fc08 Use the installed/not-installed errors more consequently 2016-05-12 17:17:27 +02:00
Alexander Larsson 2ef6d9d5d9 common: Remove FlatpakDirError in favour of FlatpakError from the lib 2016-05-12 16:43:16 +02:00
Alexander Larsson e23bc2b7a6 Move flatpack_error quark to common so that the common code can use it 2016-05-12 16:33:48 +02:00
Richard Hughes 5ff8a00078 Show the error when we fail to build AppStream metadata 2016-05-12 11:07:30 +02:00
Alexander Larsson 14f58fc4b9 system-helper: Fix timeout setting 2016-05-12 09:14:30 +02:00
Alexander Larsson 9c01fb93aa system-helper: Set infinite timeout when doing system-helper calls 2016-05-12 08:59:25 +02:00
Alexander Larsson 47bb7e2b2e Don't fail if there is no user-dirs.dirs
Based on patch from tristan

https://bugs.freedesktop.org/show_bug.cgi?id=95339
2016-05-12 08:45:40 +02:00
Alexander Larsson 9e4bb25b2c modify-remote: Move the actual config rewriting to FlatpakDir
This is in preparation for doing this in the system helper.
2016-05-11 15:43:40 +02:00
Alexander Larsson e6f6959afb run: Last fd issue??? 2016-05-11 15:41:49 +02:00
Alexander Larsson edcf485dde run: More background fd issues fixed
This also simplifies the child_setup func by clearing CLOEXEC
on the needed fds.
2016-05-11 15:33:49 +02:00
Alexander Larsson 7d7e5c3bf9 run: Also keep the --args fd alive 2016-05-11 15:23:29 +02:00
Alexander Larsson 3f71025497 run: Fix running in the background
We need to keep all the fd:s needed for bubblewrap alive, so
neuter g_spawn_async:s close of fds and do our own.

Also, we need this so these fds can be closed in the launching app.
2016-05-11 15:14:11 +02:00
Alexander Larsson 4f6a2d5cd7 deploy: Ensure deploy dir is world readable 2016-05-11 13:55:33 +02:00
Alexander Larsson 4da7dc4742 appstream: Generate root dir of appstream branch world-readable 2016-05-11 12:23:55 +02:00
Alexander Larsson 1877f0be8d system-helper: Add support for updating appstream branch 2016-05-11 10:35:24 +02:00
Alexander Larsson d62127a437 run: Always cover /tmp/.X11-unix with an empty tmpfs
This way --filesystem=/tmp doesn't grant full access to the X sockets.
2016-05-10 10:53:24 +02:00
Alexander Larsson 4f9ea6bb57 Remove unused variables
This fixes warnings from clang
2016-05-09 12:49:54 +02:00
Alexander Larsson 5e9b247d26 Migrate ~/.local/share/xdg-app to ~/.local/share/flatpak 2016-05-09 12:21:28 +02:00
Alexander Larsson 8abbc0186e Rename everything but the on-disk location to flatpak 2016-05-09 11:11:55 +02:00
Alexander Larsson ba37b22d78 Rename library to libflatpak 2016-05-09 09:46:26 +02:00
Alexander Larsson c24528d369 Rename source files to flatpak 2016-05-09 09:00:20 +02:00
Alexander Larsson 6a613d1fab Rename all non-autogenerated symbols to flatpak 2016-05-09 09:00:20 +02:00
Alexander Larsson 1ffdf27d92 uncruftify: Initial run, all non-problematic changes 2016-05-06 16:03:27 +02:00
Alexander Larsson de9fe1cb6a common: Work around new glib codegen autogenerating g_autoptr support
glib master generates g_autoptr support, which causes a multiple
declaration conflict. We work around this by using a custom type.
2016-05-04 09:10:11 +02:00
Alexander Larsson 131961644d Use the userspace arch as the default, not the kernel arch
Its not super uncommon to e.g. have a 64bit kernel with 32bit userspace.
So, we default to the arch xdg-app was built for, rather than what
uname reports (the kernel version).
2016-05-04 09:00:12 +02:00
Alexander Larsson 663cfcf3a8 Fix make check if uninstalled
This uses various environment variables set during make check
to find the trigger, bwrap and xdg-app-dbusproxy from the build/source dir
rather than the installed location.
2016-05-03 10:27:36 +02:00
Alexander Larsson 5e06e18e6a run: Always use --unshare-user
This is the default if bwrap is unprivileged, but we want to use
it also if its setuid.
2016-04-29 16:12:54 +02:00
Alexander Larsson f55bb0edc9 Remove xdg-app-helper 2016-04-29 15:52:47 +02:00
Alexander Larsson 4c3bf179e2 Use bubblewrap instead of xdg-app-helper
Bubblewrap is a new tool from project atomic. Its similar to the old
xdg-app-helper, but even more minimal, and a bit more generic. Its designed
to be easy to git submodule install, but at some point we will probably
support using the system installed version too.

Using bubblewraps lets us share the load of security mainainance and
allows other people to use bubblewrap to do their own unprivileged
sandboxes.
2016-04-29 15:52:44 +02:00
Alexander Larsson f37b3261d6 Add support for disabled remotes
If this is set we don't list them by default, and we don't
automatically update apps from them.
2016-04-27 13:39:34 +02:00
Alexander Larsson e471231414 common: Remove unused xdg_app_dir_get_installed_size 2016-04-27 13:10:32 +02:00
Alexander Larsson ffb6670332 deploy: Deploy to temporary directory and rename at the end 2016-04-27 12:58:31 +02:00
Alexander Larsson 64669a9a96 common: Write and use the new deploydata file
Instead of separate "origin", "subpaths" and eventually "installed-size"
files we store a single (extensible) gvariant with all this info, which
means we need to seek less to get it.

Also, we move this file into the deploy dir as some of the data
differs for each deploy, and that way we can rely on the the active
symlink to make the update atomic.
2016-04-27 12:41:41 +02:00
Alexander Larsson b8b3d319d4 common: Add xdg_app_variant_save 2016-04-27 12:33:47 +02:00
Alexander Larsson 74c0689843 commont: Add deploy data GVariant
This is a single file for the per-deploy data in the deploy dir.
We want this so we can avoid stat:ing a lot of separate files to get
data like origin, subpaths and eventually cached installed size.
2016-04-27 11:49:39 +02:00
Alexander Larsson be71ceb31f xdg_app_dir_get_installed_size: Implement without using ostree sizes
This is slightly slower, but actually works since we stopped
collecting sizes in the commits. Further work will make this more performant.
2016-04-27 10:02:49 +02:00
Alexander Larsson 02c3cae33f xdg_app_repo_collect_sizes: Don't collect unrequested sizes. 2016-04-27 10:02:00 +02:00
Alexander Larsson 9624dd67da common: Export xdg_app_repo_collect_sizes 2016-04-27 09:41:14 +02:00
Alexander Larsson a304b786f4 installation_fetch_remote_size_sync: Always fail with deprecation error
This is not supported anymore since it was replaced with the summary cache.
Remove the code so nothing accidentally uses it.
2016-04-27 09:29:48 +02:00
Alexander Larsson 965530c143 helper: Don't try to mount /.oldroot into the sandbox
This will conflict with the internal .oldroot
2016-04-27 08:49:23 +02:00
Alexander Larsson eeece1a789 Merge branch 'privileged-helper' 2016-04-26 17:01:18 +02:00
Alexander Larsson 07e5b4a219 Move system-helper use into xdg_app_dir_install/update()
This way we don't need to keep state in XdgAppDir for the child
repo, which is not threadsafe.
2016-04-26 16:48:18 +02:00
Alexander Larsson 2a46f3277c Add xdg_app_dir_install/update helpers
These don't do much atm, but will let us clean up the child_repo handling
2016-04-26 16:24:09 +02:00
Alexander Larsson 64a28a9e7c XdgAppDir helper: Update system_helper threadsafely 2016-04-26 15:45:44 +02:00
Alexander Larsson 3ec67c57e6 xgd_app_dir_deploy_update: Use the shared system helper 2016-04-26 12:06:03 +02:00
Alexander Larsson 54af892f3a Use glnx_dirfd_iterator_next_dent_ensure_dtype where possible 2016-04-26 10:49:49 +02:00
Alexander Larsson d1788ae318 xdg_app_dir_init_system_helper: Properly pass the error in 2016-04-26 08:50:42 +02:00
Alexander Larsson 96d236a531 xdg_app_dir_pull_untrusted_local: Fix issues pointed out by cosimoc
Also, remove some spew
2016-04-26 08:50:07 +02:00
Alexander Larsson a7f5b57c75 Don't try to use system helper if its not installed 2016-04-25 19:48:17 +02:00
Alexander Larsson 2d74810cbc common: Add (and use) xdg_app_summary_lookup_ref helper 2016-04-25 18:59:17 +02:00
Alexander Larsson b2b05e1175 update/install: Handle deploy using the system service 2016-04-25 18:59:17 +02:00
Alexander Larsson 6af6d629a2 Initial work on pulling to a child repo 2016-04-25 18:59:17 +02:00
Alexander Larsson fee5d4d169 XdgAppDir: Add xdg_app_dir_pull_untrusted_local helper 2016-04-25 18:59:17 +02:00
Alexander Larsson ac517099eb utils: Add xdg_app_allocate_tmpdir 2016-04-25 18:59:17 +02:00
Alexander Larsson 4261057e2a common: Don't use singletons for the system/user XdgAppDirs
Without this we never finalize them and can't e.g. remote temporary
files.
2016-04-22 08:55:41 +02:00
Alexander Larsson 7d509ab93a Fix confusion about GError types
This was pretty mixed up. Also XdgAppError was not exported.
2016-04-21 20:59:30 +02:00
Alexander Larsson d314df07c1 Add xdg_app_dir_deploy_install helper 2016-04-21 20:59:26 +02:00
Alexander Larsson 91eda8919e common: Move duplicated code into xdg_app_dir_deploy_update 2016-04-21 20:19:01 +02:00
Alexander Larsson 21dd53d1ff common: Set ~/.local/share/xdg-app/system-cache as cache dir for system repo
This means we can use a summary cache for system wide stuff which causes
loads to be faster.
2016-04-21 18:54:15 +02:00
Alexander Larsson 351c2d5bd2 Read system remotes from /etc/xdg-app/remotes.d/*.conf 2016-04-21 18:47:11 +02:00
Alexander Larsson 29458bc154 Remove support for older ostree without bundle support
This is not needed when we depend on 2016.5
2016-04-21 18:34:28 +02:00
Alexander Larsson af03d2f5b4 Remove unused local variables reported by clang 2016-04-21 09:48:56 +02:00
Alexander Larsson 1838b1e9da common: Fix warning due to get_user_dir_from_string return type change 2016-04-21 09:39:55 +02:00
Alexander Larsson 4575d07661 run: Always consider xdg-* valid even when not configured
Before we would claim e.g. xdg-videos as invalid if the user didn't
configure the videos user directory.
2016-04-20 14:26:03 +02:00
Alexander Larsson 5392f2d629 common: Break out xdg_app_mtree_create_root helper 2016-04-20 09:55:13 +02:00
Alexander Larsson 1c1bc4acca common: Move xdg_app_dir_pull_from_bundle to xdg_app_pull_from_bundle
The only difference is it takes an OstreeRepo, not a XdgAppDir, so we
can use it at a lower level too.
2016-04-19 13:31:55 +02:00
Alexander Larsson 3d7d9ece93 Fix warning 2016-04-14 22:12:25 +02:00
Alexander Larsson 167564b637 common: Add xdg_app_dir_remote_fetch_summary
This is in preparation for adding a cache for the summary
2016-04-14 20:04:51 +02:00
Alexander Larsson b06528e0ef Merge pull request #127 from matthiasclasen/bus-logging
Bus logging
2016-04-14 19:30:57 +02:00
Alexander Larsson 1dd993cad6 lib: Add new cache based getters for metadata and size 2016-04-14 19:29:40 +02:00
Alexander Larsson 664fb128e7 utils: Remove unused helper 2016-04-14 19:29:18 +02:00
Alexander Larsson ca9bfc99b8 Use string for metadata cache 2016-04-14 19:18:11 +02:00
Matthias Clasen 4283473b38 Add options to enable bus logging
This can be useful to find out what bus names your app
is actually talking to, so you can set up a bus policy
that is narrowed than blanket access without breaking
your application.
2016-04-14 10:01:42 -04:00
Alexander Larsson 8d4393a7aa build-update: Add installed/download size and metadata cache to summary 2016-04-14 13:53:24 +02:00
Alexander Larsson 3187c0c142 appstream: Don't create new commit for unchanged appstream branch 2016-04-14 11:57:13 +02:00
Alexander Larsson 9ba4030564 Fix crash 2016-04-12 16:19:31 +02:00
Alexander Larsson ba0363bd2a Handle empty subpaths 2016-04-12 16:17:58 +02:00
Alexander Larsson 3cc45ccf13 Add support for subpath limited installs
This allows you to install e.g. org.freedesktop.Platform.Locale
but only the /sv subdir, and replaces using separate branches for
each locale.
2016-04-07 20:36:53 +02:00
Alexander Larsson 4beaa990c2 Don't ostree pull while deploying
This makes no sense, callers should be calling xdg_app_dir_pull() before
2016-04-06 16:57:31 +02:00
Alexander Larsson 33e09be5c9 helper: Use 64bit capset/capget versions
This fixed kernel warnings about 32bit capabilities APIs on some distros.
2016-03-30 10:23:07 +02:00
Alexander Larsson 762d1a6295 seccomp: Allow running the target arch
This adds the app target arch to the list of the allowed arches
in seccomp. It also allows the native arch, because otherwise
xdg-app-helper can't run.

This means that if your userspace (i.e. xdg-app-helper) is built in
64bit mode, then 64bit apps can't run 32bit apps. However, if you're
running a 32bit app it is allowed to run both 32bit and 64bit apps.

Not ideal, but at least the common case is safer.
2016-03-24 21:04:01 +01:00
Alexander Larsson c25786ffa1 seccomp: Always try to do the socket filtering, but don't fail if not supported
This is better than guessing if it will work before.
However, we need to add the rule with _rule_add_exact, or it can try
to do something else which breaks the app.
2016-03-24 21:04:01 +01:00
Alexander Larsson 5ce0184cc7 Support endianness markers in bundle files 2016-03-24 11:04:23 +01:00
Giovanni Campagna b4de1f15a7 Extract icons for all appstream components
Not just the one with the name exactly matching the app id
2016-03-21 19:07:36 -07:00
Alexander Larsson 1b1e8c26a2 Prefer non-subdir extensions over subdir ones.
This allows us to have e.g. org.*.Locale that contains *all* the locales.
2016-03-21 16:37:51 +01:00
Alexander Larsson f031650e2d Don't unnecessarily grow the buffer when loading files. 2016-03-14 16:21:55 +01:00
Alexander Larsson 56f0ffcb2b Avoid warning about refing null GVariant 2016-03-14 14:26:05 +01:00
Alexander Larsson 2f01bb3aaa Don't enumerate noenumerate remotes 2016-03-14 09:51:36 +01:00
Alexander Larsson 765c0af2fe Ensure that the .ref file is always replaced
We need a unique inode in the deploy dir, if it is hardlinked the file
lock will be shared.
2016-03-02 11:03:51 +01:00
Thibault Saunier 8aa1effe26 Force /bin/sh as a shell
https://bugs.freedesktop.org/show_bug.cgi?id=94333
2016-03-02 09:50:41 +01:00
Alexander Larsson 26c2bb1b81 lib: Add xdg_app_bundle_ref_get_installed_size() 2016-02-25 21:34:44 +01:00
Alexander Larsson ef14c9f8db common: Add and use xdg_app_appstream_xml_root_to_data 2016-02-25 19:38:08 +01:00
Alexander Larsson 7ac2722800 common: Add xdg_app_read_stream helper 2016-02-25 19:34:04 +01:00
Alexander Larsson 73defceec6 common: Break out xml appstream rewriting to helper functions 2016-02-25 18:26:40 +01:00
Alexander Larsson c84ebe0440 Support --filesystem=xdg-run/foo 2016-02-25 17:11:37 +01:00
Alexander Larsson 26cd90e100 Allow specifying subdir of xdg dir, like: --filesytem=xdg-download/subdir 2016-02-25 16:51:45 +01:00
Alexander Larsson 6c5e1a8a92 Fix some compiler warning (unused vars) 2016-02-25 16:09:49 +01:00
Alexander Larsson 382ae396b3 lib: Add xdg_app_installation_install_bundle 2016-02-25 16:05:13 +01:00
Alexander Larsson eadb10cba7 common: Move part of bundle install to helper functions 2016-02-25 11:31:22 +01:00
Alexander Larsson cbf3d25440 Remove unused variable 2016-02-24 14:33:00 +01:00
Alexander Larsson 4c6a05aba1 common: Break out bundle loader to helper utility 2016-02-24 14:16:52 +01:00
Alexander Larsson c071916ac8 Make /run/build and /run/build-runtime symlinks to the right place 2016-02-23 14:13:58 +01:00
Alexander Larsson 1e83b2c021 Fix xml printing of nodes with no children 2016-02-19 14:57:53 +01:00
Alexander Larsson 593bca9fb9 When deploying, always make /etc/resolve.conf a symlink into the monitor dir
This way we can use the deployed etc dir instead of having to create
our own.
2016-02-19 11:31:18 +01:00
Alexander Larsson 01bfb2e996 helper: Put monitor path in /run/host instead of /run/user/$uid
This means we can always find it in a fixed place, and thus we can
have a static symlink pointing to this.
2016-02-19 11:24:32 +01:00
Alexander Larsson eb2edc578a Fix use after free 2016-02-19 09:48:18 +01:00
Alexander Larsson d62a731cd4 Always create /etc/passwd,group,resolve.conf,machine-id when deploying
This means we can rely on these and bind-mount on top of them when
running.
2016-02-18 22:43:14 +01:00
Alexander Larsson 6428fcce45 common: Add XDG_APP_CP_FLAGS_MOVE support 2016-02-18 17:31:43 +01:00
Alexander Larsson abdbb17a72 Remove all appstream checkouts and mirrored refs when deleting remote 2016-02-18 12:54:40 +01:00
Alexander Larsson 5a7e894edd appstream: Add runtime, sdk and tags to appstream xml 2016-02-17 16:21:20 +01:00
Alexander Larsson c01ec3fae5 deploy: Add metadata tags to exported desktop files. 2016-02-17 15:24:30 +01:00
Alexander Larsson be4b6b8013 helper: drop caps in launcher
We don't need any capabilities in the launcher when waiting for the child
to die, so drop them as early as possible.
2016-02-15 10:54:49 +01:00
Alexander Larsson e26bf79857 Make system repo bare-user too, to avoid any chance of creating setuid bits
There is no real reason for the system repo to be plain "bare" anyway,
bare-user works fine for us.
2016-02-12 17:17:36 +01:00
Alexander Larsson c0a18e38c8 Work around race when doing first initial appstream checkout.
Whenever we finish the first update of appstream for a remote we
touch the toplevel appstream directory. This avoids an race-like issue
where you can't put a watch on the non-existant timestamp file for
a remote before it is created.
2016-02-12 13:03:24 +01:00
Alexander Larsson 767b89cd71 Revert "When rewriting Exec lines, don't use full bindir"
This is not right, dbus service files need an absolute path.

This reverts commit 23cd97a919.
2016-02-11 13:31:05 +01:00
Alexander Larsson 23cd97a919 When rewriting Exec lines, don't use full bindir
This breaks for instance when installing an app from inside a sandbox,
or when installing it with an out-of-tree xdg-app build that would not
necessary be used later. Instead rely on the PATH to pick up the right one.
2016-02-11 11:30:41 +01:00
Alexander Larsson fc986d7814 helper: If stdout is a tty, mount tty as /dev/console
This means ttyname() works in the sandbox. We already have access
to the tty via stdin, so this will not elevate privs.
2016-02-10 14:48:56 +01:00
Alexander Larsson 0c9d1538c9 Add option to disable sandbox triggers
This is not something you should normally do, but the gnome-software
app needs this, as recursive sandboxes don't work.
2016-02-09 15:02:56 +01:00
Alexander Larsson 5dfc59ee02 Pass location of exports to triggers as arg1
This changes nothing but is a preparation for later changes
2016-02-09 14:50:35 +01:00
Alexander Larsson 51fcc6e281 install: Fix assertion on runtime install 2016-02-09 11:48:33 +01:00
Alexander Larsson 8f6e6c0dab Make sure we export files during install
is_data was never set to true, so we didn't run the exports
during install.
2016-02-09 10:32:36 +01:00
Alexander Larsson 22522c2ac6 Make arches canonical
Mostly we just pass on the uname() machine, but for arm, x86
and mips we need some special handling.
2016-02-08 12:52:46 +01:00
Alexander Larsson dd1e967b60 Don't export app-info files
Also, pick up the non-exported files when updating the appdata branch
2016-02-08 10:19:30 +01:00
Timm Bäder fbcdb07768 app-utils: typo 2016-02-03 15:43:49 +01:00
Alexander Larsson 2d85126fc4 Add app-path to the xdg-app-info in the sandbox
This lets you find where the host can see your files.  This is useful
for instance when you want an external app (such as a help reader) to
read your files.
2016-02-03 14:12:36 +01:00
Alexander Larsson 05f79d8d66 common: Always resolve active symlink when looking up deploy dir 2016-02-03 14:12:08 +01:00
Alexander Larsson 8144a70bd7 helper: Make ~/.local/share/xdg-app writable again (if you have homedir access)
This makes the gnome-software app work, and if you have homedir access
you have all sort of ways to mess up apps anyway, so this is fake security.
2016-02-01 21:39:20 +01:00
Alexander Larsson a754db12a2 Merge pull request #106 from smcv/symbol-hiding
Hide non-public symbols from libglnx and libxdgapp-common
2016-01-29 09:01:37 +01:00
Alexander Larsson 4ac5befb7f Support a proxy on the system bus similar to the one on the session bus 2016-01-29 08:50:11 +01:00
Simon McVittie 73b0adfe0a Hide non-public symbols from libglnx and libxdgapp-common
This avoids exporting glnx_*, calc_sizes(), etc. However, we do want to
export xdg_app_error_quark(), so do that.

Signed-off-by: Simon McVittie <smcv@debian.org>
2016-01-28 23:43:30 +01:00
Alexander Larsson a12bb89c9c utils: Fix nul termination of xdg_app_spawn output
The terminating zero byte was written after the output stream
was closed, so it never got added to the string.
2016-01-28 16:20:59 +01:00
Alexander Larsson 96d9204f86 helper: Update the error messages to not refer to --disable-userns 2016-01-28 14:38:59 +01:00
Alexander Larsson 225c359128 Fix include order to build with older libsoup versions 2016-01-28 14:35:46 +01:00
Alexander Larsson a741ba418f Finish the optional xauth work 2016-01-28 14:34:22 +01:00
Alexander Larsson 927e3cab48 Make xauth use optional
This is not needed on some Xservers, and not if you're only building stuff.
So, lets make it optional.
2016-01-28 12:01:08 +01:00
Alexander Larsson f8d502ad19 Require some way to set cgroup for apps (currently systemd --user)
When the portal looks up the peer app id it needs to know whether it
can trust that the cgroup path would be set, so that it can tell
whether the app is sandboxed or trusted. We used to check if the
cgroup was session-$uid.slice, and if so it was trusted, but this
failed in the case of per-user dbus (not per-session) where
e.g. gnome-terminal would be outside the session.

Now we just fail if we can't set up a cgroup, thus whenever the cgroup
path is not right we know that the app is trusted.
2016-01-28 11:15:58 +01:00
Alexander Larsson 6349b3ffc1 helper: Make user namespace support vs setuid a runtime, not build-time option
We now check at runtime if we have raised privs, and only if not so do we try
to use unprivileged user namespaces. This means you can build xdg-app however,
and then setuid/setcap the binary however you want afterwards.
2016-01-28 09:43:45 +01:00
Alexander Larsson 4671149722 update-repo: Escape text when writing xml 2016-01-25 13:13:24 +01:00
Alexander Larsson 4eb7b14996 update-appstream: Fix crash in case there are no 128x128 icons 2016-01-24 21:26:40 +01:00
Alexander Larsson a95c99270a Move the GZlib* autoptr backport to libglnx 2016-01-22 15:30:48 +01:00
Alexander Larsson a7b2f05a6a dir: Properly finish OstreeAsyncProgress objects 2016-01-22 15:12:05 +01:00
Alexander Larsson 85aef6666e XdgAppDir: Make sure we always constole end status lines that we start 2016-01-22 15:01:09 +01:00
Alexander Larsson 47fb77ec45 common: fix handling of no_chown in xdg_app_cp_a 2016-01-22 11:58:00 +01:00
Alexander Larsson b099dc7021 common: Add xdg_app_cp_a 2016-01-22 11:43:58 +01:00
Alexander Larsson 33fba3c67e xdg-app-utils: Add autocleanup for GZlib* 2016-01-22 10:55:01 +01:00
Alexander Larsson 64da5f5602 utils: Extract the xml helpers 2016-01-21 21:37:29 +01:00
Alexander Larsson 455d3a7b29 build-update-repo: Update the appstream using a GMarkup parser on the app-info files 2016-01-21 21:16:37 +01:00
Alexander Larsson 8da9d592ba appstream: Add timestamp which is updated each time the appstream is pulled 2016-01-20 15:14:01 +01:00
Alexander Larsson bc892f1745 run: Use the new xdg_app_list_extensions helper 2016-01-20 14:00:49 +01:00
Alexander Larsson d959ed016c common: Add xdg_app_list_extensions util 2016-01-20 14:00:49 +01:00
Alexander Larsson c6df1665a6 appstream: Don't try to remove old appstream if it doesn't exist 2016-01-19 22:05:16 +01:00
Alexander Larsson 0b8515ac07 update-appstream: Don't fail badly if remote has not appstream branch 2016-01-19 21:58:44 +01:00
Alexander Larsson 2bede34952 lib: Add getter for installed size on InstalledRef 2016-01-19 15:05:06 +01:00
Alexander Larsson 071561637a Remove unused variables 2016-01-19 12:37:51 +01:00
Alexander Larsson 24ec8445a3 override: Fix error if override file doesn't already exist 2016-01-19 12:09:54 +01:00
Alexander Larsson 6e204a4d2e Add support to gpg sign summaries and appstream 2016-01-18 21:36:57 +01:00
Alexander Larsson de7e19e40f The plural of appdata is appstream 2016-01-18 21:06:42 +01:00
Alexander Larsson d114069b8a XdgAppDir: Document some args to xdg_app_dir_fetch_sizes 2016-01-15 16:06:26 +01:00
Alexander Larsson 51e9fa2b8d build-update-repo: Add --appdata update option 2016-01-15 15:59:22 +01:00
Alexander Larsson cd2c5af974 build-repo-update: Update appdata branch using appdata-builder 2016-01-15 14:39:11 +01:00
Alexander Larsson a79ea2e890 common: Add XdgAppTempDir which cleans up temporary directories 2016-01-15 12:04:46 +01:00
Alexander Larsson cb971722fe Better handling of the title in the summary
Now we store the title in the repo config and re-apply it every time
we regenerate the summary.
2016-01-14 21:26:51 +01:00
Alexander Larsson 839c5ca885 XdgAppDir: Add helper to fetch the size info for a commit 2016-01-14 16:45:28 +01:00
Alexander Larsson f7a1fdaa99 xdg-app: Deprecate install/update/uninstall-app/runtime
We just have install/updata/uninstall and have --app and --runtime
options if you really want to specify the type. Otherwise we just
automatically chose the right thing.
2016-01-13 15:34:08 +01:00
Alexander Larsson a241610793 helper: Align help output 2016-01-12 11:21:14 +01:00
Alexander Larsson 5c578946bf helper: Allow specifying initial cwd 2016-01-12 10:39:03 +01:00
Alexander Larsson b60e81271e helper: Add missing arguments to usage output 2016-01-12 10:33:43 +01:00
Alexander Larsson 1934562ca2 run: Be more flexible with --runtime option, and add --runtime-version
This makes it easier to experiment with running an app with a
different runtime.
2016-01-12 09:57:20 +01:00
Alexander Larsson 5a905d913c helper: Print nicer error messages when user namespaces don't work. 2016-01-12 09:33:55 +01:00
Alexander Larsson e2b347ba76 run: Fix support for app extensions 2016-01-11 15:34:54 +01:00
Alexander Larsson b4fbb84f0a common: Move path_match_prefix to common 2016-01-11 13:56:07 +01:00
Alexander Larsson 6ddee9905b build-export: Add --runtime commit support 2015-12-21 15:38:42 +01:00
Alexander Larsson d99c4f6568 XdgAppDir: Remove leftover spew 2015-12-21 13:21:01 +01:00
Alexander Larsson cd490d12a7 XdgAppDir: Touch .changes file each time something changes 2015-12-21 11:12:25 +01:00
Alexander Larsson ea543c8f93 lib/app: Add support for repo priorities
New repos default to prio 1, bundle repos default to prio 0.
Listing repos returns in sorted order, with add order as secondary
sort key.
2015-12-21 10:28:15 +01:00
Alexander Larsson e87e2b7736 common: Add xdg_app_dir_read_latest helper 2015-12-18 11:54:12 +01:00
Alexander Larsson dd210ed6cc app: Use space, not tab to delimit columns
Tabs were using way to much space
2015-12-18 11:18:24 +01:00
Alexander Larsson f9b9f70fad common: Add xdg_app_strcmp0_ptr and use it in all g_ptr_array_sort calls 2015-12-18 10:41:34 +01:00
Alexander Larsson 874fce2b77 lib: Move app launching to XdgAppInstallation 2015-12-17 20:34:25 +01:00
Alexander Larsson 67de92042b apps: Use "branch", not "version" when talking about app branches 2015-12-17 20:07:14 +01:00
Alexander Larsson 8b5208a995 Add lock file for each xdg-app dir.
This protects the stuff outside the repo (such as deploys, exports,
active checkout, current branch, etc). However, we rely on ostree
concurrency handling for handling concurrent pulls and prunes.

For reading (e.g. list-apps, etc), we don't do any locking, as these
all writes are essentially updated atomically (last change is atomic) and
any once you return such information it could be out of date anyway.
2015-12-15 16:20:28 +01:00
Alexander Larsson 856c8210a9 lib: Add custom GError codes 2015-12-15 15:27:37 +01:00
Alexander Larsson be4f0d86d8 common: Add and use xdg_app_dir_deploy_update() 2015-12-15 15:21:00 +01:00
Alexander Larsson b820249178 common: Add xdg_app_compose_ref helper 2015-12-15 14:55:29 +01:00
Alexander Larsson 6cdbf400b2 lib: Add xdg_app_dir_undeploy_all and xdg_app_dir_remove_ref helpers 2015-12-15 14:36:17 +01:00
Alexander Larsson 3dc56a65de helper: Properly unescape strings 2015-12-15 14:35:18 +01:00
Alexander Larsson 43a09b3646 Fix unused variable warnings 2015-12-15 14:34:52 +01:00
Alexander Larsson 9285d055ab lib: Add xdg_app_installation_install 2015-12-15 12:26:59 +01:00
Alexander Larsson f8e9b74d1f XdgAppDir: Add set_origin helper function 2015-12-15 09:25:02 +01:00
Alexander Larsson 5b21b48084 common: Fix compiler warning when built with --disable-userns 2015-12-15 08:46:53 +01:00
Alexander Larsson f16cc44a30 builder: Use SoupRequest to simplify download helpers
Also, this allows us to support data: uris, etc
2015-12-09 12:55:10 +01:00
Alexander Larsson f7b20fad85 common: Make XdgAppDir soup session initilization threadsafe 2015-12-08 15:28:11 +01:00
Alexander Larsson 4177f358cb common: Make it explicit that XdgAppError are portal errors 2015-12-08 12:16:38 +01:00
Alexander Larsson a28ced36c7 lib: Add xdg_app_installation_load_app_overrides() 2015-12-08 11:48:22 +01:00
Alexander Larsson a62f64d265 lib: Add xdg_app_remote_ref_fetch_metadata_sync helper
This does direct soup access on the repo. Not ideal, but good for now.
2015-12-08 11:01:13 +01:00
Alexander Larsson 000c59f60e xdg_app_run_app: Handle error == NULL 2015-12-07 13:34:50 +01:00
Alexander Larsson 8e26dec0d9 helper: Mount dconf run dir writable, as dconf needs this. 2015-12-07 13:34:11 +01:00
Alexander Larsson 67e52e8278 common: Clean up xdg_app_run_app()
This breaks things out into helper functions to make things easier
to read.
2015-12-07 13:04:45 +01:00
Alexander Larsson 03ae229751 Move most of builtins-run to xdg_app_run_app helper
This is in preparation for letting the library start apps.
2015-12-07 12:27:53 +01:00
Alexander Larsson d503c5a15d Remove unused variable 2015-12-07 12:27:29 +01:00
Alexander Larsson b761aa05a7 common: Move typedef to separate header to avoid circular deps 2015-12-07 12:26:44 +01:00
Alexander Larsson ad7310f246 XdgAppDeploy: Fix wrong types in finalizer 2015-12-07 12:25:48 +01:00
Alexander Larsson 1647c85d6f helper: Allow exec on the tmpfs.
This should be safe, you could always copy it to your writable
directory and exectute from there instead. There should be no way
to get increased privileges from a simple exec anyway.
2015-12-04 12:19:41 +01:00
Alexander Larsson ad7b379398 Add no-enumerate flag to remote and set if for bundle origin remotes 2015-12-04 11:40:51 +01:00
Alexander Larsson 704300e1b4 Add xdg_app_dir_fetch_remote_title and remote old custom summary fetcher 2015-12-04 11:09:00 +01:00
Alexander Larsson 5bc44ea125 XdgAppDir: Add some helpers for handling remotes 2015-12-04 10:48:05 +01:00
Alexander Larsson e76da99cdc builder: Merge spawn helpers to single base helper 2015-12-03 13:29:08 +01:00
Alexander Larsson e35241ba35 Merge pull request #86 from murraycu/patch-1
xdg-app-utils: Correct SoupUri -> SoupURI typo.
2015-12-01 15:10:36 +01:00
Murray Cumming 4a91447307 xdg-app-utils: Correct SoupUri -> SoupURI typo.
It should be SoupURI, not SoupUri:
https://developer.gnome.org/libsoup/stable/SoupURI.html#soup-uri-new

This broke the build for me.
2015-12-01 14:01:43 +01:00
Alexander Larsson a8eefe6844 Remove stray semicolons 2015-12-01 12:31:20 +01:00
Alexander Larsson 106a5b06ec Rename lib/ to common/ in preparation for public xdg-app library 2015-11-26 22:05:38 +01:00