Index: branches/blackosx/package/Scripts/Main/ESPpostinstall =================================================================== --- branches/blackosx/package/Scripts/Main/ESPpostinstall (revision 1732) +++ branches/blackosx/package/Scripts/Main/ESPpostinstall (revision 1733) @@ -56,6 +56,8 @@ targetResources="${targetVolumeChosenByUser}/usr/local/bin/" +efiPartitionExist=0 # target volume does not have EFI system partition. + echo "===============================================" echo "DEBUG: display script variables" echo "***************************" @@ -92,14 +94,18 @@ echo "Confirm this is a GPT partitioned disk." # Double check we can see the selected partition and it's of the right type. - # If the following script finds anything, it returns 1 to indicate failure. + # The following script returns either 0 or 1 to proceed, or 2 to indicate failure. "$scriptDir"CheckProceed.sh "${targetVolume}" "${targetDeviceChosenByUser}" "${targetVolumeChosenByUser}" "${scriptDir}" returnValue=$? - if [ ${returnValue} = 0 ]; then + if [ ${returnValue} -ne 2 ]; then # OK to proceed + # Remember if the target volume has an EFI system partition. + if [ ${returnValue} -ne 0 ]; then + efiPartitionExist=1 + fi # Does a GRUB or Linux loader already exist in the disk's MBR? # The script returns 1 if yes, 0 if no. @@ -157,7 +163,7 @@ # OK to proceed # Mount the EFI system partition - "$scriptDir"MountESP.sh "${targetDisk}" "${targetVolumeChosenByUser}" "${scriptDir}" + "$scriptDir"MountESP.sh "${targetDisk}" "${targetVolumeChosenByUser}" "${efiPartitionExist}" "${scriptDir}" # Write the stage 2 loader to the root of the selected partition "$scriptDir"WriteChameleonStage2.sh "${stage2Loader}" "${targetVolume}" "${targetDevice}" "${targetVolumeChosenByUser}" "${scriptDir}" Index: branches/blackosx/package/Scripts/Main/Standardpostinstall =================================================================== --- branches/blackosx/package/Scripts/Main/Standardpostinstall (revision 1732) +++ branches/blackosx/package/Scripts/Main/Standardpostinstall (revision 1733) @@ -56,6 +56,7 @@ targetResources="${targetVolume}/usr/local/bin/" updateStage1=1 # by default update partition boot sector +efiPartitionExist=0 # target volume does not have EFI system partition. echo "===============================================" echo "DEBUG: display script variables" @@ -82,12 +83,17 @@ "$scriptDir"InstallLog.sh "${targetVolume}" "Target volume = ${targetVolume} on ${targetDevice}" # Double check we can see the selected partition and it's of the right type. -# If the following script finds anything, it returns 1 to indicate failure. +# The following script returns either 0 or 1 to proceed, or 2 to indicate failure. "$scriptDir"CheckProceed.sh "${targetVolume}" "${targetDevice}" "${targetVolume}" "${scriptDir}" returnValue=$? -if [ ${returnValue} = 0 ]; then +if [ ${returnValue} -ne 2 ]; then # OK to proceed + + # Remember if the target volume has an EFI system partition. + if [ ${returnValue} -ne 0 ]; then + efiPartitionExist=1 + fi # Does a GRUB or Linux loader already exist in the disk's MBR? # The script returns 1 if yes, 0 if no. @@ -182,7 +188,7 @@ if [ ${partitionScheme} = 1 ] || [ ${partitionScheme} = 2 ]; then # Mount the EFI system partition - "$scriptDir"MountESP.sh "${targetDisk}" "${targetVolume}" "${scriptDir}" + "$scriptDir"MountESP.sh "${targetDisk}" "${targetVolume}" "${efiPartitionExist}" "${scriptDir}" fi # Check for another existing Chameleon installation on the same disk Index: branches/blackosx/package/Scripts/Sub/MountESP.sh =================================================================== --- branches/blackosx/package/Scripts/Sub/MountESP.sh (revision 1732) +++ branches/blackosx/package/Scripts/Sub/MountESP.sh (revision 1733) @@ -9,34 +9,43 @@ # Receives targetDisk: for example /dev/disk2. # Receives installerVolume: Volume to write the installer log to. +# Receives efiPartitionExist: either 0 or 1 # Receives scriptDir: The location of the main script dir. -if [ "$#" -eq 3 ]; then +if [ "$#" -eq 4 ]; then targetDisk="$1" installerVolume="$2" - scriptDir="$3" + efiPartitionExist="$3" + scriptDir="$4" echo "DEBUG: passed argument for targetDisk = $targetDisk" echo "DEBUG: passed argument for installerVolume = $installerVolume" + echo "DEBUG: passed argument for installerVolume = $efiPartitionExist" echo "DEBUG: passed argument for scriptDir = $scriptDir" else echo "Error - wrong number of values passed" exit 9 fi +# Check the first partition is actually type 'EFI' +# as we could be checking a USB flash drive <4GB +if [ ${efiPartitionExist} = 1 ]; then -# Does the mountpoint exist? -if [ ! -e "/Volumes/EFI" ]; then - mkdir -p "/Volumes/EFI" -fi + # Does the mountpoint exist? + if [ ! -e "/Volumes/EFI" ]; then + mkdir -p "/Volumes/EFI" + fi -# Mount '/Volumes/EFI' using the correct format type -if [ "$( fstyp "${targetDisk}"s1 | grep hfs )" ]; then - "$scriptDir"InstallLog.sh "${installerVolume}" "Mounting ${targetDisk}s1 as /Volumes/EFI" - mount_hfs "${targetDisk}"s1 "/Volumes/EFI" + # Mount '/Volumes/EFI' using the correct format type + if [ "$( fstyp "${targetDisk}"s1 | grep hfs )" ]; then + "$scriptDir"InstallLog.sh "${installerVolume}" "Mounting ${targetDisk}s1 as /Volumes/EFI" + mount_hfs "${targetDisk}"s1 "/Volumes/EFI" + fi + if [ "$( fstyp "${targetDisk}"s1 | grep msdos )" ]; then + "$scriptDir"InstallLog.sh "${installerVolume}" "Mounting ${targetDisk}s1 as /Volumes/EFI" + mount_msdos -u 0 -g 0 "${targetDisk}"s1 "/Volumes/EFI" + fi +else + "$scriptDir"InstallLog.sh "${installerVolume}" "Target volume doesn't have an EFI system partition." fi -if [ "$( fstyp "${targetDisk}"s1 | grep msdos )" ]; then - "$scriptDir"InstallLog.sh "${installerVolume}" "Mounting ${targetDisk}s1 as /Volumes/EFI" - mount_msdos -u 0 -g 0 "${targetDisk}"s1 "/Volumes/EFI" -fi exit 0 \ No newline at end of file Index: branches/blackosx/package/Scripts/Sub/CheckProceed.sh =================================================================== --- branches/blackosx/package/Scripts/Sub/CheckProceed.sh (revision 1732) +++ branches/blackosx/package/Scripts/Sub/CheckProceed.sh (revision 1733) @@ -6,6 +6,9 @@ # 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 2 to indicate not to proceed. # Receives targetVolume: Volume to install to (will be '/Volumes/EFI' if EFI install) # Receives targetDevice: Stores device number, for example /dev/disk2s1. @@ -31,7 +34,7 @@ if [ -z "$targetVolume" ]; then echo "*** Cannot find the volume. Exiting." "$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: Cannot file the volume: $targetVolume." - exit 1 + exit 2 #else #echo "DEBUG: Confirming target volume exists" fi @@ -41,7 +44,7 @@ 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 1 + exit 2 #else #echo "DEBUG: Confirming target device uses slices" fi