diff --git a/src/rpmostree-builtin-rebase.c b/src/rpmostree-builtin-rebase.c index 302ab601..4227e023 100644 --- a/src/rpmostree-builtin-rebase.c +++ b/src/rpmostree-builtin-rebase.c @@ -29,7 +29,12 @@ #include "libgsystem.h" +static char *opt_sysroot = "/"; +static char *opt_osname; + static GOptionEntry option_entries[] = { + { "sysroot", 0, 0, G_OPTION_ARG_STRING, &opt_sysroot, "Use system root SYSROOT (default: /)", "SYSROOT" }, + { "os", 0, 0, G_OPTION_ARG_STRING, &opt_osname, "Operate on provided OSNAME", "OSNAME" }, { NULL } }; @@ -51,6 +56,7 @@ rpmostree_builtin_rebase (int argc, gs_free char *new_ref = NULL; gs_free char *new_refspec = NULL; gs_free char *new_revision = NULL; + gs_unref_object GFile *sysroot_path = NULL; gs_unref_object GFile *deployment_path = NULL; gs_unref_object GFile *deployment_origin_path = NULL; gs_unref_object OstreeDeployment *merge_deployment = NULL; @@ -77,11 +83,12 @@ rpmostree_builtin_rebase (int argc, new_provided_refspec = argv[1]; - sysroot = ostree_sysroot_new_default (); + sysroot_path = g_file_new_for_path (opt_sysroot); + sysroot = ostree_sysroot_new (sysroot_path); if (!ostree_sysroot_load (sysroot, cancellable, error)) goto out; - upgrader = ostree_sysroot_upgrader_new_for_os (sysroot, NULL, + upgrader = ostree_sysroot_upgrader_new_for_os (sysroot, opt_osname, cancellable, error); if (!upgrader) goto out; diff --git a/src/rpmostree-builtin-rollback.c b/src/rpmostree-builtin-rollback.c index 49fc6964..7dc7144f 100644 --- a/src/rpmostree-builtin-rollback.c +++ b/src/rpmostree-builtin-rollback.c @@ -28,9 +28,11 @@ #include "libgsystem.h" +static char *opt_sysroot = "/"; static gboolean opt_reboot; static GOptionEntry option_entries[] = { + { "sysroot", 0, 0, G_OPTION_ARG_STRING, &opt_sysroot, "Use system root SYSROOT (default: /)", "SYSROOT" }, { "reboot", 'r', 0, G_OPTION_ARG_NONE, &opt_reboot, "Initiate a reboot after rollback is prepared", NULL }, { NULL } }; @@ -43,6 +45,7 @@ rpmostree_builtin_rollback (int argc, { gboolean ret = FALSE; GOptionContext *context = g_option_context_new ("- Revert to the previously booted tree"); + gs_unref_object GFile *sysroot_path = NULL; gs_unref_object OstreeSysroot *sysroot = NULL; gs_free char *origin_description = NULL; gs_unref_ptrarray GPtrArray *deployments = NULL; @@ -58,7 +61,8 @@ rpmostree_builtin_rollback (int argc, if (!g_option_context_parse (context, &argc, &argv, error)) goto out; - sysroot = ostree_sysroot_new_default (); + sysroot_path = g_file_new_for_path (opt_sysroot); + sysroot = ostree_sysroot_new (sysroot_path); if (!ostree_sysroot_load (sysroot, cancellable, error)) goto out; diff --git a/src/rpmostree-builtin-status.c b/src/rpmostree-builtin-status.c index 7aaaa776..68bdd245 100644 --- a/src/rpmostree-builtin-status.c +++ b/src/rpmostree-builtin-status.c @@ -28,9 +28,11 @@ #include "libgsystem.h" +static char *opt_sysroot = "/"; static gboolean opt_pretty; static GOptionEntry option_entries[] = { + { "sysroot", 0, 0, G_OPTION_ARG_STRING, &opt_sysroot, "Use system root SYSROOT (default: /)", "SYSROOT" }, { "pretty", 'p', 0, G_OPTION_ARG_NONE, &opt_pretty, "Display status in formatted rows", NULL }, { NULL } }; @@ -51,6 +53,7 @@ rpmostree_builtin_status (int argc, GError **error) { gboolean ret = FALSE; + gs_unref_object GFile *sysroot_path = NULL; gs_unref_object OstreeSysroot *sysroot = NULL; gs_unref_ptrarray GPtrArray *deployments = NULL; // list of all depoyments OstreeDeployment *booted_deployment = NULL; // current booted deployment @@ -68,7 +71,8 @@ rpmostree_builtin_status (int argc, if (!g_option_context_parse (context, &argc, &argv, error)) goto out; - sysroot = ostree_sysroot_new_default (); + sysroot_path = g_file_new_for_path (opt_sysroot); + sysroot = ostree_sysroot_new (sysroot_path); if (!ostree_sysroot_load (sysroot, cancellable, error)) goto out; diff --git a/src/rpmostree-builtin-upgrade.c b/src/rpmostree-builtin-upgrade.c index 31ae64e3..a409a660 100644 --- a/src/rpmostree-builtin-upgrade.c +++ b/src/rpmostree-builtin-upgrade.c @@ -29,10 +29,14 @@ #include "libgsystem.h" +static char *opt_sysroot = "/"; +static char *opt_osname; static gboolean opt_reboot; static gboolean opt_allow_downgrade; static GOptionEntry option_entries[] = { + { "sysroot", 0, 0, G_OPTION_ARG_STRING, &opt_sysroot, "Use system root SYSROOT (default: /)", "SYSROOT" }, + { "os", 0, 0, G_OPTION_ARG_STRING, &opt_osname, "Operate on provided OSNAME", "OSNAME" }, { "reboot", 'r', 0, G_OPTION_ARG_NONE, &opt_reboot, "Initiate a reboot after an upgrade is prepared", NULL }, { "allow-downgrade", 0, 0, G_OPTION_ARG_NONE, &opt_allow_downgrade, "Permit deployment of chronologically older trees", NULL }, { NULL } @@ -46,6 +50,7 @@ rpmostree_builtin_upgrade (int argc, { gboolean ret = FALSE; GOptionContext *context = g_option_context_new ("- Perform a system upgrade"); + gs_unref_object GFile *sysroot_path = NULL; gs_unref_object OstreeSysroot *sysroot = NULL; gs_unref_object OstreeSysrootUpgrader *upgrader = NULL; gs_unref_object OstreeAsyncProgress *progress = NULL; @@ -59,11 +64,13 @@ rpmostree_builtin_upgrade (int argc, if (!g_option_context_parse (context, &argc, &argv, error)) goto out; - sysroot = ostree_sysroot_new_default (); + sysroot_path = g_file_new_for_path (opt_sysroot); + sysroot = ostree_sysroot_new (sysroot_path); if (!ostree_sysroot_load (sysroot, cancellable, error)) goto out; - upgrader = ostree_sysroot_upgrader_new (sysroot, cancellable, error); + upgrader = ostree_sysroot_upgrader_new_for_os (sysroot, opt_osname, + cancellable, error); if (!upgrader) goto out;