Short drive name

This commit is contained in:
Bob Mottram 2016-10-30 14:43:45 +00:00
parent 22da3b7a00
commit 8c0d5ed365
1 changed files with 3 additions and 1 deletions

View File

@ -38,8 +38,10 @@ if [ ! $1 ]; then
exit 1
fi
USB_DRIVE_SHORT=${1}
if [[ "$1" == "/dev/"* ]]; then
USB_DRIVE=$1
USB_DRIVE_SHORT=$(echo "$USB_DRIVE" | awk -F '/' '{print $3}' | sed 's|1||g' | sed 's|2||g' | sed 's|3||g')
else
USB_DRIVE=/dev/${1}1
fi
@ -60,7 +62,7 @@ p
a
1
w
" | fdisk /dev/${1};mkfs.ext4 -L "$LABEL" /dev/${1}1
" | fdisk /dev/${USB_DRIVE_SHORT};mkfs.ext4 -L "$LABEL" /dev/${USB_DRIVE_SHORT}1
echo $"Formatting $USB_DRIVE as LUKS"
cryptsetup -y -v luksFormat ${USB_DRIVE}