Add a --installations option

Similar to the --gl-drivers option, print the installation
paths for all system installations, including custom
installations defined in ${sysconfdir}/flatpak/installations.d/

Closes: #2122
Approved by: matthiasclasen
This commit is contained in:
Bastien Nocera
2018-08-28 14:21:15 +02:00
committed by Atomic Bot
parent 3853ee49bd
commit b3c785ee09

View File

@@ -49,6 +49,7 @@ static gboolean opt_version;
static gboolean opt_default_arch;
static gboolean opt_supported_arches;
static gboolean opt_gl_drivers;
static gboolean opt_list_installations;
static gboolean opt_user;
static gboolean opt_system;
static char **opt_installations;
@@ -160,6 +161,7 @@ static GOptionEntry empty_entries[] = {
{ "default-arch", 0, 0, G_OPTION_ARG_NONE, &opt_default_arch, N_("Print default arch and exit"), NULL },
{ "supported-arches", 0, 0, G_OPTION_ARG_NONE, &opt_supported_arches, N_("Print supported arches and exit"), NULL },
{ "gl-drivers", 0, 0, G_OPTION_ARG_NONE, &opt_gl_drivers, N_("Print active gl drivers and exit"), NULL },
{ "installations", 0, 0, G_OPTION_ARG_NONE, &opt_list_installations, N_("Print paths for system installations and exit"), NULL },
{ NULL }
};
@@ -308,6 +310,27 @@ flatpak_option_context_parse (GOptionContext *context,
exit (EXIT_SUCCESS);
}
if (opt_list_installations)
{
GPtrArray *paths;
g_autoptr(GError) error = NULL;
guint i;
paths = flatpak_get_system_base_dir_locations (NULL, &error);
if (!paths)
return FALSE;
for (i = 0; i < paths->len; i++)
{
GFile *file = paths->pdata[i];
g_autofree char *path;
path = g_file_get_path (file);
g_print ("%s\n", path);
}
exit (EXIT_SUCCESS);
}
if (opt_verbose > 0 || opt_ostree_verbose)
flatpak_disable_fancy_output ();