From 000f1d6041af1f313f377a2ee5d58be96383a794 Mon Sep 17 00:00:00 2001 From: vvb2060 Date: Fri, 20 Oct 2023 12:18:29 +0800 Subject: [PATCH] Revert "Don't support alternative binary paths" This reverts commit 1eeb2a34a117b6826e1f1d63d59bfc81b0f23317. --- native/src/core/bootstages.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/native/src/core/bootstages.cpp b/native/src/core/bootstages.cpp index 8cbbef59f..3f71f5cde 100644 --- a/native/src/core/bootstages.cpp +++ b/native/src/core/bootstages.cpp @@ -25,6 +25,18 @@ static bool magisk_env() { LOGI("* Initializing Magisk environment\n"); + ssprintf(buf, sizeof(buf), "%s/0/%s/install", APP_DATA_DIR, JAVA_PACKAGE_NAME); + // Alternative binaries paths + const char *alt_bin[] = { "/cache/data_adb/magisk", "/data/magisk", buf }; + for (auto alt : alt_bin) { + if (access(alt, F_OK) == 0) { + rm_rf(DATABIN); + cp_afc(alt, DATABIN); + rm_rf(alt); + } + } + rm_rf("/cache/data_adb"); + // Directories in /data/adb chmod(SECURE_DIR, 0700); xmkdir(DATABIN, 0755);