Root/
| |
---|---|
Source at commit 2740 created 8 years 11 months ago. By ifabio, sync with trunk. | |
1 | #!/bin/bash␊ |
2 | ␊ |
3 | echo "==============================================="␊ |
4 | echo "Check Proceed: Can the installation continue?"␊ |
5 | echo "***********************************************"␊ |
6 | ␊ |
7 | # Checks the selected volume is present and the disk is partitioned␊ |
8 | # Now also check for another existing Chameleon installation on the same disk.␊ |
9 | # Exit with 0 to indicate okay to proceed, no problems.␊ |
10 | # Exit with 1 to indicate okay to proceed, but target disk doesn't have EFI system partition.␊ |
11 | # Exit with 2 to indicate not to proceed.␊ |
12 | ␊ |
13 | # Receives targetVolume: Volume to install to (will be '/Volumes/EFI' if EFI install)␊ |
14 | # Receives targetDevice: Stores device number, for example /dev/disk2s1.␊ |
15 | # Receives installerVolume: Volume to write the installer log to.␊ |
16 | # Receives scriptDir: The location of the main script dir.␊ |
17 | ␊ |
18 | if [ "$#" -eq 4 ]; then␊ |
19 | ␉targetVolume="$1"␊ |
20 | ␉targetDevice="$2"␊ |
21 | ␉installerVolume="$3"␊ |
22 | ␉scriptDir="$4"␊ |
23 | ␉echo "DEBUG: passed argument for targetVolume = $targetVolume"␊ |
24 | ␉echo "DEBUG: passed argument for targetDevice = $targetDevice"␊ |
25 | ␉echo "DEBUG: passed argument for installerVolume = $installerVolume"␊ |
26 | ␉echo "DEBUG: passed argument for scriptDir = $scriptDir"␊ |
27 | else␊ |
28 | ␉echo "Error - wrong number of values passed"␊ |
29 | ␉exit 9␊ |
30 | fi␊ |
31 | ␊ |
32 | # Does target volume exist?␊ |
33 | if [ -z "$targetVolume" ]; then␊ |
34 | ␉echo "*** Cannot find the volume. Exiting."␊ |
35 | ␉"$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: Cannot file the volume: $targetVolume."␊ |
36 | ␉exit 2␊ |
37 | fi␊ |
38 | ␊ |
39 | # Does target volume use slices?␊ |
40 | if [ "$targetDevice" = "$targetDevice#*disk*s" ]; then␊ |
41 | ␉echo "*** ERROR Volume does not use slices. Exiting."␊ |
42 | ␉"$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: $targetVolume doesn't use slices."␊ |
43 | ␉exit 2␉␉␊ |
44 | fi␊ |
45 | ␊ |
46 | # Check to find if an EFI system partition exists on the disk.␊ |
47 | # This is used in two cases:␊ |
48 | # A) When checking for existing Chameleon installations.␊ |
49 | # B) When the user chooses the EFI system partition install option,␊ |
50 | # and installing to a 'small' HFS device like a 1GB USB flash ␊ |
51 | # drive which won't have an EFI System Partition.␊ |
52 | ␊ |
53 | # Take target device and check if slice 1 is not named "EFI"␊ |
54 | stripped=$( echo ${targetDevice#/dev/} )␊ |
55 | if [ ! $(echo ${stripped#*disk*s}) = 1 ]; then␊ |
56 | ␉stripped=$( echo ${stripped%s*})"s1"␊ |
57 | fi␊ |
58 | if [ ! $( diskutil list | grep ${stripped} | awk {'print $2'} ) = "EFI" ]; then␊ |
59 | ␉if [ "$targetVolume" = "/Volumes/EFI" ]; then␊ |
60 | ␉␉"$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: Selected disk does not have an EFI System Partition."␊ |
61 | ␉fi␊ |
62 | ␉exit 1␊ |
63 | fi␊ |
64 | ␊ |
65 | exit 0 |