diff --git a/mkusb.sh b/mkusb.sh index b6b190d..3a63aa4 100644 --- a/mkusb.sh +++ b/mkusb.sh @@ -1,9 +1,6 @@ # name of the USB stick to be created NAME=BOOT_TINY -if [ ! -d boot_tiny ] ; then - git clone --depth 1 git@gitlab.psi.ch:samenv/boot_tiny.git -fi # list removeable disks DISKS=() while read LINE @@ -22,9 +19,16 @@ done < <(lsblk -l --output RM,TYPE,NAME,SIZE,LABEL,VENDOR,MODEL) echo "which device? should be one of: ${DISKS[@]}" read DEVICE +if [ -z $DEVICE ] ; then + exit +fi if [[ " ${DISKS[@]} " =~ " $DEVICE " ]]; then echo "create TinyLinux" + if [ ! -d boot_tiny ] ; then + git clone --depth 1 git@gitlab.psi.ch:samenv/boot_tiny.git + fi + if [[ $(cat /sys/block/$DEVICE/removable) != "1" ]]; then echo "/dev/$DEVICE is not a removable disk" exit