wget -> reqwest, now we can have openssl :)

This commit is contained in:
Mikaël Cluseau
2025-07-21 17:39:22 +02:00
parent cb62ac0ed8
commit 65f467f335

View File

@ -143,13 +143,23 @@ async fn seed_config(
}
async fn fetch_bootstrap(seed_url: &str, output_file: &str) -> Result<()> {
let tmp_file = &format!("{output_file}.new");
let _ = fs::remove_file(tmp_file).await;
try_exec("wget", &["-O", tmp_file, seed_url]).await?;
let seed_url: reqwest::Url = seed_url.parse()?;
fs::rename(tmp_file, output_file)
.await
.map_err(|e| format_err!("seed rename failed: {e}"))?;
info!(
"fetching {output_file} from {}",
seed_url.host_str().unwrap_or("<no host>")
);
let resp = reqwest::get(seed_url).await?;
if !resp.status().is_success() {
return Err(format_err!("HTTP request failed: {}", resp.status()));
}
let data = (resp.bytes().await).map_err(|e| format_err!("HTTP download failed: {e}"))?;
(fs::write(output_file, &data).await)
.map_err(|e| format_err!("output file write failed: {e}"))?;
Ok(())
}