From 19a49f1f34f817af47b9e375009e883ff20b925b Mon Sep 17 00:00:00 2001 From: osm0sis Date: Fri, 23 Mar 2018 12:19:08 -0300 Subject: [PATCH] AK2: allow is_slot_device=auto (#21) - for use with broad, device non-specific AK2-based mod zips --- tools/ak2-core.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/ak2-core.sh b/tools/ak2-core.sh index 7e326e3..6fe29be 100755 --- a/tools/ak2-core.sh +++ b/tools/ak2-core.sh @@ -518,7 +518,7 @@ fi; test ! -d "$ramdisk" && mkdir -p $ramdisk; # slot detection enabled by is_slot_device=1 (from anykernel.sh) -if [ "$is_slot_device" == 1 ]; then +if [ "$is_slot_device" == 1 -o "$is_slot_device" == "auto" ]; then slot=$(getprop ro.boot.slot_suffix 2>/dev/null); test ! "$slot" && slot=$(grep -o 'androidboot.slot_suffix=.*$' /proc/cmdline | cut -d\ -f1 | cut -d= -f2); if [ ! "$slot" ]; then @@ -526,8 +526,10 @@ if [ "$is_slot_device" == 1 ]; then test ! "$slot" && slot=$(grep -o 'androidboot.slot=.*$' /proc/cmdline | cut -d\ -f1 | cut -d= -f2); test "$slot" && slot=_$slot; fi; - test "$slot" && block=$block$slot; - if [ $? != 0 -o ! -e "$block" ]; then + if [ "$slot" ]; then + test -e "$block$slot" && block=$block$slot; + fi; + if [ $? != 0 -a "$is_slot_device" == 1 ]; then ui_print " "; ui_print "Unable to determine active boot slot. Aborting..."; exit 1; fi; fi;