forked from brl/citadel-tools
No need to use a loop device here
This commit is contained in:
parent
58a58e234f
commit
140257208a
@ -32,16 +32,14 @@ pub fn generate_image_hashtree<P: AsRef<Path>>(image: P, metainfo: &MetaInfo) ->
|
|||||||
|
|
||||||
pub fn verify_image<P: AsRef<Path>>(image: P, metainfo: &MetaInfo) -> Result<bool> {
|
pub fn verify_image<P: AsRef<Path>>(image: P, metainfo: &MetaInfo) -> Result<bool> {
|
||||||
let arg_offset = format!("--hash-offset={}", metainfo.nblocks() * 4096);
|
let arg_offset = format!("--hash-offset={}", metainfo.nblocks() * 4096);
|
||||||
let loopdev = create_image_loop_device(image.as_ref())?;
|
let image = format!("{}", image.as_ref().display());
|
||||||
|
|
||||||
|
|
||||||
let status = Command::new(VERITYSETUP)
|
let status = Command::new(VERITYSETUP)
|
||||||
.args(&[ arg_offset.as_str(), "verify", &loopdev, &loopdev, metainfo.verity_root()])
|
.args(&[ arg_offset.as_str(), "verify", image.as_str(), image.as_str(), metainfo.verity_root()])
|
||||||
.stderr(Stdio::inherit())
|
.stderr(Stdio::inherit())
|
||||||
.status()?;
|
.status()?;
|
||||||
|
|
||||||
util::exec_cmdline(LOSETUP, format!("-d {}", loopdev))
|
|
||||||
.context("Error removing loop device created for verification")?;
|
|
||||||
|
|
||||||
Ok(status.success())
|
Ok(status.success())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user