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:
1 parent
82f444020e
commit
18af230e17
3 files changed
+18
-8
No files matched your search
+1
-1
Submodule src/libgsystem updated: 51736db5f4...b2a65b2356.
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user