# Checks the selected volume is present and the disk is partitioned␊ |
# Now also check for another existing Chameleon installation on the same disk.␊ |
# Exit with 0 to indicate okay to proceed, no problems.␊ |
# Exit with 1 to indicate okay to proceed, but note target doesn't have EFI system partition.␊ |
# Exit with 1 to indicate okay to proceed, but target disk doesn't have EFI system partition.␊ |
# Exit with 2 to indicate not to proceed.␊ |
␊ |
# Receives targetVolume: Volume to install to (will be '/Volumes/EFI' if EFI install)␊ |
|
␉exit 9␊ |
fi␊ |
␊ |
␊ |
# Does target volume exist?␊ |
if [ -z "$targetVolume" ]; then␊ |
␉echo "*** Cannot find the volume. Exiting."␊ |
␉"$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: Cannot file the volume: $targetVolume."␊ |
␉exit 2␊ |
#else␊ |
␉#echo "DEBUG: Confirming target volume exists"␊ |
fi␊ |
␊ |
␊ |
# Does target volume use slices?␊ |
if [ "$targetDevice" = "$targetDevice#*disk*s" ]; then␊ |
␉echo "*** ERROR Volume does not use slices. Exiting."␊ |
␉"$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: $targetVolume doesn't use slices."␊ |
␉exit 2␉␉␊ |
#else␊ |
␉#echo "DEBUG: Confirming target device uses slices"␊ |
fi␊ |
␊ |
# Check to find if an EFI system partition exists on the disk.␊ |
# This is used in two cases:␊ |
# A) When checking for existing Chameleon installations.␊ |
# B) When the user chooses the EFI system partition install option,␊ |
# and installing to a 'small' HFS device like a 1GB USB flash ␊ |
# drive which won't have an EFI System Partition.␊ |
␊ |
# Add check for installing to a 'small' HFS device like a␊ |
# 1GB USB flash drive which won't have an EFI System Partition.␊ |
if [ "$targetVolume" = "/Volumes/EFI" ]; then␊ |
␉# Take target device and check slice 1 matches partition named "EFI"␊ |
␉stripped=$( echo ${targetDevice#/dev/} )␊ |
␉if [ ! $(echo ${stripped#*disk*s}) = 1 ]; then␊ |
␉␉stripped=$( echo ${stripped%s*})"s1"␊ |
␉fi␊ |
␉if [ ! $( diskutil list | grep ${stripped} | awk {'print $2'} ) = "EFI" ]; then␊ |
␉␉#echo "DEBUG: *** The selected volume doesn't have an EFI System Partition. Exiting."␊ |
# Take target device and check if slice 1 is not named "EFI"␊ |
stripped=$( echo ${targetDevice#/dev/} )␊ |
if [ ! $(echo ${stripped#*disk*s}) = 1 ]; then␊ |
␉stripped=$( echo ${stripped%s*})"s1"␊ |
fi␊ |
if [ ! $( diskutil list | grep ${stripped} | awk {'print $2'} ) = "EFI" ]; then␊ |
␉if [ "$targetVolume" = "/Volumes/EFI" ]; then␊ |
␉␉"$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: Selected disk does not have an EFI System Partition."␊ |
␉␉exit 1␊ |
␉fi␊ |
␉exit 1␊ |
fi␊ |
␊ |
exit 0 |