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 "DEBUG: ${targetDevice} is currently formatted as HFS"␊ |
30 | ␉#"$scriptDir"InstallLog.sh "${targetVolume}" "${targetDevice} is currently formatted as HFS"␊ |
31 | ␉exit 1␊ |
32 | ␊ |
33 | fi␊ |
34 | if [ "$( fstyp "$targetDevice" | grep msdos )" ]; then␊ |
35 | ␉#echo "DEBUG: ${targetDevice} is currently formatted as msdos"␊ |
36 | ␉#"$scriptDir"InstallLog.sh "${targetVolume}" "${targetDevice} is currently formatted as msdos"␊ |
37 | ␉exit 2␊ |
38 | fi ␊ |
39 | ␊ |
40 | #echo "DEBUG: WARNING: ${targetDevice} is currently not formatted as either HFS or msdos"␊ |
41 | "$scriptDir"InstallLog.sh "${targetVolume}" "WARNING: ${targetDevice} is currently not formatted as either HFS or msdos"␊ |
42 | ␊ |
43 | exit 0␊ |
44 | |