I’m trying to script mounting/decrypting/dismounting of USB drives.
I’ve been able to get the sys-usb ID, and attach the drive to the qube.
I’m stuck at a reliable way to get the block device of the drive. Any way to do this reliably (this fails too often)?
# Get the drive sd* from last modified match in qube /dev/
# Note: Potential race condition if /dev/ state change between attach and get last modified file.
drive_sd_=$(qvm-run --pass-io -u root "$target_qube" "ls -lt /dev/sd* | grep -o 'sd.*' | head -n 1")
echo "Drive sd_: $drive_sd_"
P.S. Also having problems getting the /dev/mapper name. If you have any reliable tricks to get that too…