diff --git a/userspace/ksud/src/cli.rs b/userspace/ksud/src/cli.rs index e9bd94cb7bfd..8c37821d987c 100644 --- a/userspace/ksud/src/cli.rs +++ b/userspace/ksud/src/cli.rs @@ -172,6 +172,9 @@ enum Module { /// list all modules List, + + /// Shrink module image size + Shrink, } #[derive(clap::Subcommand, Debug)] @@ -251,6 +254,7 @@ pub fn run() -> Result<()> { Module::Enable { id } => module::enable_module(&id), Module::Disable { id } => module::disable_module(&id), Module::List => module::list_modules(), + Module::Shrink => module::shrink_image(), } } Commands::Install => event::install(), diff --git a/userspace/ksud/src/module.rs b/userspace/ksud/src/module.rs index c467507560ef..b5d89ac56219 100644 --- a/userspace/ksud/src/module.rs +++ b/userspace/ksud/src/module.rs @@ -673,3 +673,12 @@ pub fn list_modules() -> Result<()> { println!("{}", serde_json::to_string_pretty(&modules)?); Ok(()) } + +pub fn shrink_image() -> Result<()> { + Command::new("resize2fs") + .arg("-M") + .arg(defs::MODULE_IMG) + .stdout(Stdio::piped()) + .status()?; + Ok(()) +}