fix29: удалён legacy, введён Debian 13-only и обновлён rollback
This commit is contained in:
@@ -213,6 +213,7 @@ impl Config {
|
||||
}
|
||||
|
||||
pub fn validate_runtime(&self) -> anyhow::Result<()> {
|
||||
self.check_supported_host()?;
|
||||
self.check_host_tools()
|
||||
}
|
||||
|
||||
@@ -256,6 +257,52 @@ impl Config {
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn check_supported_host(&self) -> anyhow::Result<()> {
|
||||
let os_release = std::fs::read_to_string("/etc/os-release").map_err(|_| {
|
||||
anyhow::anyhow!(
|
||||
"unsupported host: missing /etc/os-release; only Debian 13 amd64 is supported"
|
||||
)
|
||||
})?;
|
||||
|
||||
let mut id = String::new();
|
||||
let mut version_id = String::new();
|
||||
for line in os_release.lines() {
|
||||
if let Some((k, v)) = line.split_once('=') {
|
||||
let val = v.trim_matches('"');
|
||||
match k {
|
||||
"ID" => id = val.to_string(),
|
||||
"VERSION_ID" => version_id = val.to_string(),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if id != "debian" || version_id != "13" {
|
||||
anyhow::bail!(
|
||||
"unsupported host: only Debian 13 amd64 is supported (got ID={id}, VERSION_ID={version_id})"
|
||||
);
|
||||
}
|
||||
|
||||
let arch = std::process::Command::new("dpkg")
|
||||
.args(["--print-architecture"])
|
||||
.output()
|
||||
.ok()
|
||||
.and_then(|o| {
|
||||
if o.status.success() {
|
||||
Some(String::from_utf8_lossy(&o.stdout).trim().to_string())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.unwrap_or_else(|| std::env::consts::ARCH.to_string());
|
||||
|
||||
if arch != "amd64" && arch != "x86_64" {
|
||||
anyhow::bail!("unsupported host arch: {arch}; only Debian 13 amd64 is supported");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_hhmm(v: &str) -> anyhow::Result<()> {
|
||||
|
||||
Reference in New Issue
Block a user