upgrade: Don't require specification of osname
Since this is a highly visible command, let's have a sane default and upgrade the currently running OS.
This commit is contained in:
parent
82f444020e
commit
18af230e17
|
|
@ -1 +1 @@
|
|||
Subproject commit 51736db5f49b4b798fd2f9d0ccb8eff453105162
|
||||
Subproject commit b2a65b235600e340fada441de7e131de9d52d25e
|
||||
|
|
@ -40,23 +40,33 @@ ot_admin_builtin_upgrade (int argc, char **argv, OtAdminBuiltinOpts *admin_opts,
|
|||
GOptionContext *context;
|
||||
gboolean ret = FALSE;
|
||||
GFile *ostree_dir = admin_opts->ostree_dir;
|
||||
gs_free char *booted_osname = NULL;
|
||||
const char *osname = NULL;
|
||||
gs_free char *ostree_dir_arg = NULL;
|
||||
__attribute__((unused)) GCancellable *cancellable = NULL;
|
||||
|
||||
context = g_option_context_new ("OSNAME - pull, deploy, and prune");
|
||||
context = g_option_context_new ("[OSNAME] - pull, deploy, and prune");
|
||||
g_option_context_add_main_entries (context, options, NULL);
|
||||
|
||||
if (!g_option_context_parse (context, &argc, &argv, error))
|
||||
goto out;
|
||||
|
||||
if (argc < 2)
|
||||
if (argc > 1)
|
||||
{
|
||||
ot_util_usage_error (context, "OSNAME must be specified", error);
|
||||
goto out;
|
||||
osname = argv[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ot_admin_get_active_deployment (NULL, &booted_osname, NULL, cancellable, error))
|
||||
goto out;
|
||||
if (booted_osname == NULL)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"Not in an active OSTree system; must specify OSNAME");
|
||||
goto out;
|
||||
}
|
||||
osname = booted_osname;
|
||||
}
|
||||
|
||||
osname = argv[1];
|
||||
|
||||
ostree_dir_arg = g_strconcat ("--ostree-dir=",
|
||||
gs_file_get_path_cached (ostree_dir),
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ ot_admin_get_active_deployment (GFile *ostree_dir,
|
|||
if (!ot_admin_get_booted_os (&ret_osname, NULL, cancellable, error))
|
||||
goto out;
|
||||
|
||||
if (ret_osname != NULL)
|
||||
if (ret_osname != NULL && out_deployment != NULL)
|
||||
{
|
||||
gs_unref_object GFile *rootfs_path = NULL;
|
||||
gs_unref_object GFileInfo *rootfs_info = NULL;
|
||||
|
|
|
|||
Loading…
Reference in New Issue