Don't mount images when running core-only mode

This commit is contained in:
topjohnwu 2019-01-20 17:01:59 -05:00
parent fdf167db11
commit 50b55a77de

View File

@ -779,7 +779,7 @@ void startup() {
execl("/sbin/magisk.bin", "magisk", "--post-fs-data", nullptr); execl("/sbin/magisk.bin", "magisk", "--post-fs-data", nullptr);
} }
[[noreturn]] static void core_only() { [[noreturn]] static inline void core_only() {
auto_start_magiskhide(); auto_start_magiskhide();
unblock_boot_process(); unblock_boot_process();
} }
@ -800,6 +800,14 @@ void post_fs_data(int client) {
start_log_daemon(); start_log_daemon();
// Run common scripts
LOGI("* Running post-fs-data.d scripts\n");
exec_common_script("post-fs-data");
// Core only mode
if (access(DISABLEFILE, F_OK) == 0)
core_only();
if (!prepare_img()) { if (!prepare_img()) {
LOGE("* Magisk image mount failed, switch to core-only mode\n"); LOGE("* Magisk image mount failed, switch to core-only mode\n");
free(magiskloop); free(magiskloop);
@ -810,14 +818,6 @@ void post_fs_data(int client) {
restorecon(); restorecon();
chmod(SECURE_DIR, 0700); chmod(SECURE_DIR, 0700);
// Run common scripts
LOGI("* Running post-fs-data.d scripts\n");
exec_common_script("post-fs-data");
// Core only mode
if (access(DISABLEFILE, F_OK) == 0)
core_only();
// Execute module scripts // Execute module scripts
LOGI("* Running module post-fs-data scripts\n"); LOGI("* Running module post-fs-data scripts\n");
exec_module_script("post-fs-data"); exec_module_script("post-fs-data");