ksud: support global mnt for debug su

This commit is contained in:
weishu
2024-02-23 17:57:40 +08:00
parent 8e448767a5
commit cbc04ff6df
2 changed files with 34 additions and 5 deletions

View File

@@ -105,7 +105,11 @@ enum Debug {
},
/// Root Shell
Su,
Su {
/// switch to gloabl mount namespace
#[arg(short, long, default_value = "false")]
global_mnt: bool,
},
/// Get kernel version
Version,
@@ -306,7 +310,7 @@ pub fn run() -> Result<()> {
println!("Kernel Version: {}", crate::ksu::get_version());
Ok(())
}
Debug::Su => crate::ksu::grant_root(),
Debug::Su { global_mnt } => crate::ksu::grant_root(global_mnt),
Debug::Mount => event::mount_systemlessly(defs::MODULE_DIR),
Debug::Xcp { src, dst } => {
utils::copy_sparse_file(src, dst)?;