1 | #!/bin/bash␊ |
2 | ␊ |
3 | echo "==============================================="␊ |
4 | echo "Check the format of the selected partition"␊ |
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 | fi␊ |
17 | ␊ |
18 | if [ "$( fstyp "$targetDevice" | grep hfs )" ]; then␊ |
19 | ␉echo "${targetDevice} is currently formatted as HFS"␊ |
20 | ␉echo "-----------------------------------------------"␊ |
21 | ␉echo ""␊ |
22 | ␉exit 1␊ |
23 | ␊ |
24 | fi␊ |
25 | if [ "$( fstyp "$targetDevice" | grep msdos )" ]; then␊ |
26 | ␉echo "${targetDevice} is currently formatted as msdos"␊ |
27 | ␉echo "-----------------------------------------------"␊ |
28 | ␉echo ""␊ |
29 | ␉exit 2␊ |
30 | fi ␊ |
31 | ␊ |
32 | echo "-----------------------------------------------"␊ |
33 | echo ""␊ |
34 | ␊ |
35 | exit 0 |