Remove optional command run in limits

This commit is contained in:
NGnius (Graham) 2024-03-31 14:26:01 -04:00
parent ccf0c04020
commit 9acc08a599
4 changed files with 3 additions and 33 deletions

View file

@ -24,7 +24,6 @@ impl Default for Base {
dmi: None,
cpuinfo: None,
os: None,
command: None,
file_exists: Some("/etc/powertools_dev_mode".into()),
},
limits: super::Limits {
@ -48,7 +47,6 @@ impl Default for Base {
dmi: None,
cpuinfo: Some("model name\t: AMD Custom APU 0405\n".to_owned()),
os: None,
command: None,
file_exists: None,
},
limits: super::Limits {
@ -72,7 +70,6 @@ impl Default for Base {
dmi: None,
cpuinfo: Some("model name\t: AMD Custom APU 0932\n".to_owned()),
os: None,
command: None,
file_exists: None,
},
limits: super::Limits {
@ -96,7 +93,6 @@ impl Default for Base {
dmi: None,
cpuinfo: Some("model name\t+: AMD Ryzen 3 2300U\n".to_owned()),
os: None,
command: None,
file_exists: None,
},
limits: super::Limits {
@ -140,7 +136,6 @@ impl Default for Base {
dmi: None,
cpuinfo: Some("model name\t+: AMD Ryzen 5 5560U\n".to_owned()),
os: None,
command: None,
file_exists: None,
},
limits: super::Limits {
@ -184,7 +179,6 @@ impl Default for Base {
dmi: None,
cpuinfo: Some("model name\t+: AMD Ryzen 7 5825U\n".to_owned()),
os: None,
command: None,
file_exists: None,
},
limits: super::Limits {
@ -228,7 +222,6 @@ impl Default for Base {
dmi: None,
cpuinfo: Some("model name\t+: AMD Ryzen 7 6800U( with Radeon Graphics)?\n".to_owned()),
os: None,
command: None,
file_exists: None,
},
limits: super::Limits {
@ -272,7 +265,6 @@ impl Default for Base {
dmi: None,
cpuinfo: Some("model name\\s+: AMD Ryzen 7 7840U( w\\/ Radeon 780M Graphics)?\n".to_owned()),
os: None,
command: None,
file_exists: None,
},
limits: super::Limits {
@ -316,7 +308,6 @@ impl Default for Base {
dmi: None,
cpuinfo: None,
os: None,
command: None,
file_exists: None,
},
limits: super::Limits {

View file

@ -9,8 +9,6 @@ pub struct Conditions {
pub cpuinfo: Option<String>,
/// Regex pattern for /etc/os-release reading
pub os: Option<String>,
/// Custom command to run, where an exit code of 0 means a successful match
pub command: Option<String>,
/// Check if file exists
pub file_exists: Option<String>,
}
@ -20,7 +18,6 @@ impl Conditions {
self.dmi.is_none()
&& self.cpuinfo.is_none()
&& self.os.is_none()
&& self.command.is_none()
&& self.file_exists.is_none()
}
}

View file

@ -6,7 +6,6 @@
"dmi": null,
"cpuinfo": null,
"os": null,
"command": null,
"file_exists": "/etc/powertools_dev_mode"
},
"limits": {
@ -391,7 +390,6 @@
"dmi": null,
"cpuinfo": "model name\t: AMD Custom APU 0405\n",
"os": null,
"command": null,
"file_exists": null
},
"limits": {
@ -604,8 +602,8 @@
"extras": {
"experiments": false,
"quirks": [
"pp_dpm_fclk-not-updated-on-LCD",
"pp_dpm_fclk-reversed"
"pp_dpm_fclk-reversed",
"pp_dpm_fclk-not-updated-on-LCD"
]
}
}
@ -641,7 +639,6 @@
"dmi": null,
"cpuinfo": "model name\t: AMD Custom APU 0932\n",
"os": null,
"command": null,
"file_exists": null
},
"limits": {
@ -870,8 +867,8 @@
"extras": {
"experiments": false,
"quirks": [
"pp_dpm_fclk-not-updated-on-LCD",
"pp_dpm_fclk-reversed",
"pp_dpm_fclk-not-updated-on-LCD",
"clock-autodetect"
]
}
@ -908,7 +905,6 @@
"dmi": null,
"cpuinfo": "model name\t+: AMD Ryzen 3 2300U\n",
"os": null,
"command": null,
"file_exists": null
},
"limits": {
@ -1062,7 +1058,6 @@
"dmi": null,
"cpuinfo": "model name\t+: AMD Ryzen 5 5560U\n",
"os": null,
"command": null,
"file_exists": null
},
"limits": {
@ -1376,7 +1371,6 @@
"dmi": null,
"cpuinfo": "model name\t+: AMD Ryzen 7 5825U\n",
"os": null,
"command": null,
"file_exists": null
},
"limits": {
@ -1770,7 +1764,6 @@
"dmi": null,
"cpuinfo": "model name\t+: AMD Ryzen 7 6800U( with Radeon Graphics)?\n",
"os": null,
"command": null,
"file_exists": null
},
"limits": {
@ -2164,7 +2157,6 @@
"dmi": null,
"cpuinfo": "model name\\s+: AMD Ryzen 7 7840U( w\\/ Radeon 780M Graphics)?\n",
"os": null,
"command": null,
"file_exists": null
},
"limits": {
@ -2552,7 +2544,6 @@
"dmi": null,
"cpuinfo": null,
"os": null,
"command": null,
"file_exists": null
},
"limits": {

View file

@ -111,15 +111,6 @@ pub fn auto_detect0(
.expect("Invalid OS regex");
matches &= pattern.is_match(&os_info);
}
if let Some(cmd) = &conditions.command {
match std::process::Command::new("bash")
.args(["-c", cmd])
.status()
{
Ok(status) => matches &= status.code().map(|c| c == 0).unwrap_or(false),
Err(e) => log::warn!("Ignoring bash limits error: {}", e),
}
}
if let Some(file_exists) = &conditions.file_exists {
let exists = std::path::Path::new(file_exists).exists();
matches &= exists;