ksud: added module restore cmd, replaced pkg id for debug and uninstall manager and changed banner

manager: implement restore module UI
This commit is contained in:
Rifat Azad
2024-12-19 17:33:20 +06:00
parent 3556e4a7d7
commit 187721891d
7 changed files with 116 additions and 39 deletions

View File

@@ -3,3 +3,7 @@
| ' // _ \ '__| '_ \ / _ \ \___ \| | | |
| . \ __/ | | | | | __/ |___) | |_| |
|_|\_\___|_| |_| |_|\___|_|____/ \___/
| \ | | _____ _| |_
| \| |/ _ \ \/ / __|
| |\ | __/> <| |_
|_| \_|\___/_/\_\\__|

View File

@@ -143,7 +143,7 @@ enum Debug {
/// Set the manager app, kernel CONFIG_KSU_DEBUG should be enabled.
SetManager {
/// manager package name
#[arg(default_value_t = String::from("me.weishu.kernelsu"))]
#[arg(default_value_t = String::from("com.rifsxd.ksunext"))]
apk: String,
},
@@ -204,6 +204,12 @@ enum Module {
id: String,
},
/// Restore module <id>
Restore {
/// module id
id: String,
},
/// enable module <id>
Enable {
/// module id
@@ -304,6 +310,7 @@ pub fn run() -> Result<()> {
match command {
Module::Install { zip } => module::install_module(&zip),
Module::Uninstall { id } => module::uninstall_module(&id),
Module::Restore { id } => module::restore_module(&id),
Module::Enable { id } => module::enable_module(&id),
Module::Disable { id } => module::disable_module(&id),
Module::Action { id } => module::run_action(&id),

View File

@@ -392,6 +392,10 @@ pub fn uninstall_module(id: &str) -> Result<()> {
mark_module_state(id, defs::REMOVE_FILE_NAME, true)
}
pub fn restore_module(id: &str) -> Result<()> {
mark_module_state(id, defs::REMOVE_FILE_NAME, false)
}
pub fn run_action(id: &str) -> Result<()> {
let action_script_path = format!("/data/adb/modules/{}/action.sh", id);
exec_script(&action_script_path, true)

View File

@@ -225,7 +225,7 @@ pub fn uninstall(magiskboot_path: Option<PathBuf>) -> Result<()> {
boot_patch::restore(None, magiskboot_path, true)?;
println!("- Uninstall KernelSU manager..");
Command::new("pm")
.args(["uninstall", "me.weishu.kernelsu"])
.args(["uninstall", "com.rifsxd.ksunext"])
.spawn()?;
println!("- Rebooting in 5 seconds..");
std::thread::sleep(std::time::Duration::from_secs(5));