From 65511845d29b32a868376f805b9f1e095cb29eaf Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Thu, 11 Jan 2018 20:57:05 +0800 Subject: [PATCH] Fix APK installation on some devices Close #367. Android 6.0 and before doesn't like the new path --- core/jni/core/bootstages.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/jni/core/bootstages.c b/core/jni/core/bootstages.c index ba6d5a1f3..9ff676107 100644 --- a/core/jni/core/bootstages.c +++ b/core/jni/core/bootstages.c @@ -647,13 +647,14 @@ void late_start(int client) { core_only: // Install Magisk Manager if exists if (access(MANAGERAPK, F_OK) == 0) { + rename(MANAGERAPK, "/data/magisk.apk"); while (1) { sleep(5); int apk_res = -1, pid; pid = exec_command(1, &apk_res, pm_setenv, "app_process", "/system/bin", "com.android.commands.pm.Pm", - "install", "-r", MANAGERAPK, NULL); + "install", "-r", "/data/magisk.apk", NULL); if (pid != -1) { waitpid(pid, NULL, 0); fdgets(buf, PATH_MAX, apk_res); @@ -663,7 +664,7 @@ core_only: break; } } - unlink(MANAGERAPK); + unlink("/data/magisk.apk"); } // All boot stage done, cleanup everything