admin: Assume we're using /ostree if there's a toplevel /usr
Mainly so admin install works without an existing /ostree again.
This commit is contained in:
parent
e4faf0d98e
commit
7b2fc8df36
|
|
@ -96,6 +96,13 @@ ot_admin_builtin_install (int argc, char **argv, OtAdminBuiltinOpts *admin_opts,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (admin_opts->ostree_dir == NULL)
|
||||||
|
{
|
||||||
|
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
|
"No existing /ostree found; use --ostree-dir");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (!ot_admin_ensure_initialized (admin_opts->ostree_dir, cancellable, error))
|
if (!ot_admin_ensure_initialized (admin_opts->ostree_dir, cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -440,6 +440,9 @@ ot_admin_get_default_ostree_dir (GFile **out_ostree_dir,
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
gs_unref_object GFile *possible_ostree_dir = NULL;
|
gs_unref_object GFile *possible_ostree_dir = NULL;
|
||||||
gs_unref_object GFile *ret_ostree_dir = NULL;
|
gs_unref_object GFile *ret_ostree_dir = NULL;
|
||||||
|
gs_unref_object GFile *host_usr = NULL;
|
||||||
|
|
||||||
|
host_usr = g_file_new_for_path ("/usr");
|
||||||
|
|
||||||
if (ret_ostree_dir == NULL)
|
if (ret_ostree_dir == NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -452,7 +455,11 @@ ot_admin_get_default_ostree_dir (GFile **out_ostree_dir,
|
||||||
{
|
{
|
||||||
g_clear_object (&possible_ostree_dir);
|
g_clear_object (&possible_ostree_dir);
|
||||||
possible_ostree_dir = g_file_new_for_path ("/ostree");
|
possible_ostree_dir = g_file_new_for_path ("/ostree");
|
||||||
if (g_file_query_exists (possible_ostree_dir, NULL))
|
/* If there's also /usr, we assume we're outside an ostree root
|
||||||
|
* and thus should use /ostree.
|
||||||
|
*/
|
||||||
|
if (g_file_query_exists (possible_ostree_dir, NULL) ||
|
||||||
|
g_file_query_exists (host_usr, NULL))
|
||||||
ret_ostree_dir = g_object_ref (possible_ostree_dir);
|
ret_ostree_dir = g_object_ref (possible_ostree_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue