Make firmware upgrade configurable (#739)
This change adds an option, firmware.upgrade, that if set to `false` only checks for and displays available firmware updates. If set to `true` (default) the user is offered to run the firmware upgrade.
This commit is contained in:
committed by
GitHub
parent
5ec1f4d2d6
commit
74292ef6d2
@@ -154,6 +154,13 @@ pub struct NPM {
|
||||
use_sudo: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default, Debug)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
pub struct Firmware {
|
||||
upgrade: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default, Debug)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Brew {
|
||||
@@ -212,6 +219,7 @@ pub struct ConfigFile {
|
||||
git: Option<Git>,
|
||||
windows: Option<Windows>,
|
||||
npm: Option<NPM>,
|
||||
firmware: Option<Firmware>,
|
||||
vagrant: Option<Vagrant>,
|
||||
}
|
||||
|
||||
@@ -730,6 +738,15 @@ impl Config {
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
pub fn firmware_upgrade(&self) -> bool {
|
||||
self.config_file
|
||||
.firmware
|
||||
.as_ref()
|
||||
.and_then(|firmware| firmware.upgrade)
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
str_value!(linux, emerge_sync_flags);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user