From af5431d5b8209847d8bd783777b3470ae940ddaf Mon Sep 17 00:00:00 2001 From: Sam Chudnick Date: Thu, 16 Jun 2022 21:14:14 -0400 Subject: Don't assume device is on /dev/sdc Search for device instead of assuming it is on /dev/sdc. --- .local/bin/cryptusb/mount-cryptusb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to '.local/bin/cryptusb/mount-cryptusb') diff --git a/.local/bin/cryptusb/mount-cryptusb b/.local/bin/cryptusb/mount-cryptusb index ea44967..299ad15 100755 --- a/.local/bin/cryptusb/mount-cryptusb +++ b/.local/bin/cryptusb/mount-cryptusb @@ -1,5 +1,9 @@ #!/bin/sh # Mounts LUKS encrypted USB -lsblk | grep -q "cryptusb" || sudo cryptsetup open /dev/sdc cryptusb +devs="$(lsblk -lp | grep -E "(disk|part) $" | awk '{print $1,"-",$4}')" +[ "$devs" = "" ] && exit 0 +dev="$(echo "$devs" | dmenu -i -p "Select device" | cut -d ' ' -f 1)" +[ "$dev" = "" ] && exit 0 +lsblk | grep -q "cryptusb" || sudo cryptsetup open $dev cryptusb sudo mount /dev/mapper/cryptusb /mnt/cryptusb -- cgit v1.2.3