From 051f79300fd69d0031eb992aa258aeb2f76629bc Mon Sep 17 00:00:00 2001 From: osm0sis Date: Wed, 30 Aug 2023 19:47:39 -0300 Subject: [PATCH] AK3: fix unset PATCHVBMETAFLAG, only read kernel strings once --- tools/ak3-core.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/ak3-core.sh b/tools/ak3-core.sh index eb20cea..6592eec 100755 --- a/tools/ak3-core.sh +++ b/tools/ak3-core.sh @@ -355,12 +355,14 @@ flash_boot() { echo "Attempting kernel unpack with busybox $comp..." >&2; $comp -dc $kernel > kernel; fi; - if strings kernel 2>/dev/null | grep -q -E '^/data/adb/ksud$'; then + strings kernel > stringstmp 2>/dev/null; + if grep -q -E '^/data/adb/ksud$' stringstmp; then touch $home/kernelsu_patched; - strings kernel 2>/dev/null | grep -E -m1 'Linux version.*#' > $home/vertmp; + grep -E -m1 'Linux version.*#' stringstmp > $home/vertmp; else ui_print " " "Warning: No KernelSU support detected in kernel!"; fi; + rm -f stringstmp; if [ "$comp" ]; then $bin/magiskboot compress=$comp kernel kernel.$comp; if [ $? != 0 ] && $comp --help 2>/dev/null; then @@ -390,10 +392,8 @@ flash_boot() { if [ $? != 0 ]; then abort "Repacking image failed. Aborting..."; fi; - if [ -f .magisk ]; then - touch $home/magisk_patched; - unset PATCHVBMETAFLAG; - fi; + [ "$PATCHVBMETAFLAG" ] && unset PATCHVBMETAFLAG; + [ -f .magisk ] && touch $home/magisk_patched; cd $home; if [ -f "$bin/futility" -a -d "$bin/chromeos" ]; then @@ -875,7 +875,7 @@ setup_ak() { esac; for name in $parttype; do for part in $name$slot $name; do - if [ "$(grep -w "$part" /proc/mtd 2> /dev/null)" ]; then + if [ "$(grep -w "$part" /proc/mtd 2>/dev/null)" ]; then mtdmount=$(grep -w "$part" /proc/mtd); mtdpart=$(echo $mtdmount | cut -d\" -f2); if [ "$mtdpart" == "$part" ]; then