mirror of
https://github.com/edera-dev/sprout.git
synced 2025-12-19 13:50:16 +00:00
feat(config): rename [defaults] to [options]
This commit is contained in:
@@ -138,7 +138,7 @@ version = 1
|
|||||||
path = "\\sprout\\drivers\\ext4.efi"
|
path = "\\sprout\\drivers\\ext4.efi"
|
||||||
|
|
||||||
# global options.
|
# global options.
|
||||||
[defaults]
|
[options]
|
||||||
# enable autoconfiguration by detecting bls enabled
|
# enable autoconfiguration by detecting bls enabled
|
||||||
# filesystems and generating boot entries for them.
|
# filesystems and generating boot entries for them.
|
||||||
autoconfigure = true
|
autoconfigure = true
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
[defaults]
|
[options]
|
||||||
entry = "kernel"
|
default-entry = "kernel"
|
||||||
|
|
||||||
[extractors.boot.filesystem-device-match]
|
[extractors.boot.filesystem-device-match]
|
||||||
has-item = "\\EFI\\BOOT\\kernel.efi"
|
has-item = "\\EFI\\BOOT\\kernel.efi"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
[defaults]
|
[options]
|
||||||
autoconfigure = true
|
autoconfigure = true
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
[defaults]
|
[options]
|
||||||
entry = "edera"
|
default-entry = "edera"
|
||||||
menu-timeout = 0
|
menu-timeout = 0
|
||||||
|
|
||||||
[extractors.boot.filesystem-device-match]
|
[extractors.boot.filesystem-device-match]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
[defaults]
|
[options]
|
||||||
entry = "kernel"
|
default-entry = "kernel"
|
||||||
menu-timeout = 0
|
menu-timeout = 0
|
||||||
|
|
||||||
[extractors.boot.filesystem-device-match]
|
[extractors.boot.filesystem-device-match]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
[defaults]
|
[options]
|
||||||
entry = "shell"
|
default-entry = "shell"
|
||||||
menu-timeout = 0
|
menu-timeout = 0
|
||||||
|
|
||||||
[extractors.boot.filesystem-device-match]
|
[extractors.boot.filesystem-device-match]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
[defaults]
|
[options]
|
||||||
entry = "xen"
|
default-entry = "xen"
|
||||||
menu-timeout = 0
|
menu-timeout = 0
|
||||||
|
|
||||||
[extractors.boot.filesystem-device-match]
|
[extractors.boot.filesystem-device-match]
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ pub struct RootConfiguration {
|
|||||||
pub version: u32,
|
pub version: u32,
|
||||||
/// Default options for Sprout.
|
/// Default options for Sprout.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub defaults: DefaultsConfiguration,
|
pub options: OptionsConfiguration,
|
||||||
/// Values to be inserted into the root sprout context.
|
/// Values to be inserted into the root sprout context.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub values: BTreeMap<String, String>,
|
pub values: BTreeMap<String, String>,
|
||||||
@@ -65,16 +65,18 @@ pub struct RootConfiguration {
|
|||||||
pub phases: PhasesConfiguration,
|
pub phases: PhasesConfiguration,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Default configuration for Sprout, used when the corresponding options are not specified.
|
/// Options configuration for Sprout, used when the corresponding options are not specified.
|
||||||
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
||||||
pub struct DefaultsConfiguration {
|
pub struct OptionsConfiguration {
|
||||||
/// The entry to boot without showing the boot menu.
|
/// The entry to boot without showing the boot menu.
|
||||||
/// If not specified, a boot menu is shown.
|
/// If not specified, a boot menu is shown.
|
||||||
pub entry: Option<String>,
|
#[serde(rename = "default-entry", default)]
|
||||||
|
pub default_entry: Option<String>,
|
||||||
/// The timeout of the boot menu.
|
/// The timeout of the boot menu.
|
||||||
#[serde(rename = "menu-timeout", default = "default_menu_timeout")]
|
#[serde(rename = "menu-timeout", default = "default_menu_timeout")]
|
||||||
pub menu_timeout: u64,
|
pub menu_timeout: u64,
|
||||||
/// Enables autoconfiguration of Sprout based on the environment.
|
/// Enables autoconfiguration of Sprout based on the environment.
|
||||||
|
#[serde(default)]
|
||||||
pub autoconfigure: bool,
|
pub autoconfigure: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ fn run() -> Result<()> {
|
|||||||
|
|
||||||
// If --autoconfigure is specified or the loaded configuration has autoconfigure enabled,
|
// If --autoconfigure is specified or the loaded configuration has autoconfigure enabled,
|
||||||
// trigger the autoconfiguration mechanism.
|
// trigger the autoconfiguration mechanism.
|
||||||
if context.root().options().autoconfigure || config.defaults.autoconfigure {
|
if context.root().options().autoconfigure || config.options.autoconfigure {
|
||||||
autoconfigure::autoconfigure(&mut config).context("unable to autoconfigure")?;
|
autoconfigure::autoconfigure(&mut config).context("unable to autoconfigure")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ fn run() -> Result<()> {
|
|||||||
entry.restamp_title();
|
entry.restamp_title();
|
||||||
|
|
||||||
// Mark this entry as the default entry if it is declared as such.
|
// Mark this entry as the default entry if it is declared as such.
|
||||||
if let Some(ref default_entry) = config.defaults.entry {
|
if let Some(ref default_entry) = config.options.default_entry {
|
||||||
// If the entry matches the default entry, mark it as the default entry.
|
// If the entry matches the default entry, mark it as the default entry.
|
||||||
if entry.is_match(default_entry) {
|
if entry.is_match(default_entry) {
|
||||||
entry.mark_default();
|
entry.mark_default();
|
||||||
@@ -211,7 +211,7 @@ fn run() -> Result<()> {
|
|||||||
.root()
|
.root()
|
||||||
.options()
|
.options()
|
||||||
.menu_timeout
|
.menu_timeout
|
||||||
.unwrap_or(config.defaults.menu_timeout);
|
.unwrap_or(config.options.menu_timeout);
|
||||||
let menu_timeout = Duration::from_secs(menu_timeout);
|
let menu_timeout = Duration::from_secs(menu_timeout);
|
||||||
|
|
||||||
// Use the forced boot entry if possible, otherwise pick the first entry using a boot menu.
|
// Use the forced boot entry if possible, otherwise pick the first entry using a boot menu.
|
||||||
|
|||||||
Reference in New Issue
Block a user