Fix bootloop when upgrading from older Magisk

This commit is contained in:
topjohnwu 2018-07-01 14:58:31 +08:00
parent c0ac2d540b
commit d149af9628
4 changed files with 5 additions and 4 deletions

View File

@ -106,7 +106,7 @@ def build_binary(args):
header('* Building binaries: ' + ' '.join(targets)) header('* Building binaries: ' + ' '.join(targets))
# Force update logging.h timestamp to trigger recompilation for the flags to make a difference # Force update logging.h timestamp to trigger recompilation for the flags to make a difference
os.utime(os.path.join('native', 'jni', 'include', 'logging.h'))
# Basic flags # Basic flags
base_flags = 'MAGISK_VERSION=\"{}\" MAGISK_VER_CODE={} MAGISK_DEBUG={}'.format(config['version'], config['versionCode'], base_flags = 'MAGISK_VERSION=\"{}\" MAGISK_VER_CODE={} MAGISK_DEBUG={}'.format(config['version'], config['versionCode'],

View File

@ -585,7 +585,7 @@ void startup() {
close(root); close(root);
// Alternative binaries paths // Alternative binaries paths
char *alt_bin[] = { "/cache/data_bin", "/data/magisk", char *alt_bin[] = { "/cache/data_bin", "/data/.magisk",
"/data/data/com.topjohnwu.magisk/install", "/data/data/com.topjohnwu.magisk/install",
"/data/user_de/0/com.topjohnwu.magisk/install", NULL }; "/data/user_de/0/com.topjohnwu.magisk/install", NULL };
char *bin_path = NULL; char *bin_path = NULL;
@ -602,6 +602,7 @@ void startup() {
} }
// Remove legacy stuffs // Remove legacy stuffs
rm_rf("/data/magisk");
unlink("/data/magisk.img"); unlink("/data/magisk.img");
unlink("/data/magisk_debug.log"); unlink("/data/magisk_debug.log");

View File

@ -27,7 +27,7 @@ initialize() {
. $MAGISKBIN/util_functions.sh . $MAGISKBIN/util_functions.sh
APK=/data/adb/magisk.apk APK=/data/adb/magisk.apk
[ -f $APK ] || APK=/data/magisk/magisk.apk [ -f $APK ] || APK=/data/.magisk/magisk.apk
[ -f $APK ] || APK=/data/app/com.topjohnwu.magisk*/*.apk [ -f $APK ] || APK=/data/app/com.topjohnwu.magisk*/*.apk
} }

View File

@ -79,7 +79,7 @@ ui_print "- Constructing environment"
check_data check_data
if $DATA; then if $DATA; then
MAGISKBIN=/data/magisk MAGISKBIN=/data/.magisk
$DATA_DE && MAGISKBIN=/data/adb/magisk $DATA_DE && MAGISKBIN=/data/adb/magisk
run_migrations run_migrations
else else