1
0
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:
Bruce Leidl 2019-01-05 20:15:37 -05:00
parent b7b27b039c
commit 2bab6a438f

View File

@ -12,11 +12,13 @@ const LOSETUP: &str = "/sbin/losetup";
/// 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> {
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")?;
Ok(VerityOutput::parse(&output))
}
pub fn generate_image_hashtree<P: AsRef<Path>>(image: P, metainfo: &MetaInfo) -> Result<VerityOutput> {
let args = format!("--hash-offset={} --data-blocks={} --salt={} format {} {}",
metainfo.nblocks() * 4096, metainfo.nblocks(), metainfo.verity_salt(),