From 5bdf22430e367799dfa66c724144b624c5479518 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Fri, 3 Apr 2015 18:03:06 +0200 Subject: logind,systemctl: add reboot to EFI firmware support --- src/systemctl/systemctl.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/systemctl/systemctl.c') diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 3158a38001..ae87e44d82 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -68,6 +68,7 @@ #include "bus-common-errors.h" #include "mkdir.h" #include "dropin.h" +#include "efivars.h" static char **arg_types = NULL; static char **arg_states = NULL; @@ -132,6 +133,7 @@ static char *arg_host = NULL; static unsigned arg_lines = 10; static OutputMode arg_output = OUTPUT_SHORT; static bool arg_plain = false; +static bool arg_firmware_setup = false; static bool original_stdout_is_tty; @@ -2928,6 +2930,12 @@ static int start_special(sd_bus *bus, char **args) { return -EPERM; } + if (arg_firmware_setup) { + r = efi_set_reboot_to_firmware(true); + if (r < 0) + return log_error_errno(r, "Cannot indicate to EFI to boot into setup mode: %m"); + } + if (a == ACTION_REBOOT && args[1]) { r = update_reboot_param_file(args[1]); if (r < 0) @@ -5971,6 +5979,7 @@ static void systemctl_help(void) { " -o --output=STRING Change journal output mode (short, short-iso,\n" " short-precise, short-monotonic, verbose,\n" " export, json, json-pretty, json-sse, cat)\n" + " --firmware-setup Tell the firmware to show the setup menu on next boot\n" " --plain Print unit dependencies as a list instead of a tree\n\n" "Unit Commands:\n" " list-units [PATTERN...] List loaded units\n" @@ -6150,6 +6159,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) { ARG_STATE, ARG_JOB_MODE, ARG_PRESET_MODE, + ARG_FIRMWARE_SETUP, }; static const struct option options[] = { @@ -6192,6 +6202,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) { { "state", required_argument, NULL, ARG_STATE }, { "recursive", no_argument, NULL, 'r' }, { "preset-mode", required_argument, NULL, ARG_PRESET_MODE }, + { "firmware-setup", no_argument, NULL, ARG_FIRMWARE_SETUP }, {} }; @@ -6432,6 +6443,10 @@ static int systemctl_parse_argv(int argc, char *argv[]) { arg_plain = true; break; + case ARG_FIRMWARE_SETUP: + arg_firmware_setup = true; + break; + case ARG_STATE: { const char *word, *state; size_t size; -- cgit v1.2.3-54-g00ecf