From 6d29ab71f9a4ef921f9723186e600744e58716dd Mon Sep 17 00:00:00 2001 From: alex-nitrokey Date: Wed, 24 Jun 2020 09:44:50 +0200 Subject: [PATCH 1/3] dd partition Label to menu list --- initrd/bin/mount-usb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/initrd/bin/mount-usb b/initrd/bin/mount-usb index 94946675..de9eb9d2 100755 --- a/initrd/bin/mount-usb +++ b/initrd/bin/mount-usb @@ -55,9 +55,11 @@ if [ -z ${USB_MOUNT_DEVICE} ]; then # remove block device from list if numeric partitions exist, since not bootable let USB_NUM_PARTITIONS=`ls -1 $i* | wc -l`-1 if [ ${USB_NUM_PARTITIONS} -eq 0 ]; then - echo $i >> /tmp/usb_disk_list + echo $i $(blkid | grep $i | grep -o 'LABEL=".*"' | sed 's/\ UUID.*$//') >> /tmp/usb_disk_list else - ls $i* | tail -${USB_NUM_PARTITIONS} >> /tmp/usb_disk_list + for j in $(ls $i* | tail -${USB_NUM_PARTITIONS}); do + echo $j $(blkid | grep $j | grep -o 'LABEL=".*"' | sed 's/\ UUID.*$//') >> /tmp/usb_disk_list + done fi done @@ -95,7 +97,7 @@ if [ -z ${USB_MOUNT_DEVICE} ]; then if [ "$option_index" = "a" ]; then exit 1 fi - USB_MOUNT_DEVICE=`head -n $option_index /tmp/usb_disk_list | tail -1` + USB_MOUNT_DEVICE=`head -n $option_index /tmp/usb_disk_list | tail -1 | sed 's/\ .*$//'` fi if [ "$1" = "rw" ]; then From 20b07dd1b380151270431665f6088926e075d3d7 Mon Sep 17 00:00:00 2001 From: alex-nitrokey Date: Thu, 25 Jun 2020 09:46:11 +0200 Subject: [PATCH 2/3] swap label and device and minor formatting change --- initrd/bin/mount-usb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/initrd/bin/mount-usb b/initrd/bin/mount-usb index de9eb9d2..1e20f24a 100755 --- a/initrd/bin/mount-usb +++ b/initrd/bin/mount-usb @@ -55,10 +55,10 @@ if [ -z ${USB_MOUNT_DEVICE} ]; then # remove block device from list if numeric partitions exist, since not bootable let USB_NUM_PARTITIONS=`ls -1 $i* | wc -l`-1 if [ ${USB_NUM_PARTITIONS} -eq 0 ]; then - echo $i $(blkid | grep $i | grep -o 'LABEL=".*"' | sed 's/\ UUID.*$//') >> /tmp/usb_disk_list + echo $(blkid | grep $i | grep -o 'LABEL=".*"' | cut -f2 -d '"') $i >> /tmp/usb_disk_list else for j in $(ls $i* | tail -${USB_NUM_PARTITIONS}); do - echo $j $(blkid | grep $j | grep -o 'LABEL=".*"' | sed 's/\ UUID.*$//') >> /tmp/usb_disk_list + echo $(blkid | grep $j | grep -o 'LABEL=".*"' | cut -f2 -d '"') $j >> /tmp/usb_disk_list done fi done From 84b2f9b5405082b81d485809511ed4d6bd50abbc Mon Sep 17 00:00:00 2001 From: alex-nitrokey Date: Tue, 30 Jun 2020 09:28:35 +0200 Subject: [PATCH 3/3] Re-arrange the order of label and device --- initrd/bin/mount-usb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/initrd/bin/mount-usb b/initrd/bin/mount-usb index 1e20f24a..31caf337 100755 --- a/initrd/bin/mount-usb +++ b/initrd/bin/mount-usb @@ -55,10 +55,10 @@ if [ -z ${USB_MOUNT_DEVICE} ]; then # remove block device from list if numeric partitions exist, since not bootable let USB_NUM_PARTITIONS=`ls -1 $i* | wc -l`-1 if [ ${USB_NUM_PARTITIONS} -eq 0 ]; then - echo $(blkid | grep $i | grep -o 'LABEL=".*"' | cut -f2 -d '"') $i >> /tmp/usb_disk_list + echo $i $(blkid | grep $i | grep -o 'LABEL=".*"' | cut -f2 -d '"') >> /tmp/usb_disk_list else for j in $(ls $i* | tail -${USB_NUM_PARTITIONS}); do - echo $(blkid | grep $j | grep -o 'LABEL=".*"' | cut -f2 -d '"') $j >> /tmp/usb_disk_list + echo $j $(blkid | grep $j | grep -o 'LABEL=".*"' | cut -f2 -d '"') >> /tmp/usb_disk_list done fi done