From b6639915522e68901aa49fe4b57a0fb7ab9aedd0 Mon Sep 17 00:00:00 2001 From: TheKit Date: Sat, 10 Sep 2022 22:04:01 +0300 Subject: [PATCH] halium: fix slot suffix detection in case of multiple occurrences Some bootloaders have a bug that causes androidboot.slot_suffix= to be put to kernel cmdline multiple time. Use the last provided value as the source of truth. --- scripts/halium | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/halium b/scripts/halium index dd436cb..7511c2a 100644 --- a/scripts/halium +++ b/scripts/halium @@ -145,7 +145,7 @@ mount_android_partitions() { tell_kmsg "checking fstab $fstab for additional mount points" # On systems with A/B partition layout, current slot is provided via cmdline parameter. - ab_slot_suffix=$(grep -o 'androidboot\.slot_suffix=..' /proc/cmdline | cut -d "=" -f2) + ab_slot_suffix=$(grep -o 'androidboot\.slot_suffix=..' /proc/cmdline | tail -1 | cut -d "=" -f2) [ ! -z "$ab_slot_suffix" ] && tell_kmsg "A/B slot system detected! Slot suffix is $ab_slot_suffix" cat ${fstab} | while read line; do @@ -439,7 +439,7 @@ mountroot() { done # On systems with A/B partition layout, current slot is provided via cmdline parameter. - ab_slot_suffix=$(grep -o 'androidboot\.slot_suffix=..' /proc/cmdline | cut -d "=" -f2) + ab_slot_suffix=$(grep -o 'androidboot\.slot_suffix=..' /proc/cmdline | tail -1 | cut -d "=" -f2) if [ -z "$path" ] && [ ! -z "$ab_slot_suffix" ] ; then tell_kmsg "Searching for A/B data partition on slot $ab_slot_suffix."