From 4772868d6a42276e4feda85fe421455e7973c55d Mon Sep 17 00:00:00 2001 From: vvb2060 Date: Tue, 28 Feb 2023 21:51:58 +0800 Subject: [PATCH] Move REMOUNT_ROOT --- native/src/core/bootstages.cpp | 3 --- native/src/core/daemon.cpp | 6 +++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/native/src/core/bootstages.cpp b/native/src/core/bootstages.cpp index c2d1a8362..eeea7aafb 100644 --- a/native/src/core/bootstages.cpp +++ b/native/src/core/bootstages.cpp @@ -234,9 +234,6 @@ static bool check_key_combo() { extern int disable_deny(); static void post_fs_data() { - if (getenv("REMOUNT_ROOT")) - xmount(nullptr, "/", nullptr, MS_REMOUNT | MS_RDONLY, nullptr); - if (!check_data()) return; diff --git a/native/src/core/daemon.cpp b/native/src/core/daemon.cpp index ee99069a4..e15993316 100644 --- a/native/src/core/daemon.cpp +++ b/native/src/core/daemon.cpp @@ -358,7 +358,7 @@ static void daemon_entry() { restore_tmpcon(); - // SAR cleanups + // Cleanups auto mount_list = MAGISKTMP + "/" ROOTMNT; if (access(mount_list.data(), F_OK) == 0) { file_readline(true, mount_list.data(), [](string_view line) -> bool { @@ -366,6 +366,10 @@ static void daemon_entry() { return true; }); } + if (getenv("REMOUNT_ROOT")) { + xmount(nullptr, "/", nullptr, MS_REMOUNT | MS_RDONLY, nullptr); + unsetenv("REMOUNT_ROOT"); + } rm_rf((MAGISKTMP + "/" ROOTOVL).data()); // Load config status