ksud: refine su and make it compitable with MagiskSU

Supported features:

1.  --mount-master, -M, -mm which would make the command run in global mount namespace.
2. - user to switch a specific user's shell.
3. -v, -V to print version code and name.

fix #330 #306 #305 #32
This commit is contained in:
tiann
2023-04-04 13:50:36 +08:00
parent 6fc8cc7e8e
commit 48e76f9096
6 changed files with 227 additions and 32 deletions

View File

@@ -141,7 +141,7 @@ pub fn run() -> Result<()> {
// the kernel executes su with argv[0] = "su" and replace it with us
let arg0 = std::env::args().next().unwrap_or_default();
if arg0 == "su" || arg0 == "/system/bin/su" {
return crate::ksu::grant_root();
return crate::ksu::root_shell();
}
let cli = Args::parse();