source: minor cleanup

This commit is contained in:
rifsxd
2025-01-01 21:19:50 +06:00
parent 9f30b48e55
commit 6695dfbb26
19 changed files with 132 additions and 352 deletions

View File

@@ -212,7 +212,7 @@ pub fn restore(
flash: bool,
) -> Result<()> {
let tmpdir = tempfile::Builder::new()
.prefix("KernelSU-Next")
.prefix("KernelSU")
.tempdir()
.context("create temp dir failed")?;
let workdir = tmpdir.path();
@@ -235,7 +235,7 @@ pub fn restore(
ensure!(status.success(), "magiskboot unpack failed");
let is_kernelsu_patched = is_kernelsu_patched(&magiskboot, workdir)?;
ensure!(is_kernelsu_patched, "boot image is not patched by KernelSU-Next");
ensure!(is_kernelsu_patched, "boot image is not patched by KernelSU");
let mut new_boot = None;
let mut from_backup = false;
@@ -298,7 +298,7 @@ pub fn restore(
let output_dir = std::env::current_dir()?;
let now = chrono::Utc::now();
let output_image = output_dir.join(format!(
"kernelsu_next_restore_{}.img",
"kernelsu_restore_{}.img",
now.format("%Y%m%d_%H%M%S")
));
@@ -370,7 +370,7 @@ fn do_patch(
}
let tmpdir = tempfile::Builder::new()
.prefix("KernelSU-Next")
.prefix("KernelSU")
.tempdir()
.context("create temp dir failed")?;
let workdir = tmpdir.path();
@@ -460,7 +460,7 @@ fn do_patch(
"Cannot work with Magisk patched image"
);
println!("- Adding KernelSU-Next LKM");
println!("- Adding KernelSU LKM");
let is_kernelsu_patched = is_kernelsu_patched(&magiskboot, workdir)?;
let mut need_backup = false;
@@ -501,7 +501,7 @@ fn do_patch(
let output_dir = out.unwrap_or(std::env::current_dir()?);
let now = chrono::Utc::now();
let output_image = output_dir.join(format!(
"kernelsu_next_patched_{}.img",
"kernelsu_patched_{}.img",
now.format("%Y%m%d_%H%M%S")
));

View File

@@ -9,7 +9,7 @@ use log::LevelFilter;
use crate::{apk_sign, assets, debug, defs, init_event, ksucalls, module, utils};
/// KernelSU-Next userspace cli
/// KernelSU userspace cli
#[derive(Parser, Debug)]
#[command(author, version = defs::VERSION_NAME, about, long_about = None)]
struct Args {
@@ -19,7 +19,7 @@ struct Args {
#[derive(clap::Subcommand, Debug)]
enum Commands {
/// Manage KernelSU-Next modules
/// Manage KernelSU modules
Module {
#[command(subcommand)]
command: Module,
@@ -34,13 +34,13 @@ enum Commands {
/// Trigger `boot-complete` event
BootCompleted,
/// Install KernelSU-Next userspace component to system
/// Install KernelSU userspace component to system
Install {
#[arg(long, default_value = None)]
magiskboot: Option<PathBuf>,
},
/// Uninstall KernelSU-Next modules and itself(LKM Only)
/// Uninstall KernelSU modules and itself(LKM Only)
Uninstall {
/// magiskboot path, if not specified, will search from $PATH
#[arg(long, default_value = None)]
@@ -59,7 +59,7 @@ enum Commands {
command: Profile,
},
/// Patch boot or init_boot images to apply KernelSU-Next
/// Patch boot or init_boot images to apply KernelSU
BootPatch {
/// boot image path, if not specified, will try to find the boot image automatically
#[arg(short, long)]
@@ -98,7 +98,7 @@ enum Commands {
kmi: Option<String>,
},
/// Restore boot or init_boot images patched by KernelSU-Next
/// Restore boot or init_boot images patched by KernelSU
BootRestore {
/// boot image path, if not specified, will try to find the boot image automatically
#[arg(short, long)]
@@ -287,7 +287,7 @@ pub fn run() -> Result<()> {
android_logger::init_once(
Config::default()
.with_max_level(LevelFilter::Trace) // limit log level
.with_tag("KernelSU-Next"), // logs will show under mytag tag
.with_tag("KernelSU"), // logs will show under mytag tag
);
#[cfg(not(target_os = "android"))]

View File

@@ -1,6 +1,6 @@
#!/system/bin/sh
############################################
# KernelSU-Next installer script
# KernelSU installer script
# mostly from module_installer.sh
# and util_functions.sh in Magisk
############################################
@@ -371,7 +371,7 @@ install_module() {
set_permissions
else
print_title "$MODNAME" "by $MODAUTH"
print_title "Powered by KernelSU-Next"
print_title "Powered by KernelSU"
unzip -o "$ZIPFILE" customize.sh -d $MODPATH >&2

View File

@@ -43,7 +43,7 @@ pub fn grant_root(_global_mnt: bool) -> Result<()> {
}
fn print_usage(program: &str, opts: Options) {
let brief = format!("KernelSU-Next\n\nUsage: {program} [options] [-] [user [argument...]]");
let brief = format!("KernelSU\n\nUsage: {program} [options] [-] [user [argument...]]");
print!("{}", opts.usage(&brief));
}
@@ -154,7 +154,7 @@ pub fn root_shell() -> Result<()> {
}
if matches.opt_present("v") {
println!("{}:KernelSU-Next", defs::VERSION_NAME);
println!("{}:KernelSU", defs::VERSION_NAME);
return Ok(());
}

View File

@@ -293,7 +293,7 @@ pub fn uninstall(magiskboot_path: Option<PathBuf>) -> Result<()> {
std::fs::remove_dir_all(defs::MODULE_UPDATE_TMP_DIR).ok();
println!("- Restore boot image..");
boot_patch::restore(None, magiskboot_path, true)?;
println!("- Uninstall KernelSU-Next manager..");
println!("- Uninstall KernelSU manager..");
Command::new("pm")
.args(["uninstall", "com.rifsxd.ksunext"])
.spawn()?;