Compare commits

...

2 Commits

Author SHA1 Message Date
nkraetzschmar 09301d478b
Merge 76e563900e into 321c202e7c 2024-11-25 16:36:18 -05:00
nkraetzschmar 76e563900e boot: add reboot-on-error config option
Enabling this option will cause the system to reboot in case the selected
entry fails to load.
2024-11-14 13:06:42 +01:00
2 changed files with 20 additions and 2 deletions

View File

@ -399,6 +399,14 @@ sbvarsign --attr "${attr}" --key KEK.key --cert KEK.pem --output db.auth db db.e
<xi:include href="version-info.xml" xpointer="v251"/></listitem>
</varlistentry>
<varlistentry>
<term>reboot-on-error</term>
<listitem><para>Takes a boolean argument. Enable or disable (the default) auto reboot in case the selected entry fails to start.</para>
<xi:include href="version-info.xml" xpointer="v257"/></listitem>
</varlistentry>
</variablelist>
</refsect1>

View File

@ -97,6 +97,7 @@ typedef struct {
bool auto_poweroff;
bool auto_reboot;
bool reboot_for_bitlocker;
bool reboot_on_err;
secure_boot_enroll secure_boot_enroll;
bool force_menu;
bool use_saved_entry;
@ -538,6 +539,7 @@ static void print_status(Config *config, char16_t *loaded_image_path) {
printf(" auto-reboot: %ls\n", yes_no(config->auto_reboot));
printf(" beep: %ls\n", yes_no(config->beep));
printf(" reboot-for-bitlocker: %ls\n", yes_no(config->reboot_for_bitlocker));
printf(" reboot-on-error: %ls\n", yes_no(config->reboot_on_err));
switch (config->secure_boot_enroll) {
case ENROLL_OFF:
@ -1276,6 +1278,10 @@ static void config_defaults_load_from_file(Config *config, char *content) {
log_error("Error parsing 'reboot-for-bitlocker' config option, ignoring: %s",
value);
} else if (streq8(key, "reboot-on-error")) {
if (!parse_boolean(value, &config->reboot_on_err))
log_error("Error parsing 'reboot-on-error' config option, ignoring: %s", value);
} else if (streq8(key, "secure-boot-enroll")) {
if (streq8(value, "manual"))
config->secure_boot_enroll = ENROLL_MANUAL;
@ -2946,8 +2952,12 @@ static EFI_STATUS run(EFI_HANDLE image) {
(void) process_random_seed(root_dir);
err = image_start(image, entry);
if (err != EFI_SUCCESS)
return err;
if (err != EFI_SUCCESS) {
if (config.reboot_on_err)
reboot_system();
else
return err;
}
menu = true;
config.timeout_sec = 0;