Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

status: Rename query-booted to is-default #3136

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions man/ostree-admin-status.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ License along with this library. If not, see <https://www.gnu.org/licenses/>.
</varlistentry>

<varlistentry>
<term><option>-Q, --query-booted</option></term>
<term><option>-D, --is-default</option></term>

<listitem><para>
Output the string <literal>default</literal> if the default deployment
Expand All @@ -111,7 +111,7 @@ License along with this library. If not, see <https://www.gnu.org/licenses/>.
</varlistentry>

<varlistentry>
<term><option>--version</option>--version</term>
<term><option>--version</option></term>

<listitem><para>
Print version information and exit
Expand Down
28 changes: 12 additions & 16 deletions src/ostree/ot-admin-builtin-status.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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");
Expand Down
Loading