forked from brl/citadel-tools
Fixes a panic() during mkimage
This commit is contained in:
parent
904765ae4f
commit
7b8cc0c9d4
@ -123,8 +123,7 @@ impl UpdateBuilder {
|
|||||||
let hashfile = self.config.workdir_path(self.verity_filename());
|
let hashfile = self.config.workdir_path(self.verity_filename());
|
||||||
let outfile = self.config.workdir_path("verity-format.out");
|
let outfile = self.config.workdir_path("verity-format.out");
|
||||||
|
|
||||||
let verity = Verity::new(self.image())?;
|
let output = Verity::generate_initial_hashtree(self.image(), &hashfile)?;
|
||||||
let output = verity.generate_initial_hashtree(&hashfile)?;
|
|
||||||
|
|
||||||
if let Err(err) = fs::write(outfile, output.output()) {
|
if let Err(err) = fs::write(outfile, output.output()) {
|
||||||
bail!("Failed to write veritysetup command output to a file: {}", err);
|
bail!("Failed to write veritysetup command output to a file: {}", err);
|
||||||
|
@ -24,10 +24,11 @@ impl Verity {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn generate_initial_hashtree(&self, output: impl AsRef<Path>) -> Result<VerityOutput> {
|
pub fn generate_initial_hashtree(image: impl AsRef<Path>, output: impl AsRef<Path>) -> Result<VerityOutput> {
|
||||||
|
let image = image.as_ref();
|
||||||
let output = output.as_ref();
|
let output = output.as_ref();
|
||||||
// Don't use absolute path to veritysetup so that the build will correctly find the version from cryptsetup-native
|
// Don't use absolute path to veritysetup so that the build will correctly find the version from cryptsetup-native
|
||||||
let output = cmd_with_output!("veritysetup", "format {} {}", self.path_str(), output.display())?;
|
let output = cmd_with_output!("veritysetup", "format {:?} {}", image.display(), output.display())?;
|
||||||
Ok(VerityOutput::parse(&output))
|
Ok(VerityOutput::parse(&output))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,10 +115,6 @@ impl Verity {
|
|||||||
fn path(&self) -> &Path {
|
fn path(&self) -> &Path {
|
||||||
&self.image
|
&self.image
|
||||||
}
|
}
|
||||||
|
|
||||||
fn path_str(&self) -> &str {
|
|
||||||
self.image.to_str().unwrap()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The output from the `veritysetup format` command can be parsed as key/value
|
/// The output from the `veritysetup format` command can be parsed as key/value
|
||||||
|
Loading…
Reference in New Issue
Block a user