bootstrap: verify signatures

This commit is contained in:
Mikaël Cluseau
2025-07-06 15:43:42 +02:00
parent 8fcd2d6684
commit f45fbe116e
9 changed files with 127 additions and 24 deletions

View File

@ -257,10 +257,19 @@ async fn mount(src: Option<&str>, dst: &str, fstype: &str, opts: Option<&str>) {
error!("failed to create dir {dst}: {e}");
}
let mut is_file = false;
if let Some(src) = src {
retry_or_ignore(async || {
is_file = (fs::metadata(src).await)
.map_err(|e| format_err!("stat {src} failed: {e}"))?
.is_file();
Ok(())
})
.await;
match fstype {
"ext4" => {
exec("fsck", &["-p", src]).await;
exec("fsck.ext4", &["-p", src]).await;
}
_ => {}
}
@ -272,12 +281,10 @@ async fn mount(src: Option<&str>, dst: &str, fstype: &str, opts: Option<&str>) {
}
retry_or_ignore(async || {
// check source, use a loopdev if needed
if let Some(src) = src {
if fs::metadata(src).await?.is_file() {
// loopdev crate has annoying dependencies, just use the normal mount program
return try_exec("mount", &args).await;
}
// if it's a file, we need to use a loopdev
if is_file {
// loopdev crate has annoying dependencies, just use the normal mount program
return try_exec("mount", &args).await;
}
let (cmd_str, _) = cmd_str("mount", &args);