From f6930955a3b294a768e62fb2dc41241374908dc1 Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Fri, 25 Nov 2022 23:57:56 +0100 Subject: [PATCH] lanzatool: sync for every sign operation --- rust/lanzatool/Cargo.lock | 19 +++++++++++++++++++ rust/lanzatool/Cargo.toml | 1 + rust/lanzatool/src/install.rs | 4 +++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/rust/lanzatool/Cargo.lock b/rust/lanzatool/Cargo.lock index aab3de6..1c9e8b0 100644 --- a/rust/lanzatool/Cargo.lock +++ b/rust/lanzatool/Cargo.lock @@ -19,6 +19,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + [[package]] name = "bitflags" version = "1.3.2" @@ -125,6 +131,7 @@ dependencies = [ "anyhow", "clap", "goblin", + "nix", "serde", "serde_json", "tempfile", @@ -145,6 +152,18 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "nix" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e322c04a9e3440c327fca7b6c8a63e6890a32fa2ad689db972425f07e0d22abb" +dependencies = [ + "autocfg", + "bitflags", + "cfg-if", + "libc", +] + [[package]] name = "once_cell" version = "1.16.0" diff --git a/rust/lanzatool/Cargo.toml b/rust/lanzatool/Cargo.toml index 2205373..6ec5d7f 100644 --- a/rust/lanzatool/Cargo.toml +++ b/rust/lanzatool/Cargo.toml @@ -9,6 +9,7 @@ edition = "2021" anyhow = "1.0.66" clap = { version = "4.0.26", features = ["derive"] } goblin = "0.6.0" +nix = { version = "0.25.0", default-features = false, features = [ "fs" ] } serde = { version = "1.0.147", features = ["derive"] } serde_json = "1.0.89" tempfile = "3.3.0" diff --git a/rust/lanzatool/src/install.rs b/rust/lanzatool/src/install.rs index 6d28ed0..ceb1b01 100644 --- a/rust/lanzatool/src/install.rs +++ b/rust/lanzatool/src/install.rs @@ -1,6 +1,7 @@ use std::fs; use std::os::unix::prelude::PermissionsExt; use std::path::{Path, PathBuf}; +use nix::unistd::sync; use anyhow::{Context, Result}; @@ -81,10 +82,11 @@ pub fn install( signer .sign_file(&file) .with_context(|| format!("Failed to sign file {}", &file.display()))?; + sync(); } println!( - "Succesfully installed lanzaboote to '{}'", + "Successfully installed lanzaboote to '{}'", esp_paths.esp.display() );