scripts: fix find_boot_image using wrong partition list on non-slot

- revert logic changes introduced by ec8fffe61c which break find_boot_image on NAND devices and any others using non-standard naming supported by the A-only device boot partition name list
- despite being accepted equivalents in modern shells -n does not work on Android in some shell/env scenarios where ! -z always does
This commit is contained in:
osm0sis 2021-03-21 19:34:33 -03:00 committed by John Wu
parent 0a4e7eea41
commit 93e1266ee7

View File

@ -37,9 +37,9 @@ getvar() {
local VARNAME=$1 local VARNAME=$1
local VALUE local VALUE
local PROPPATH='/data/.magisk /cache/.magisk' local PROPPATH='/data/.magisk /cache/.magisk'
[ -n $MAGISKTMP ] && PROPPATH="$MAGISKTMP/config $PROPPATH" [ ! -z $MAGISKTMP ] && PROPPATH="$MAGISKTMP/config $PROPPATH"
VALUE=$(grep_prop $VARNAME $PROPPATH) VALUE=$(grep_prop $VARNAME $PROPPATH)
[ -n $VALUE ] && eval $VARNAME=\$VALUE [ ! -z $VALUE ] && eval $VARNAME=\$VALUE
} }
is_mounted() { is_mounted() {
@ -50,7 +50,7 @@ is_mounted() {
abort() { abort() {
ui_print "$1" ui_print "$1"
$BOOTMODE || recovery_cleanup $BOOTMODE || recovery_cleanup
[ -n $MODPATH ] && rm -rf $MODPATH [ ! -z $MODPATH ] && rm -rf $MODPATH
rm -rf $TMPDIR rm -rf $TMPDIR
exit 1 exit 1
} }
@ -394,7 +394,7 @@ find_boot_image() {
BOOTIMAGE= BOOTIMAGE=
if $RECOVERYMODE; then if $RECOVERYMODE; then
BOOTIMAGE=`find_block recovery_ramdisk$SLOT recovery$SLOT sos` BOOTIMAGE=`find_block recovery_ramdisk$SLOT recovery$SLOT sos`
elif [ -n $SLOT ]; then elif [ ! -z $SLOT ]; then
BOOTIMAGE=`find_block ramdisk$SLOT recovery_ramdisk$SLOT boot$SLOT` BOOTIMAGE=`find_block ramdisk$SLOT recovery_ramdisk$SLOT boot$SLOT`
else else
BOOTIMAGE=`find_block ramdisk recovery_ramdisk kern-a android_boot kernel bootimg boot lnx boot_a` BOOTIMAGE=`find_block ramdisk recovery_ramdisk kern-a android_boot kernel bootimg boot lnx boot_a`