Skip to content

Commit a5e8205

Browse files
gucci-on-fleekJohan-Liebert1
authored andcommitted
Support SHA-512 digests in composefs-setup-root
See also #199. Signed-off-by: Max Chernoff <git@maxchernoff.ca>
1 parent 0c61346 commit a5e8205

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

  • crates/composefs-setup-root/src

crates/composefs-setup-root/src/main.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,19 @@ fn open_root_fs(path: &Path) -> Result<OwnedFd> {
179179
}
180180

181181
fn mount_composefs_image(sysroot: &OwnedFd, name: &str, insecure: bool) -> Result<OwnedFd> {
182-
let mut repo = Repository::<Sha256HashValue>::open_path(sysroot, "composefs")?;
183-
repo.set_insecure(insecure);
184-
repo.mount(name).context("Failed to mount composefs image")
182+
match name.len() {
183+
128 => {
184+
let mut repo = Repository::<Sha512HashValue>::open_path(sysroot, "composefs")?;
185+
repo.set_insecure(insecure);
186+
repo.mount(name).context("Failed to mount composefs image")
187+
}
188+
64 => {
189+
let mut repo = Repository::<Sha256HashValue>::open_path(sysroot, "composefs")?;
190+
repo.set_insecure(insecure);
191+
repo.mount(name).context("Failed to mount composefs image")
192+
}
193+
_ => anyhow::bail!("Invalid composefs digest length: {}", name.len()),
194+
}
185195
}
186196

187197
fn mount_subdir(

0 commit comments

Comments
 (0)