ksud: make tmpfs and magic mount optional
- Create /data/adb/ksu/{.notmpfs,.nomount} to disable them.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use crate::defs::{KSU_MOUNT_SOURCE, TEMP_DIR};
|
||||
use crate::defs::{KSU_MOUNT_SOURCE, NO_MOUNT_PATH, NO_TMPFS_PATH, TEMP_DIR};
|
||||
use crate::module::{handle_updated_modules, prune_modules};
|
||||
use crate::{assets, defs, ksucalls, restorecon, utils};
|
||||
use anyhow::{Context, Result};
|
||||
@@ -68,8 +68,12 @@ pub fn on_post_data_fs() -> Result<()> {
|
||||
}
|
||||
|
||||
// mount temp dir
|
||||
if let Err(e) = mount(KSU_MOUNT_SOURCE, TEMP_DIR, "tmpfs", MountFlags::empty(), "") {
|
||||
warn!("do temp dir mount failed: {}", e);
|
||||
if !Path::new(NO_TMPFS_PATH).exists() {
|
||||
if let Err(e) = mount(KSU_MOUNT_SOURCE, TEMP_DIR, "tmpfs", MountFlags::empty(), "") {
|
||||
warn!("do temp dir mount failed: {}", e);
|
||||
}
|
||||
} else {
|
||||
info!("no tmpfs requested");
|
||||
}
|
||||
|
||||
// exec modules post-fs-data scripts
|
||||
@@ -84,8 +88,12 @@ pub fn on_post_data_fs() -> Result<()> {
|
||||
}
|
||||
|
||||
// mount module systemlessly by magic mount
|
||||
if let Err(e) = mount_modules_systemlessly() {
|
||||
warn!("do systemless mount failed: {}", e);
|
||||
if !Path::new(NO_MOUNT_PATH).exists() {
|
||||
if let Err(e) = mount_modules_systemlessly() {
|
||||
warn!("do systemless mount failed: {}", e);
|
||||
}
|
||||
} else {
|
||||
info!("no mount requested");
|
||||
}
|
||||
|
||||
run_stage("post-mount", true);
|
||||
|
||||
Reference in New Issue
Block a user