From b7ce81f3bd1f2bc846f57cce4fde74c059a538c3 Mon Sep 17 00:00:00 2001 From: ading2210 Date: Tue, 3 Oct 2023 19:55:28 -0700 Subject: [PATCH] find valid rootfs partitions from bootloader --- bootloader/bin/bootstrap.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/bootloader/bin/bootstrap.sh b/bootloader/bin/bootstrap.sh index e7bf684..7cfda0c 100644 --- a/bootloader/bin/bootstrap.sh +++ b/bootloader/bin/bootstrap.sh @@ -9,7 +9,7 @@ #original: https://chromium.googlesource.com/chromiumos/platform/initramfs/+/refs/heads/main/factory_shim/bootstrap.sh -set +x +set -x invoke_terminal() { local tty="$1" @@ -28,9 +28,17 @@ enable_debug_console() { } find_rootfs_partitions() { - disks=$(fdisk -l | sed -n "s/Disk \(\/dev\/.*\):.*/\1/p") + local disks=$(fdisk -l | sed -n "s/Disk \(\/dev\/.*\):.*/\1/p") + if [ ! "${disks}" ]; then + return 1 + fi + for disk in $disks; do - echo $disk + local partitions=$(fdisk -l $disk | sed -n "s/^[ ]\+\([0-9]\+\).*shimboot_rootfs:\(.*\)$/\1:\2/p") + if [ ! "${partitions}" ]; then + continue + fi + echo $partitions done }