find valid rootfs partitions from bootloader

This commit is contained in:
ading2210 2023-10-03 19:55:28 -07:00
parent e94e2b1168
commit b7ce81f3bd
1 changed files with 11 additions and 3 deletions

View File

@ -9,7 +9,7 @@
#original: https://chromium.googlesource.com/chromiumos/platform/initramfs/+/refs/heads/main/factory_shim/bootstrap.sh #original: https://chromium.googlesource.com/chromiumos/platform/initramfs/+/refs/heads/main/factory_shim/bootstrap.sh
set +x set -x
invoke_terminal() { invoke_terminal() {
local tty="$1" local tty="$1"
@ -28,9 +28,17 @@ enable_debug_console() {
} }
find_rootfs_partitions() { 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 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 done
} }