From 477d472c36bee56b9af1c74c438a03c1739d086f Mon Sep 17 00:00:00 2001 From: Eric Curtin Date: Tue, 9 Jan 2024 15:23:47 +0000 Subject: [PATCH] status: Rename query-booted to is-default This is a tool to check if we are booted as default or not, just a rename before it becomes widely used. We also shortened the '-h' output for this. Signed-off-by: Eric Curtin --- man/ostree-admin-status.xml | 4 ++-- src/ostree/ot-admin-builtin-status.c | 28 ++++++++++++---------------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/man/ostree-admin-status.xml b/man/ostree-admin-status.xml index cc90312c91..aefa14db7a 100644 --- a/man/ostree-admin-status.xml +++ b/man/ostree-admin-status.xml @@ -90,7 +90,7 @@ License along with this library. If not, see . - + Output the string default if the default deployment @@ -111,7 +111,7 @@ License along with this library. If not, see . - --version + Print version information and exit diff --git a/src/ostree/ot-admin-builtin-status.c b/src/ostree/ot-admin-builtin-status.c index 386ced8a31..d05d992881 100644 --- a/src/ostree/ot-admin-builtin-status.c +++ b/src/ostree/ot-admin-builtin-status.c @@ -30,21 +30,17 @@ static gboolean opt_verify; static gboolean opt_skip_signatures; -static gboolean opt_query_booted; - -static GOptionEntry options[] = { - { "verify", 'V', 0, G_OPTION_ARG_NONE, &opt_verify, "Print the commit verification status", - NULL }, - { "skip-signatures", 'S', 0, G_OPTION_ARG_NONE, &opt_skip_signatures, "Skip signatures in output", - NULL }, - { "query-booted", 'Q', 0, G_OPTION_ARG_NONE, &opt_query_booted, - "Output the string \"default\" if the default deployment is the booted one, \"not-default\" if " - "we are booted in a non-default deployment (e.g. the user interactively chose a different " - "entry in the bootloader menu, or the bootloader rolled back automatically, etc.). If we are " - "not in a booted OSTree system, an error is returned.", - NULL }, - { NULL } -}; +static gboolean opt_is_default; + +static GOptionEntry options[] + = { { "verify", 'V', 0, G_OPTION_ARG_NONE, &opt_verify, "Print the commit verification status", + NULL }, + { "skip-signatures", 'S', 0, G_OPTION_ARG_NONE, &opt_skip_signatures, + "Skip signatures in output", NULL }, + { "is-default", 'D', 0, G_OPTION_ARG_NONE, &opt_is_default, + "Output \"default\" if booted into the default deployment, otherwise \"not-default\"", + NULL }, + { NULL } }; static gboolean deployment_print_status (OstreeSysroot *sysroot, OstreeRepo *repo, OstreeDeployment *deployment, gboolean is_booted, gboolean is_pending, gboolean is_rollback, @@ -210,7 +206,7 @@ ot_admin_builtin_status (int argc, char **argv, OstreeCommandInvocation *invocat if (booted_deployment) ostree_sysroot_query_deployments_for (sysroot, NULL, &pending_deployment, &rollback_deployment); - if (opt_query_booted) + if (opt_is_default) { if (deployments->len == 0) return glnx_throw (error, "Not in a booted OSTree system");