Makefile: add pickrand
[cmccabe-bin] / vfat-label.sh
1 #!/usr/bin/env bash -x
2
3 usage() {
4         cat <<EOF
5 vfat-label.sh: shows or sets the label on a vfat disk.
6 Similar to e2label.
7
8 To show the label:
9 vfat-label.sh <dev-name>
10
11 To set the label:
12 vfat-label.sh <dev-name> <label-name>
13 EOF
14         exit 1
15 }
16
17 die() {
18         echo "$@"
19         exit 1
20 }
21
22 which mlabel 1>/dev/null 2>/dev/null || \
23         die "You need to install mtools for this to work."
24
25 if [ "x${1}" == "x-h" ]; then
26         usage
27 fi
28
29 if [ $# -eq 1 ]; then
30         mlabel -i "${1}" -s ::
31 elif [ $# -eq 2 ]; then
32         mlabel -i "${1}" ::${2}
33 else
34         usage
35 fi