ksud: add post_mount stage (#864)

This commit is contained in:
Ylarod
2023-08-16 11:39:32 +08:00
committed by GitHub
parent 8bf33e9aca
commit ae9519de42
6 changed files with 23 additions and 31 deletions

View File

@@ -240,15 +240,14 @@ fn exec_script<T: AsRef<Path>>(path: T, wait: bool) -> Result<()> {
result.map_err(|err| anyhow!("Failed to exec {}: {}", path.as_ref().display(), err))
}
/// execute every modules' post-fs-data.sh
pub fn exec_post_fs_data() -> Result<()> {
pub fn exec_stage_script(stage: &str, block: bool) -> Result<()> {
foreach_active_module(|module| {
let post_fs_data = module.join("post-fs-data.sh");
if !post_fs_data.exists() {
let script_path = module.join(format!("{stage}.sh"));
if !script_path.exists() {
return Ok(());
}
exec_script(&post_fs_data, true)
exec_script(&script_path, block)
})?;
Ok(())
@@ -276,20 +275,6 @@ pub fn exec_common_scripts(dir: &str, wait: bool) -> Result<()> {
Ok(())
}
/// execute every modules' [stage].sh (service.sh, boot-completed.sh)
pub fn exec_stage_scripts(stage: &str) -> Result<()> {
foreach_active_module(|module| {
let service = module.join(format!("{stage}.sh"));
if !service.exists() {
return Ok(());
}
exec_script(&service, false)
})?;
Ok(())
}
pub fn load_system_prop() -> Result<()> {
foreach_active_module(|module| {
let system_prop = module.join("system.prop");