forked from brl/citadel-tools
When generating initial hashtree, use $PATH to find veritysetup
The initial hashtree is generated during the yocto build, so we want to use veritysetup from the path (to use cryptsetup-native) rather than try to find veritysetup on the build host.
This commit is contained in:
parent
b7b27b039c
commit
2bab6a438f
@ -12,11 +12,13 @@ const LOSETUP: &str = "/sbin/losetup";
|
|||||||
/// Parse output from veritysetup command and return as `VerityOutput`.
|
/// Parse output from veritysetup command and return as `VerityOutput`.
|
||||||
pub fn generate_initial_hashtree<P: AsRef<Path>, Q:AsRef<Path>>(source: P, hashtree: Q) -> Result<VerityOutput> {
|
pub fn generate_initial_hashtree<P: AsRef<Path>, Q:AsRef<Path>>(source: P, hashtree: Q) -> Result<VerityOutput> {
|
||||||
let args = format!("format {} {}", source.as_ref().display(), hashtree.as_ref().display());
|
let args = format!("format {} {}", source.as_ref().display(), hashtree.as_ref().display());
|
||||||
let output = util::exec_cmdline_with_output(VERITYSETUP, args)
|
// Don't use absolute path to veritysetup so that the build will correctly find the version from cryptsetup-native
|
||||||
|
let output = util::exec_cmdline_with_output("veritysetup", args)
|
||||||
.context("creating initial hashtree with veritysetup format failed")?;
|
.context("creating initial hashtree with veritysetup format failed")?;
|
||||||
Ok(VerityOutput::parse(&output))
|
Ok(VerityOutput::parse(&output))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn generate_image_hashtree<P: AsRef<Path>>(image: P, metainfo: &MetaInfo) -> Result<VerityOutput> {
|
pub fn generate_image_hashtree<P: AsRef<Path>>(image: P, metainfo: &MetaInfo) -> Result<VerityOutput> {
|
||||||
let args = format!("--hash-offset={} --data-blocks={} --salt={} format {} {}",
|
let args = format!("--hash-offset={} --data-blocks={} --salt={} format {} {}",
|
||||||
metainfo.nblocks() * 4096, metainfo.nblocks(), metainfo.verity_salt(),
|
metainfo.nblocks() * 4096, metainfo.nblocks(), metainfo.verity_salt(),
|
||||||
|
Loading…
Reference in New Issue
Block a user