1 | #!/bin/bash␊ |
2 | ␊ |
3 | echo "==============================================="␊ |
4 | echo "CheckFormat: Is target HFS or MSDOS?"␊ |
5 | echo "**********************************************"␊ |
6 | ␊ |
7 | # if the selected partition is formatted as HFS then exit with 1␊ |
8 | # if the selected partition is formatted as MSDOS then exit with 2␊ |
9 | # if fstyp doesn't return a value then exit with 0␊ |
10 | ␊ |
11 | # Receives targetDevice: for example, /dev/disk0s2␊ |
12 | # Receives targetVolume: Volume to install to.␊ |
13 | # Receives scriptDir: The location of the main script dir.␊ |
14 | ␊ |
15 | ␊ |
16 | if [ "$#" -eq 3 ]; then␊ |
17 | ␉targetDevice="$1"␊ |
18 | ␉targetVolume="$2"␊ |
19 | ␉scriptDir="$3"␊ |
20 | ␉echo "DEBUG: passed argument for targetDevice = $targetDevice"␊ |
21 | ␉echo "DEBUG: passed argument for targetVolume = $targetVolume"␊ |
22 | ␉echo "DEBUG: passed argument for scriptDir = $scriptDir"␊ |
23 | else␊ |
24 | ␉echo "Error - wrong number of values passed"␊ |
25 | ␉exit 9␊ |
26 | fi␊ |
27 | ␊ |
28 | if [ "$( fstyp "$targetDevice" | grep hfs )" ]; then␊ |
29 | ␉echo "${targetDevice} is currently formatted as HFS"␊ |
30 | ␉echo "-----------------------------------------------"␊ |
31 | ␉echo ""␊ |
32 | ␉#"$scriptDir"InstallLog.sh "${targetVolume}" "${targetDevice} is currently formatted as HFS"␊ |
33 | ␉exit 1␊ |
34 | ␊ |
35 | fi␊ |
36 | if [ "$( fstyp "$targetDevice" | grep msdos )" ]; then␊ |
37 | ␉echo "${targetDevice} is currently formatted as msdos"␊ |
38 | ␉echo "-----------------------------------------------"␊ |
39 | ␉echo ""␊ |
40 | ␉#"$scriptDir"InstallLog.sh "${targetVolume}" "${targetDevice} is currently formatted as msdos"␊ |
41 | ␉exit 2␊ |
42 | fi ␊ |
43 | ␊ |
44 | echo "WARNING: ${targetDevice} is currently not formatted as either HFS or msdos"␊ |
45 | echo "-----------------------------------------------"␊ |
46 | echo ""␊ |
47 | ␊ |
48 | "$scriptDir"InstallLog.sh "${targetVolume}" "WARNING: ${targetDevice} is currently not formatted as either HFS or msdos"␊ |
49 | ␊ |
50 | exit 0 |