Skip to content

Commit

Permalink
fix: fetch latest ArchLinux ISO by default
Browse files Browse the repository at this point in the history
  • Loading branch information
cilki committed May 14, 2024
1 parent 85cfc7a commit c9ff5f9
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions goldboot/src/foundry/molds/arch_linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ impl Prompt for ArchLinux {

impl DefaultSource for ArchLinux {
fn default_source(&self, _: ImageArch) -> Result<ImageSource> {
Ok(ImageSource::Iso {
url: "https://mirrors.edge.kernel.org/archlinux/iso/2024.01.01/archlinux-2024.01.01-x86_64.iso".to_string(),
checksum: Some("sha256:12addd7d4154df1caf5f258b80ad72e7a724d33e75e6c2e6adc1475298d47155".to_string()),
})
fetch_latest_iso()
}
}

Expand Down Expand Up @@ -161,15 +158,17 @@ impl ArchLinuxMirrorlist {
/// Fetch the latest installation ISO
fn fetch_latest_iso() -> Result<ImageSource> {
let rs = reqwest::blocking::get(format!(
"http://mirror.fossable.org/archlinux/iso/latest/sha256sums.txt"
"http://mirrors.edge.kernel.org/archlinux/iso/latest/sha256sums.txt"
))?;
if rs.status().is_success() {
for line in BufReader::new(rs).lines().filter_map(|result| result.ok()) {
if line.ends_with(".iso") {
let split: Vec<&str> = line.split_whitespace().collect();
if let [hash, filename] = split[..] {
return Ok(ImageSource::Iso {
url: format!("http://mirror.fossable.org/archlinux/iso/latest/{filename}"),
url: format!(
"http://mirrors.edge.kernel.org/archlinux/iso/latest/{filename}"
),
checksum: Some(format!("sha256:{hash}")),
});
}
Expand All @@ -189,9 +188,9 @@ pub struct ArchLinuxPackages {
mod tests {
use super::*;

// #[test]
// fn test_fetch_latest_iso() -> Result<()> {
// fetch_latest_iso()?;
// Ok(())
// }
#[test]
fn test_fetch_latest_iso() -> Result<()> {
fetch_latest_iso()?;
Ok(())
}
}

0 comments on commit c9ff5f9

Please sign in to comment.