1 | #!/bin/bash␊ |
2 | ␊ |
3 | echo "==============================================="␊ |
4 | echo "CheckFormat: Is target HFS or MSDOS?"␊ |
5 | echo "**********************************************"␊ |
6 | ␊ |
7 | # Receives passed value for the Target Volume Device␊ |
8 | # for example: /dev/disk0s2␊ |
9 | # if the selected partition is formatted as HFS then exit with 1␊ |
10 | # if the selected partition is formatted as MSDOS then exit with 2␊ |
11 | # if fstyp doesn't return a value then exit with 0␊ |
12 | ␊ |
13 | if [ "$#" -eq 1 ]; then␊ |
14 | ␉targetDevice="$1"␊ |
15 | ␉echo "DEBUG: passed argument for targetDevice = $targetDevice"␊ |
16 | else␊ |
17 | ␉echo "Error - wrong number of values passed"␊ |
18 | ␉exit 9␊ |
19 | fi␊ |
20 | ␊ |
21 | if [ "$( fstyp "$targetDevice" | grep hfs )" ]; then␊ |
22 | ␉echo "${targetDevice} is currently formatted as HFS"␊ |
23 | ␉echo "-----------------------------------------------"␊ |
24 | ␉echo ""␊ |
25 | ␉exit 1␊ |
26 | ␊ |
27 | fi␊ |
28 | if [ "$( fstyp "$targetDevice" | grep msdos )" ]; then␊ |
29 | ␉echo "${targetDevice} is currently formatted as msdos"␊ |
30 | ␉echo "-----------------------------------------------"␊ |
31 | ␉echo ""␊ |
32 | ␉exit 2␊ |
33 | fi ␊ |
34 | ␊ |
35 | echo "-----------------------------------------------"␊ |
36 | echo ""␊ |
37 | ␊ |
38 | exit 0 |