handler->server = server;
handler->waitset = waitset;
handler->dry_run = dry_run;
- handler->autoboot_enabled = config_get()->autoboot_enabled;
+ handler->autoboot_enabled = config_autoboot_active(config_get());
list_init(&handler->unresolved_boot_options);
config->ipmi_bootdev = bootdev;
config->ipmi_bootdev_persistent = persistent;
- switch (bootdev) {
- case IPMI_BOOTDEV_NONE:
- case IPMI_BOOTDEV_DISK:
- case IPMI_BOOTDEV_NETWORK:
- case IPMI_BOOTDEV_CDROM:
- default:
- break;
- case IPMI_BOOTDEV_SETUP:
- config->autoboot_enabled = false;
- break;
- case IPMI_BOOTDEV_SAFE:
- config->autoboot_enabled = false;
+ if (bootdev == IPMI_BOOTDEV_SAFE)
config->safe_mode = true;
- break;
- }
}
static int read_bootdev_sysparam(const char *name, uint8_t *val)
return DEVICE_TYPE_UNKNOWN;
}
+
+bool config_autoboot_active(const struct config *config)
+{
+ enum ipmi_bootdev bootdev = config->ipmi_bootdev;
+
+ if (!config->autoboot_enabled)
+ return false;
+ if (bootdev == IPMI_BOOTDEV_SETUP || bootdev == IPMI_BOOTDEV_SAFE)
+ return false;
+
+ return true;
+}