mirror of
https://github.com/tiann/KernelSU.git
synced 2025-02-20 11:43:32 +08:00
ksud: check image before shrink
This commit is contained in:
parent
81f15ef120
commit
e0802b0d15
@ -254,7 +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(),
|
||||
Module::Shrink => module::shrink_ksu_images(),
|
||||
}
|
||||
}
|
||||
Commands::Install => event::install(),
|
||||
|
@ -674,11 +674,20 @@ pub fn list_modules() -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn shrink_image() -> Result<()> {
|
||||
pub fn shrink_image(img: &str) -> Result<()> {
|
||||
check_image(img)?;
|
||||
Command::new("resize2fs")
|
||||
.arg("-M")
|
||||
.arg(defs::MODULE_IMG)
|
||||
.arg(img)
|
||||
.stdout(Stdio::piped())
|
||||
.status()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn shrink_ksu_images() -> Result<()> {
|
||||
shrink_image(defs::MODULE_IMG)?;
|
||||
if Path::new(defs::MODULE_UPDATE_IMG).exists() {
|
||||
shrink_image(defs::MODULE_UPDATE_IMG)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user