ksud: Add uninstall
This commit is contained in:
@@ -5,7 +5,7 @@ use std::{
|
||||
path::Path,
|
||||
};
|
||||
|
||||
use crate::{assets, defs, ksucalls, restorecon};
|
||||
use crate::{assets, boot_patch, defs, ksucalls, module, restorecon};
|
||||
use std::fs::metadata;
|
||||
#[allow(unused_imports)]
|
||||
use std::fs::{set_permissions, Permissions};
|
||||
@@ -217,6 +217,16 @@ pub fn install() -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn uninstall(magiskboot_path: Option<PathBuf>) -> Result<()> {
|
||||
println!("- Uninstall modules..");
|
||||
module::uninstall_all_modules()?;
|
||||
module::prune_modules()?;
|
||||
println!("- Removing directories..");
|
||||
std::fs::remove_dir_all(defs::WORKING_DIR)?;
|
||||
println!("- Uninstall KernelSU itself..");
|
||||
boot_patch::restore(None, magiskboot_path, true)
|
||||
}
|
||||
|
||||
// TODO: use libxcp to improve the speed if cross's MSRV is 1.70
|
||||
pub fn copy_sparse_file<P: AsRef<Path>, Q: AsRef<Path>>(
|
||||
src: P,
|
||||
|
||||
Reference in New Issue
Block a user