fix29: удалён legacy, введён Debian 13-only и обновлён rollback

This commit is contained in:
2026-05-12 17:26:41 +05:00
parent 69c737bcf4
commit 44a62cf634
23 changed files with 211 additions and 1316 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "awg2-harness"
version = "0.1.4"
version = "0.1.6"
edition = "2024"
[dependencies]
+47
View File
@@ -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<()> {