rebase,rollback,upgrade: use rpm-ostreed to reboot

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2015-10-07 08:46:30 +02:00
parent aa6415bb9c
commit 4b0b2b94f1
3 changed files with 15 additions and 20 deletions

View File

@ -49,6 +49,7 @@ get_args_variant (void)
g_variant_dict_init (&dict, NULL); g_variant_dict_init (&dict, NULL);
g_variant_dict_insert (&dict, "skip-purge", "b", opt_skip_purge); g_variant_dict_insert (&dict, "skip-purge", "b", opt_skip_purge);
g_variant_dict_insert (&dict, "reboot", "b", opt_reboot);
return g_variant_dict_end (&dict); return g_variant_dict_end (&dict);
} }
@ -114,12 +115,6 @@ rpmostree_builtin_rebase (int argc,
g_print ("Run \"systemctl reboot\" to start a reboot\n"); g_print ("Run \"systemctl reboot\" to start a reboot\n");
} }
else
{
gs_subprocess_simple_run_sync (NULL, GS_SUBPROCESS_STREAM_DISPOSITION_INHERIT,
cancellable, error,
"systemctl", "reboot", NULL);
}
ret = TRUE; ret = TRUE;

View File

@ -37,6 +37,17 @@ static GOptionEntry option_entries[] = {
{ NULL } { NULL }
}; };
static GVariant *
get_args_variant (void)
{
GVariantDict dict;
g_variant_dict_init (&dict, NULL);
g_variant_dict_insert (&dict, "reboot", "b", opt_reboot);
return g_variant_dict_end (&dict);
}
gboolean gboolean
rpmostree_builtin_rollback (int argc, rpmostree_builtin_rollback (int argc,
char **argv, char **argv,
@ -64,7 +75,7 @@ rpmostree_builtin_rollback (int argc,
goto out; goto out;
if (!rpmostree_os_call_rollback_sync (os_proxy, if (!rpmostree_os_call_rollback_sync (os_proxy,
NULL, get_args_variant (),
&transaction_address, &transaction_address,
cancellable, cancellable,
error)) error))
@ -90,12 +101,6 @@ rpmostree_builtin_rollback (int argc,
g_print ("Run \"systemctl reboot\" to start a reboot\n"); g_print ("Run \"systemctl reboot\" to start a reboot\n");
} }
else
{
gs_subprocess_simple_run_sync (NULL, GS_SUBPROCESS_STREAM_DISPOSITION_INHERIT,
cancellable, error,
"systemctl", "reboot", NULL);
}
ret = TRUE; ret = TRUE;

View File

@ -52,6 +52,7 @@ get_args_variant (void)
g_variant_dict_init (&dict, NULL); g_variant_dict_init (&dict, NULL);
g_variant_dict_insert (&dict, "allow-downgrade", "b", opt_allow_downgrade); g_variant_dict_insert (&dict, "allow-downgrade", "b", opt_allow_downgrade);
g_variant_dict_insert (&dict, "reboot", "b", opt_reboot);
return g_variant_dict_end (&dict); return g_variant_dict_end (&dict);
} }
@ -192,13 +193,7 @@ rpmostree_builtin_upgrade (int argc,
{ {
goto out; goto out;
} }
if (opt_reboot) if (!opt_reboot)
{
gs_subprocess_simple_run_sync (NULL, GS_SUBPROCESS_STREAM_DISPOSITION_INHERIT,
cancellable, error,
"systemctl", "reboot", NULL);
}
else
{ {
const char *sysroot_path; const char *sysroot_path;