You've already forked KernelSU-Next
mirror of
https://github.com/KernelSU-Next/KernelSU-Next.git
synced 2025-08-27 23:46:34 +00:00
ksud: added module mount command to check current mount system enabled
This commit is contained in:
@@ -228,6 +228,9 @@ enum Module {
|
|||||||
id: String,
|
id: String,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/// current mount system
|
||||||
|
Mount,
|
||||||
|
|
||||||
/// list all modules
|
/// list all modules
|
||||||
List,
|
List,
|
||||||
}
|
}
|
||||||
@@ -313,6 +316,7 @@ pub fn run() -> Result<()> {
|
|||||||
Module::Enable { id } => module::enable_module(&id),
|
Module::Enable { id } => module::enable_module(&id),
|
||||||
Module::Disable { id } => module::disable_module(&id),
|
Module::Disable { id } => module::disable_module(&id),
|
||||||
Module::Action { id } => module::run_action(&id),
|
Module::Action { id } => module::run_action(&id),
|
||||||
|
Module::Mount => module::mount_system(),
|
||||||
Module::List => module::list_modules(),
|
Module::List => module::list_modules(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,3 +42,5 @@ pub const BACKUP_FILENAME: &str = "stock_image.sha1";
|
|||||||
|
|
||||||
pub const NO_TMPFS_PATH: &str = concatcp!(WORKING_DIR, ".notmpfs");
|
pub const NO_TMPFS_PATH: &str = concatcp!(WORKING_DIR, ".notmpfs");
|
||||||
pub const NO_MOUNT_PATH: &str = concatcp!(WORKING_DIR, ".nomount");
|
pub const NO_MOUNT_PATH: &str = concatcp!(WORKING_DIR, ".nomount");
|
||||||
|
|
||||||
|
pub const MOUNT_SYSTEM: &str = "Magic_Mount";
|
||||||
|
|||||||
@@ -493,6 +493,12 @@ fn _list_modules(path: &str) -> Vec<HashMap<String, String>> {
|
|||||||
modules
|
modules
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn mount_system() -> Result<()> {
|
||||||
|
println!("Current mount system: {}", defs::MOUNT_SYSTEM);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn list_modules() -> Result<()> {
|
pub fn list_modules() -> Result<()> {
|
||||||
let modules = _list_modules(defs::MODULE_DIR);
|
let modules = _list_modules(defs::MODULE_DIR);
|
||||||
println!("{}", serde_json::to_string_pretty(&modules)?);
|
println!("{}", serde_json::to_string_pretty(&modules)?);
|
||||||
|
|||||||
@@ -235,6 +235,10 @@ enum Module {
|
|||||||
id: String,
|
id: String,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/// current mount system
|
||||||
|
Mount,
|
||||||
|
|
||||||
/// list all modules
|
/// list all modules
|
||||||
List,
|
List,
|
||||||
|
|
||||||
@@ -319,6 +323,7 @@ pub fn run() -> Result<()> {
|
|||||||
Module::Enable { id } => module::enable_module(&id),
|
Module::Enable { id } => module::enable_module(&id),
|
||||||
Module::Disable { id } => module::disable_module(&id),
|
Module::Disable { id } => module::disable_module(&id),
|
||||||
Module::Action { id } => module::run_action(&id),
|
Module::Action { id } => module::run_action(&id),
|
||||||
|
Module::Mount => module::mount_system(),
|
||||||
Module::List => module::list_modules(),
|
Module::List => module::list_modules(),
|
||||||
Module::Shrink => module::shrink_ksu_images(),
|
Module::Shrink => module::shrink_ksu_images(),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,3 +44,5 @@ pub const VERSION_NAME: &str = include_str!(concat!(env!("OUT_DIR"), "/VERSION_N
|
|||||||
pub const KSU_BACKUP_DIR: &str = WORKING_DIR;
|
pub const KSU_BACKUP_DIR: &str = WORKING_DIR;
|
||||||
pub const KSU_BACKUP_FILE_PREFIX: &str = "ksu_backup_";
|
pub const KSU_BACKUP_FILE_PREFIX: &str = "ksu_backup_";
|
||||||
pub const BACKUP_FILENAME: &str = "stock_image.sha1";
|
pub const BACKUP_FILENAME: &str = "stock_image.sha1";
|
||||||
|
|
||||||
|
pub const MOUNT_SYSTEM: &str = "OverlayFS";
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ fn exec_install_script(module_file: &str) -> Result<()> {
|
|||||||
.env("KSU_VER_CODE", defs::VERSION_CODE)
|
.env("KSU_VER_CODE", defs::VERSION_CODE)
|
||||||
.env("OUTFD", "1")
|
.env("OUTFD", "1")
|
||||||
.env("ZIPFILE", realpath)
|
.env("ZIPFILE", realpath)
|
||||||
|
.env("KSU_OVERLAYFS", "true")
|
||||||
.status()?;
|
.status()?;
|
||||||
ensure!(result.success(), "Failed to install module script");
|
ensure!(result.success(), "Failed to install module script");
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -185,6 +186,7 @@ fn exec_script<T: AsRef<Path>>(path: T, wait: bool) -> Result<()> {
|
|||||||
.env("KSU_KERNEL_VER_CODE", ksucalls::get_version().to_string())
|
.env("KSU_KERNEL_VER_CODE", ksucalls::get_version().to_string())
|
||||||
.env("KSU_VER_CODE", defs::VERSION_CODE)
|
.env("KSU_VER_CODE", defs::VERSION_CODE)
|
||||||
.env("KSU_VER", defs::VERSION_NAME)
|
.env("KSU_VER", defs::VERSION_NAME)
|
||||||
|
.env("KSU_OVERLAYFS", "true")
|
||||||
.env(
|
.env(
|
||||||
"PATH",
|
"PATH",
|
||||||
format!(
|
format!(
|
||||||
@@ -789,6 +791,12 @@ fn _list_modules(path: &str) -> Vec<HashMap<String, String>> {
|
|||||||
modules
|
modules
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn mount_system() -> Result<()> {
|
||||||
|
println!("Current mount system: {}", defs::MOUNT_SYSTEM);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn list_modules() -> Result<()> {
|
pub fn list_modules() -> Result<()> {
|
||||||
let modules = _list_modules(defs::MODULE_DIR);
|
let modules = _list_modules(defs::MODULE_DIR);
|
||||||
println!("{}", serde_json::to_string_pretty(&modules)?);
|
println!("{}", serde_json::to_string_pretty(&modules)?);
|
||||||
|
|||||||
Reference in New Issue
Block a user