From ac4b1fbb482de9da5c74c2820054680a797d116c Mon Sep 17 00:00:00 2001 From: Douglas Schilling Landgraf Date: Sat, 9 Dec 2023 09:25:42 -0500 Subject: [PATCH] [WIP] initoverlayfs: Add initial initoverlayfs support This patch adds the option to use initoverlayfs project with Signed-off-by: Douglas Schilling Landgraf foo --- rust/src/cliwrap/kernel_install.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/rust/src/cliwrap/kernel_install.rs b/rust/src/cliwrap/kernel_install.rs index cc2a0077b0..0237d29f33 100644 --- a/rust/src/cliwrap/kernel_install.rs +++ b/rust/src/cliwrap/kernel_install.rs @@ -64,6 +64,20 @@ fn redo_systemctl_wrap() -> Result<()> { Ok(()) } +#[context("Running initoverlayfs")] +fn run_initoverlayfs() -> Result<()> { + const INITOVERLAY_INSTALL_CMD: &str = "initoverlayfs-install"; + + if let Err(err) = cliutil::exec_real_binary(INITOVERLAY_INSTALL_CMD, &empty_argv) { + return Err(anyhow!( + "Error: Command '{}' failed with: {}", + INITOVERLAY_INSTALL_CMD, + err + )); + } + Ok(()) +} + #[context("Running dracut")] fn run_dracut(kernel_dir: &str) -> Result<()> { let root_fs = Utf8Dir::open_ambient_dir("/", cap_std::ambient_authority())?; @@ -108,5 +122,10 @@ fn run_dracut(kernel_dir: &str) -> Result<()> { &root_fs, (Utf8Path::new("lib/modules").join(kernel_dir)).join("initramfs.img"), )?; + + if let Err(error) = run_initoverlayfs() { + return Err(anyhow!("Failed to execute initoverlayfs: {}", error)); + } + Ok(()) }