1- use crate :: defs:: { KSU_MOUNT_SOURCE , TEMP_DIR } ;
1+ use crate :: defs:: { KSU_MOUNT_SOURCE , NO_MOUNT_PATH , NO_TMPFS_PATH , TEMP_DIR } ;
22use crate :: module:: { handle_updated_modules, prune_modules} ;
33use log:: { info, warn} ;
44use rustix:: fs:: { mount, MountFlags } ;
@@ -37,8 +37,6 @@ pub fn on_post_data_fs() -> Result<()> {
3737 let safe_mode = utils:: is_safe_mode ( ) ;
3838
3939 if safe_mode {
40- // we should still mount modules.img to `/data/adb/modules` in safe mode
41- // becuase we may need to operate the module dir in safe mode
4240 warn ! ( "safe mode, skip common post-fs-data.d scripts" ) ;
4341 } else {
4442 // Then exec common post-fs-data scripts
@@ -83,8 +81,12 @@ pub fn on_post_data_fs() -> Result<()> {
8381 }
8482
8583 // mount temp dir
86- if let Err ( e) = mount ( KSU_MOUNT_SOURCE , TEMP_DIR , "tmpfs" , MountFlags :: empty ( ) , "" ) {
87- warn ! ( "do temp dir mount failed: {}" , e) ;
84+ if !Path :: new ( NO_TMPFS_PATH ) . exists ( ) {
85+ if let Err ( e) = mount ( KSU_MOUNT_SOURCE , TEMP_DIR , "tmpfs" , MountFlags :: empty ( ) , "" ) {
86+ warn ! ( "do temp dir mount failed: {}" , e) ;
87+ }
88+ } else {
89+ info ! ( "no tmpfs requested" ) ;
8890 }
8991
9092 // exec modules post-fs-data scripts
@@ -99,8 +101,12 @@ pub fn on_post_data_fs() -> Result<()> {
99101 }
100102
101103 // mount module systemlessly by magic mount
102- if let Err ( e) = mount_modules_systemlessly ( ) {
103- warn ! ( "do systemless mount failed: {e}" ) ;
104+ if !Path :: new ( NO_MOUNT_PATH ) . exists ( ) {
105+ if let Err ( e) = mount_modules_systemlessly ( ) {
106+ warn ! ( "do systemless mount failed: {e}" ) ;
107+ }
108+ } else {
109+ info ! ( "no mount requested" ) ;
104110 }
105111
106112 run_stage ( "post-mount" , true ) ;
0 commit comments