mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-24 02:25:28 +00:00
Detect recovery on FBE devices with no DE access
This commit is contained in:
parent
32b124913e
commit
10ed299c78
@ -53,33 +53,44 @@ getvar KEEPVERITY
|
|||||||
getvar KEEPFORCEENCRYPT
|
getvar KEEPFORCEENCRYPT
|
||||||
getvar BOOTIMAGE
|
getvar BOOTIMAGE
|
||||||
|
|
||||||
|
[ -z $BOOTIMAGE ] && abort "! Unable to detect boot image"
|
||||||
|
ui_print "- Found boot/ramdisk image: $BOOTIMAGE"
|
||||||
|
|
||||||
|
if [ ! -z $DTBOIMAGE ]; then
|
||||||
|
ui_print "- Found dtbo image: $DTBOIMAGE"
|
||||||
|
# Disable dtbo patch by default
|
||||||
|
[ -z $KEEPVERITY ] && KEEPVERITY=true
|
||||||
|
fi
|
||||||
|
|
||||||
# Detect version and architecture
|
# Detect version and architecture
|
||||||
api_level_arch_detect
|
api_level_arch_detect
|
||||||
|
|
||||||
[ $API -lt 21 ] && abort "! Magisk is only for Lollipop 5.0+ (SDK 21+)"
|
[ $API -lt 21 ] && abort "! Magisk is only for Lollipop 5.0+ (SDK 21+)"
|
||||||
|
|
||||||
# Check if system root is installed and remove
|
|
||||||
remove_system_su
|
|
||||||
|
|
||||||
ui_print "- Device platform: $ARCH"
|
ui_print "- Device platform: $ARCH"
|
||||||
|
|
||||||
BINDIR=$INSTALLER/$ARCH
|
BINDIR=$INSTALLER/$ARCH
|
||||||
chmod -R 755 $CHROMEDIR $BINDIR
|
chmod -R 755 $CHROMEDIR $BINDIR
|
||||||
|
|
||||||
|
# Check if system root is installed and remove
|
||||||
|
remove_system_su
|
||||||
|
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
# Environment
|
# Environment
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
|
|
||||||
ui_print "- Constructing environment"
|
ui_print "- Constructing environment"
|
||||||
|
|
||||||
if is_mounted /data; then
|
# Check if we can actually access the data (DE storage)
|
||||||
MAGISKBIN=/data/adb/magisk
|
DATA=false
|
||||||
mkdir -p /data/adb 2>/dev/null
|
if grep ' /data ' /proc/mounts | grep -vq 'tmpfs'; then
|
||||||
chmod 700 /data/adb 2>/dev/null
|
[ ! -d /data/adb ] && mkdir /data/adb
|
||||||
|
touch /data/adb/.write_test && rm /data/adb/.write_test && DATA=true
|
||||||
|
fi
|
||||||
|
|
||||||
# Some legacy migration
|
if $DATA; then
|
||||||
|
MAGISKBIN=/data/adb/magisk
|
||||||
run_migrations
|
run_migrations
|
||||||
[ -L /data/magisk.img ] || mv /data/magisk.img /data/adb/magisk.img 2>/dev/null
|
|
||||||
else
|
else
|
||||||
MAGISKBIN=/cache/data_bin
|
MAGISKBIN=/cache/data_bin
|
||||||
fi
|
fi
|
||||||
@ -104,18 +115,8 @@ $BOOTMODE || recovery_actions
|
|||||||
# Boot patching
|
# Boot patching
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
|
|
||||||
[ -z $BOOTIMAGE ] && find_boot_image
|
|
||||||
[ -z $BOOTIMAGE ] && abort "! Unable to detect boot image"
|
|
||||||
ui_print "- Found boot image: $BOOTIMAGE"
|
|
||||||
|
|
||||||
if [ ! -z $DTBOIMAGE ]; then
|
|
||||||
ui_print "- Found dtbo image: $DTBOIMAGE"
|
|
||||||
# Disable dtbo patch by default
|
|
||||||
[ -z $KEEPVERITY ] && KEEPVERITY=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
eval $BOOTSIGNER -verify < $BOOTIMAGE && BOOTSIGNED=true
|
eval $BOOTSIGNER -verify < $BOOTIMAGE && BOOTSIGNED=true
|
||||||
$BOOTSIGNED && ui_print "- Signed boot image detected"
|
$BOOTSIGNED && ui_print "- Boot image is signed with AVB 1.0"
|
||||||
|
|
||||||
SOURCEDMODE=true
|
SOURCEDMODE=true
|
||||||
cd $MAGISKBIN
|
cd $MAGISKBIN
|
||||||
@ -128,14 +129,14 @@ rm -f new-boot.img
|
|||||||
|
|
||||||
if [ -f stock_boot* ]; then
|
if [ -f stock_boot* ]; then
|
||||||
rm -f /data/stock_boot* 2>/dev/null
|
rm -f /data/stock_boot* 2>/dev/null
|
||||||
is_mounted /data && mv stock_boot* /data
|
$DATA && mv stock_boot* /data
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$KEEPVERITY || patch_dtbo_image
|
$KEEPVERITY || patch_dtbo_image
|
||||||
|
|
||||||
if [ -f stock_dtbo* ]; then
|
if [ -f stock_dtbo* ]; then
|
||||||
rm -f /data/stock_dtbo* 2>/dev/null
|
rm -f /data/stock_dtbo* 2>/dev/null
|
||||||
is_mounted /data && mv stock_dtbo* /data
|
$DATA && mv stock_dtbo* /data
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd /
|
cd /
|
||||||
|
Loading…
Reference in New Issue
Block a user