From 88664acc1516a8cb35493c29a8ee574d8e5914ce Mon Sep 17 00:00:00 2001 From: "Ruslan N. Marchenko" <me@ruff.mobi> Date: Sun, 16 Jan 2022 21:27:56 +0100 Subject: [PATCH] reform-tools: make nvme partition selectable --- reform2-imx8mq/reform-tools_1.0-7/sbin/reform-init | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/reform2-imx8mq/reform-tools_1.0-7/sbin/reform-init b/reform2-imx8mq/reform-tools_1.0-7/sbin/reform-init index ae5b5be..837e635 100755 --- a/reform2-imx8mq/reform-tools_1.0-7/sbin/reform-init +++ b/reform2-imx8mq/reform-tools_1.0-7/sbin/reform-init @@ -1,6 +1,5 @@ #!/bin/busybox sh -sleep 1 echo "MNT Reform: reform-init checking boot media..." /bin/mount -t proc /proc /proc @@ -22,9 +21,13 @@ echo "Your boot preference is: \"$BOOTPREF\"" if [ "$BOOTPREF" == "usb" ]; then echo "Booting from USB storage in 3 seconds." BOOTPART="/dev/sda1" -elif [ "$BOOTPREF" == "nvme" ]; then +elif [ "${BOOTPREF:0:4}" == "nvme" ]; then echo "Booting from NVMe SSD." - BOOTPART="/dev/nvme0n1p1" + if [ ${#BOOTPREF} -eq 4 -o ! -b /dev/$BOOTPREF ]; then + BOOTPART="/dev/nvme0n1p1" + else + BOOTPART="/dev/$BOOTPREF" + fi else # Default. Boot from SD card (already mounted by kernel). echo "Booting from SD card (or eMMC)." @@ -39,7 +42,7 @@ if [ ! -e $BOOTPART ]; then fi # Check if partition is encrypted -if blkid | grep "$BOOTPART" | grep "crypto_LUKS"; then +if /sbin/blkid -Dp "$BOOTPART" | grep "crypto_LUKS"; then echo "Attempting to mount encrypted partition \"$BOOTPART\"." while : do -- GitLab