diff options
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | app/flatpak-main.c | 2 | ||||
-rw-r--r-- | common/flatpak-dir.c | 2 | ||||
-rw-r--r-- | common/flatpak-run.c | 4 | ||||
-rw-r--r-- | common/flatpak-utils.c | 24 | ||||
-rw-r--r-- | common/flatpak-utils.h | 2 | ||||
-rw-r--r-- | document-portal/xdp-main.c | 4 | ||||
-rw-r--r-- | env.d/flatpak.env.in | 2 | ||||
-rw-r--r-- | lib/flatpak-installation.c | 6 | ||||
-rw-r--r-- | profile/flatpak.sh.in | 2 | ||||
-rw-r--r-- | session-helper/Makefile.am.inc | 2 | ||||
-rw-r--r-- | session-helper/flatpak-permission-store.c | 2 | ||||
-rw-r--r-- | session-helper/flatpak-session-helper.c | 3 | ||||
-rw-r--r-- | tests/libtest.sh | 2 |
14 files changed, 48 insertions, 11 deletions
diff --git a/Makefile.am b/Makefile.am index c5da158a..e21f379a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,7 +35,7 @@ FLATPAK_BINDIR=$(bindir) AM_CPPFLAGS = \ -DFLATPAK_BINDIR=\"$(FLATPAK_BINDIR)\" \ - -DFLATPAK_SYSTEMDIR=\"$(localstatedir)/lib/xdg-app\"\ + -DFLATPAK_SYSTEMDIR=\"$(localstatedir)/lib/flatpak\"\ -DFLATPAK_CONFIGDIR=\"$(sysconfdir)/flatpak\"\ -DFLATPAK_BASEDIR=\"$(pkgdatadir)\" \ -DFLATPAK_TRIGGERDIR=\"$(pkgdatadir)/triggers\" \ diff --git a/app/flatpak-main.c b/app/flatpak-main.c index e5fbb573..e8ee2ed8 100644 --- a/app/flatpak-main.c +++ b/app/flatpak-main.c @@ -345,6 +345,8 @@ main (int argc, else g_unsetenv ("GIO_USE_VFS"); + flatpak_migrate_from_xdg_app (); + ret = flatpak_run (argc, argv, &error); if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED)) flatpak_usage (commands, TRUE); diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c index c4bbfe33..bf737a2a 100644 --- a/common/flatpak-dir.c +++ b/common/flatpak-dir.c @@ -167,7 +167,7 @@ flatpak_get_system_base_dir_location (void) GFile * flatpak_get_user_base_dir_location (void) { - g_autofree char *base = g_build_filename (g_get_user_data_dir (), "xdg-app", NULL); + g_autofree char *base = g_build_filename (g_get_user_data_dir (), "flatpak", NULL); return g_file_new_for_path (base); } diff --git a/common/flatpak-run.c b/common/flatpak-run.c index 388aef99..fab92fb0 100644 --- a/common/flatpak-run.c +++ b/common/flatpak-run.c @@ -2440,7 +2440,7 @@ setup_seccomp (GPtrArray *argv_array, * can do, and we should support code portability between different * container tools. * - * This syscall blacklist is copied from xdg-app, which was in turn + * This syscall blacklist is copied from linux-user-chroot, which was in turn * clearly influenced by the Sandstorm.io blacklist. * * If you make any changes here, I suggest sending the changes along @@ -2454,7 +2454,7 @@ setup_seccomp (GPtrArray *argv_array, * https://github.com/sandstorm-io/sandstorm * in src/sandstorm/supervisor.c++ * http://cgit.freedesktop.org/xdg-app/xdg-app/ - * in lib/xdg-app-helper.c + * in common/flatpak-run.c * https://git.gnome.org/browse/linux-user-chroot * in src/setup-seccomp.c * diff --git a/common/flatpak-utils.c b/common/flatpak-utils.c index fca297ab..b79e2769 100644 --- a/common/flatpak-utils.c +++ b/common/flatpak-utils.c @@ -26,6 +26,7 @@ #include <string.h> #include <stdlib.h> +#include <stdio.h> #include <errno.h> #include <fcntl.h> #include <string.h> @@ -252,6 +253,29 @@ flatpak_get_bwrap (void) return HELPER; } +/* We only migrate the user dir, because thats what most people used with xdg-app, + * and its where all per-user state/config are stored. + */ +void +flatpak_migrate_from_xdg_app (void) +{ + g_autofree char *source = g_build_filename (g_get_user_data_dir (), "xdg-app", NULL); + g_autofree char *dest = g_build_filename (g_get_user_data_dir (), "flatpak", NULL); + + if (!g_file_test (dest, G_FILE_TEST_EXISTS) && + g_file_test (source, G_FILE_TEST_EXISTS)) + { + g_print ("Migrating %s to %s\n", source, dest); + if (rename (source, dest) != 0) + { + if (errno != ENOENT && + errno != ENOTEMPTY && + errno != EEXIST) + g_print ("Error during migration: %s\n", strerror (errno)); + } + } +} + static gboolean is_valid_initial_name_character (gint c) { diff --git a/common/flatpak-utils.h b/common/flatpak-utils.h index 8f3ab922..5621b653 100644 --- a/common/flatpak-utils.h +++ b/common/flatpak-utils.h @@ -45,6 +45,8 @@ const char * flatpak_get_arch (void); const char * flatpak_get_bwrap (void); +void flatpak_migrate_from_xdg_app (void); + GBytes * flatpak_read_stream (GInputStream *in, gboolean null_terminate, GError **error); diff --git a/document-portal/xdp-main.c b/document-portal/xdp-main.c index 28e35097..a8a61f4d 100644 --- a/document-portal/xdp-main.c +++ b/document-portal/xdp-main.c @@ -773,6 +773,8 @@ main (int argc, /* Avoid even loading gvfs to avoid accidental confusion */ g_setenv ("GIO_USE_VFS", "local", TRUE); + flatpak_migrate_from_xdg_app (); + context = g_option_context_new ("- document portal"); g_option_context_add_main_entries (context, entries, NULL); if (!g_option_context_parse (context, &argc, &argv, &error)) @@ -806,7 +808,7 @@ main (int argc, loop = g_main_loop_new (NULL, FALSE); - path = g_build_filename (g_get_user_data_dir (), "xdg-app/db", TABLE_NAME, NULL); + path = g_build_filename (g_get_user_data_dir (), "flatpak/db", TABLE_NAME, NULL); db = flatpak_db_new (path, FALSE, &error); if (db == NULL) { diff --git a/env.d/flatpak.env.in b/env.d/flatpak.env.in index b421ee62..be428489 100644 --- a/env.d/flatpak.env.in +++ b/env.d/flatpak.env.in @@ -1 +1 @@ -XDG_DATA_DIRS=$HOME/.local/share/xdg-app/exports/share/:@localstatedir@/xdg-app/exports/share/:/usr/local/share/:/usr/share/ +XDG_DATA_DIRS=$HOME/.local/share/flatpak/exports/share/:@localstatedir@/flatpak/exports/share/:/usr/local/share/:/usr/share/ diff --git a/lib/flatpak-installation.c b/lib/flatpak-installation.c index 40ba33c0..0770f643 100644 --- a/lib/flatpak-installation.c +++ b/lib/flatpak-installation.c @@ -43,7 +43,7 @@ * * An FlatpakInstallation object provides information about an installation * location for flatpak applications. Typical installation locations are either - * system-wide (in /var/lib/xdg-app) or per-user (in ~/.local/share/xdg-app). + * system-wide (in /var/lib/flatpak) or per-user (in ~/.local/share/flatpak). * * FlatpakInstallation can list configured remotes as well as installed application * and runtime references (in short: refs). It can also run, install, update and @@ -184,6 +184,8 @@ FlatpakInstallation * flatpak_installation_new_user (GCancellable *cancellable, GError **error) { + flatpak_migrate_from_xdg_app (); + return flatpak_installation_new_for_dir (flatpak_dir_get_user (), cancellable, error); } @@ -203,6 +205,8 @@ flatpak_installation_new_for_path (GFile *path, gboolean user, GCancellable *cancellable, GError **error) { + flatpak_migrate_from_xdg_app (); + return flatpak_installation_new_for_dir (flatpak_dir_new (path, user), cancellable, error); } diff --git a/profile/flatpak.sh.in b/profile/flatpak.sh.in index 0fba9ee2..f60af28e 100644 --- a/profile/flatpak.sh.in +++ b/profile/flatpak.sh.in @@ -1,4 +1,4 @@ # @sysconfdir@/profile.d/flatpak.sh - set XDG_DATA_DIRS -XDG_DATA_DIRS="${XDG_DATA_DIRS:-$HOME/.local/share/xdg-app/exports/share:@localstatedir@/xdg-app/exports/share/:/usr/local/share/:/usr/share/}" +XDG_DATA_DIRS="${XDG_DATA_DIRS:-$HOME/.local/share/flatpak/exports/share:@localstatedir@/flatpak/exports/share/:/usr/local/share/:/usr/share/}" export XDG_DATA_DIRS diff --git a/session-helper/Makefile.am.inc b/session-helper/Makefile.am.inc index 89dca771..65a3deed 100644 --- a/session-helper/Makefile.am.inc +++ b/session-helper/Makefile.am.inc @@ -15,4 +15,4 @@ flatpak_session_helper_SOURCES = \ $(NULL) flatpak_session_helper_LDADD = $(BASE_LIBS) libflatpak-common.la -flatpak_session_helper_CFLAGS = $(BASE_CFLAGS) +flatpak_session_helper_CFLAGS = $(BASE_CFLAGS) $(SOUP_CFLAGS) $(OSTREE_CFLAGS) $(GSYSTEM_CFLAGS) diff --git a/session-helper/flatpak-permission-store.c b/session-helper/flatpak-permission-store.c index 89da8e2a..a41a8d34 100644 --- a/session-helper/flatpak-permission-store.c +++ b/session-helper/flatpak-permission-store.c @@ -64,7 +64,7 @@ lookup_table (const char *name, if (table != NULL) return table; - dir = g_build_filename (g_get_user_data_dir (), "xdg-app/db", NULL); + dir = g_build_filename (g_get_user_data_dir (), "flatpak/db", NULL); g_mkdir_with_parents (dir, 0755); path = g_build_filename (dir, name, NULL); diff --git a/session-helper/flatpak-session-helper.c b/session-helper/flatpak-session-helper.c index 54ec63e4..074a05f5 100644 --- a/session-helper/flatpak-session-helper.c +++ b/session-helper/flatpak-session-helper.c @@ -26,6 +26,7 @@ #include <gio/gio.h> #include "flatpak-dbus.h" #include "flatpak-permission-store.h" +#include "flatpak-utils.h" static char *monitor_dir; @@ -134,6 +135,8 @@ main (int argc, g_set_prgname (argv[0]); + flatpak_migrate_from_xdg_app (); + monitor_dir = g_build_filename (g_get_user_runtime_dir (), "flatpak-monitor", NULL); if (g_mkdir_with_parents (monitor_dir, 0755) != 0) { diff --git a/tests/libtest.sh b/tests/libtest.sh index 3867d9ef..0717af2f 100644 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -72,7 +72,7 @@ TEST_DATA_DIR=`mktemp -d /var/tmp/test-flatpak-XXXXXX` export XDG_DATA_HOME=${TEST_DATA_DIR}/share -export USERDIR=${TEST_DATA_DIR}/share/xdg-app +export USERDIR=${TEST_DATA_DIR}/share/flatpak export ARCH=`flatpak --default-arch` export FLATPAK="${CMD_PREFIX} flatpak" |