mirror of
https://github.com/ostreedev/ostree.git
synced 2025-01-05 13:18:17 +03:00
cmd/grub2-generate: Port to C99 style
Just keeping up momentum.
This commit is contained in:
parent
767ca134b5
commit
75a43deb30
@ -33,28 +33,21 @@ ot_admin_instutil_builtin_grub2_generate (int argc, char **argv,
|
|||||||
OstreeCommandInvocation *invocation,
|
OstreeCommandInvocation *invocation,
|
||||||
GCancellable *cancellable, GError **error)
|
GCancellable *cancellable, GError **error)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
|
||||||
guint bootversion;
|
g_autoptr (GOptionContext) context = g_option_context_new ("[BOOTVERSION]");
|
||||||
g_autoptr (GOptionContext) context = NULL;
|
|
||||||
g_autoptr (OstreeSysroot) sysroot = NULL;
|
g_autoptr (OstreeSysroot) sysroot = NULL;
|
||||||
|
|
||||||
context = g_option_context_new ("[BOOTVERSION]");
|
|
||||||
|
|
||||||
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
|
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
|
||||||
OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER
|
OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER
|
||||||
| OSTREE_ADMIN_BUILTIN_FLAG_UNLOCKED,
|
| OSTREE_ADMIN_BUILTIN_FLAG_UNLOCKED,
|
||||||
invocation, &sysroot, cancellable, error))
|
invocation, &sysroot, cancellable, error))
|
||||||
goto out;
|
return FALSE;
|
||||||
|
|
||||||
|
guint bootversion;
|
||||||
if (argc >= 2)
|
if (argc >= 2)
|
||||||
{
|
{
|
||||||
bootversion = (guint)g_ascii_strtoull (argv[1], NULL, 10);
|
bootversion = (guint)g_ascii_strtoull (argv[1], NULL, 10);
|
||||||
if (!(bootversion == 0 || bootversion == 1))
|
if (!(bootversion == 0 || bootversion == 1))
|
||||||
{
|
return glnx_throw (error, "Invalid bootversion: %u", bootversion);
|
||||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Invalid bootversion: %u",
|
|
||||||
bootversion);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -66,11 +59,6 @@ ot_admin_instutil_builtin_grub2_generate (int argc, char **argv,
|
|||||||
g_assert (bootversion == 0 || bootversion == 1);
|
g_assert (bootversion == 0 || bootversion == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ostree_cmd__private__ ()->ostree_generate_grub2_config (sysroot, bootversion, 1, cancellable,
|
return ostree_cmd__private__ ()->ostree_generate_grub2_config (sysroot, bootversion, 1,
|
||||||
error))
|
cancellable, error);
|
||||||
goto out;
|
|
||||||
|
|
||||||
ret = TRUE;
|
|
||||||
out:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user