1 | #!/bin/bash␊ |
2 | ␊ |
3 | echo "==============================================="␊ |
4 | echo "Check Proceed: Can the script continue?"␊ |
5 | echo "***************************************"␊ |
6 | ␊ |
7 | # Checks the selected volume is present and the disk␊ |
8 | # is partitioned.␊ |
9 | ␊ |
10 | # Receives targetVolumeTemp: Stores original target if EFI install selected.␊ |
11 | # Receives targetVolume: Stores '/Volumes/EFI' if EFI install, or blank if not. ␊ |
12 | # Receives targetDevice: Stores device number: for example /dev/disk2s1.␊ |
13 | # Receives scriptDir: The location of the main script dir.␊ |
14 | ␊ |
15 | if [ "$#" -eq 4 ]; then␊ |
16 | ␉targetVolumeTemp="$1"␊ |
17 | ␉targetVolume="$2"␊ |
18 | ␉targetDevice="$3"␊ |
19 | ␉scriptDir="$4"␊ |
20 | ␉echo "DEBUG: passed argument for targetVolumeTemp = $targetVolumeTemp"␊ |
21 | ␉echo "DEBUG: passed argument for targetVolume = $targetVolume"␊ |
22 | ␉echo "DEBUG: passed argument for targetDevice = $targetDevice"␊ |
23 | ␉echo "DEBUG: passed argument for scriptDir = $scriptDir"␊ |
24 | else␊ |
25 | ␉echo "Error - wrong number of values passed"␊ |
26 | ␉exit 9␊ |
27 | fi␊ |
28 | ␊ |
29 | if [ -z "$targetVolume" ]; then␊ |
30 | ␉echo "*** Cannot find the volume. Exiting."␊ |
31 | ␉"$scriptDir"InstallLog.sh "${targetVolumeTemp}" "Cannot file the volume."␊ |
32 | ␉exit 1␊ |
33 | else␊ |
34 | ␉echo "Confirming target volume exists"␊ |
35 | fi␊ |
36 | ␊ |
37 | if [ "$targetDevice" = "$targetDevice#*disk*s" ]; then␊ |
38 | ␉echo "*** ERROR Volume does not use slices. Exiting."␊ |
39 | ␉"$scriptDir"InstallLog.sh "${targetVolumeTemp}" "The selected volume doesn't use slices."␊ |
40 | ␉exit 1␉␉␊ |
41 | else␊ |
42 | ␉echo "Confirming target device uses slices"␊ |
43 | fi␊ |
44 | ␊ |
45 | # Add check for installing to a 'small' HFS device like a␊ |
46 | # 1GB USB flash drive which won't have an EFI System Partition.␊ |
47 | ␊ |
48 | if [ "$targetVolume" = "/Volumes/EFI" ]; then␊ |
49 | ␉existESP=$( df | grep /dev/disk2s1 | awk {'print $6'} )␊ |
50 | ␉if [ ! "$existESP" = "/Volumes/EFI" ]; then␊ |
51 | ␉␉echo "*** The selected volume doesn't have an EFI System Partition. Exiting."␊ |
52 | ␉␉"$scriptDir"InstallLog.sh "${targetVolumeTemp}" "The selected volume doesn't have an EFI System Partition."␊ |
53 | ␉␉exit 1␊ |
54 | ␉fi␊ |
55 | fi␊ |
56 | ␊ |
57 | echo "-----------------------------------------------"␊ |
58 | echo ""␊ |
59 | ␊ |
60 | exit 0 |