[ostree] admin: Assume we're using /ostree if there's a toplevel /usr
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] admin: Assume we're using /ostree if there's a toplevel /usr
- Date: Mon, 18 Mar 2013 22:11:31 +0000 (UTC)
commit 7b2fc8df361b364c1321ac314a472e4464a434c2
Author: Colin Walters <walters verbum org>
Date: Mon Mar 18 18:11:00 2013 -0400
admin: Assume we're using /ostree if there's a toplevel /usr
Mainly so admin install works without an existing /ostree again.
src/ostree/ot-admin-builtin-install.c | 7 +++++++
src/ostree/ot-admin-functions.c | 9 ++++++++-
2 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/src/ostree/ot-admin-builtin-install.c b/src/ostree/ot-admin-builtin-install.c
index 06249a9..5f5fb3d 100644
--- a/src/ostree/ot-admin-builtin-install.c
+++ b/src/ostree/ot-admin-builtin-install.c
@@ -96,6 +96,13 @@ ot_admin_builtin_install (int argc, char **argv, OtAdminBuiltinOpts *admin_opts,
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))
goto out;
diff --git a/src/ostree/ot-admin-functions.c b/src/ostree/ot-admin-functions.c
index f28ea73..c0b71a5 100644
--- a/src/ostree/ot-admin-functions.c
+++ b/src/ostree/ot-admin-functions.c
@@ -440,6 +440,9 @@ ot_admin_get_default_ostree_dir (GFile **out_ostree_dir,
gboolean ret = FALSE;
gs_unref_object GFile *possible_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)
{
@@ -452,7 +455,11 @@ ot_admin_get_default_ostree_dir (GFile **out_ostree_dir,
{
g_clear_object (&possible_ostree_dir);
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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]