From 2248af00f3cb33e560bc378fd41f9b3b6c9a85d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=8B=E9=A1=B5?= <31466456+canyie@users.noreply.github.com> Date: Sun, 12 Jun 2022 15:32:34 +0800 Subject: [PATCH] Fix #5673 util_functions.sh overrides `get_flags` function (defined in manager.sh), which sets `RECOVERYMODE` and causes `check_boot_ramdisk` not overriding the incorrect value. --- app/src/main/res/raw/manager.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/src/main/res/raw/manager.sh b/app/src/main/res/raw/manager.sh index 888d30ec4..92e7830e4 100644 --- a/app/src/main/res/raw/manager.sh +++ b/app/src/main/res/raw/manager.sh @@ -144,16 +144,13 @@ check_boot_ramdisk() { # Create boolean ISAB [ -z $SLOT ] && ISAB=false || ISAB=true - # If we are running as recovery mode, then we do not have ramdisk - [ "$RECOVERYMODE" = "true" ] && return 1 - # If we are A/B, then we must have ramdisk $ISAB && return 0 # If we are using legacy SAR, but not A/B, assume we do not have ramdisk if grep ' / ' /proc/mounts | grep -q '/dev/root'; then - # Override recovery mode to true if not set - [ -z $RECOVERYMODE ] && RECOVERYMODE=true + # Override recovery mode to true + RECOVERYMODE=true return 1 fi @@ -217,10 +214,11 @@ grep_prop() { return; } app_init() { mount_partitions + RAMDISKEXIST=false + check_boot_ramdisk && RAMDISKEXIST=true get_flags run_migrations SHA1=$(grep_prop SHA1 $MAGISKTMP/config) - check_boot_ramdisk && RAMDISKEXIST=true || RAMDISKEXIST=false check_encryption # Make sure RECOVERYMODE has value [ -z $RECOVERYMODE ] && RECOVERYMODE=false