ksud: make tmpfs and magic mount optional
- Create /data/adb/ksu/{.notmpfs,.nomount} to disable them.
This commit is contained in:
@@ -39,3 +39,6 @@ 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_FILE_PREFIX: &str = "ksu_backup_";
|
||||
pub const BACKUP_FILENAME: &str = "stock_image.sha1";
|
||||
|
||||
pub const NO_TMPFS_PATH: &str = concatcp!(WORKING_DIR, ".notmpfs");
|
||||
pub const NO_MOUNT_PATH: &str = concatcp!(WORKING_DIR, ".nomount");
|
||||
|
||||
@@ -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,9 +68,13 @@ pub fn on_post_data_fs() -> Result<()> {
|
||||
}
|
||||
|
||||
// mount temp dir
|
||||
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
|
||||
// TODO: Add timeout
|
||||
@@ -84,9 +88,13 @@ pub fn on_post_data_fs() -> Result<()> {
|
||||
}
|
||||
|
||||
// mount module systemlessly by magic mount
|
||||
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