ksud: dropped magic_mount for stability so welcome back OverlayFS

manager: brought back shrink images in settings
This commit is contained in:
Rifat Azad
2024-12-24 04:21:38 +06:00
parent f0d235c266
commit a0540aa8ec
16 changed files with 1246 additions and 742 deletions
+25 -10
View File
@@ -1,13 +1,12 @@
use anyhow::{Ok, Result};
use clap::Parser;
use std::path::{Path, PathBuf};
use std::path::PathBuf;
#[cfg(target_os = "android")]
use android_logger::Config;
#[cfg(target_os = "android")]
use log::LevelFilter;
use crate::defs::KSUD_VERBOSE_LOG_FILE;
use crate::{apk_sign, assets, debug, defs, init_event, ksucalls, module, utils};
/// KernelSU-Next userspace cli
@@ -16,9 +15,6 @@ use crate::{apk_sign, assets, debug, defs, init_event, ksucalls, module, utils};
struct Args {
#[command(subcommand)]
command: Commands,
#[arg(short, long, default_value_t = cfg!(debug_assertions))]
verbose: bool,
}
#[derive(clap::Subcommand, Debug)]
@@ -165,6 +161,17 @@ enum Debug {
Mount,
/// Copy sparse file
Xcp {
/// source file
src: String,
/// destination file
dst: String,
/// punch hole
#[arg(short, long, default_value = "false")]
punch_hole: bool,
},
/// For testing
Test,
}
@@ -230,6 +237,9 @@ enum Module {
/// list all modules
List,
/// Shrink module image size
Shrink,
}
#[derive(clap::Subcommand, Debug)]
@@ -291,10 +301,6 @@ pub fn run() -> Result<()> {
let cli = Args::parse();
if !cli.verbose && !Path::new(KSUD_VERBOSE_LOG_FILE).exists() {
log::set_max_level(LevelFilter::Info);
}
log::info!("command: {:?}", cli.command);
let result = match cli.command {
@@ -315,6 +321,7 @@ pub fn run() -> Result<()> {
Module::Disable { id } => module::disable_module(&id),
Module::Action { id } => module::run_action(&id),
Module::List => module::list_modules(),
Module::Shrink => module::shrink_ksu_images(),
}
}
Commands::Install { magiskboot } => utils::install(magiskboot),
@@ -348,7 +355,15 @@ pub fn run() -> Result<()> {
Ok(())
}
Debug::Su { global_mnt } => crate::su::grant_root(global_mnt),
Debug::Mount => init_event::mount_modules_systemlessly(),
Debug::Mount => init_event::mount_modules_systemlessly(defs::MODULE_DIR),
Debug::Xcp {
src,
dst,
punch_hole,
} => {
utils::copy_sparse_file(src, dst, punch_hole)?;
Ok(())
}
Debug::Test => assets::ensure_binaries(false),
},