aboutsummaryrefslogtreecommitdiff
path: root/m
blob: 6b38cfcca7a258ad0f633519dd1666765ee674ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh

if test `ls /mnt | wc -l` -gt 0
then
	umount /mnt && echo Drive unmounted.
	exit 0
fi

drv=`lsblk -o name,model | awk /"${1:-U3}"/' {getline; print substr($1, 7)}'`
if test -z "$drv"
then
	echo "Drive '${1:-U3}' not found." 1>&2
	exit 1
fi

mount /dev/$drv /mnt && echo Drive mounted. && exit 0
exit 1