Chameleon

Chameleon Commit Details

Date:2011-12-15 19:36:26 (8 years 11 months ago)
Author:blackosx
Commit:1733
Parents: 1732
Message:Use the result from an intitial check to find if the target volume has an EFI system partition, later on in the installation process before checking for previous Chameleon installations. Add some feedback to the installer log.
Changes:
M/branches/blackosx/package/Scripts/Main/ESPpostinstall
M/branches/blackosx/package/Scripts/Sub/MountESP.sh
M/branches/blackosx/package/Scripts/Main/Standardpostinstall
M/branches/blackosx/package/Scripts/Sub/CheckProceed.sh

File differences

branches/blackosx/package/Scripts/Main/ESPpostinstall
5656
5757
5858
59
60
5961
6062
6163
......
9294
9395
9496
95
97
9698
9799
98100
99101
100
102
101103
102104
105
106
107
108
103109
104110
105111
......
157163
158164
159165
160
166
161167
162168
163169
targetResources="${targetVolumeChosenByUser}/usr/local/bin/"
efiPartitionExist=0 # target volume does not have EFI system partition.
echo "==============================================="
echo "DEBUG: display script variables"
echo "***************************"
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.
# 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}"
branches/blackosx/package/Scripts/Main/Standardpostinstall
5656
5757
5858
59
5960
6061
6162
......
8283
8384
8485
85
86
8687
8788
8889
89
90
9091
92
93
94
95
96
9197
9298
9399
......
182188
183189
184190
185
191
186192
187193
188194
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"
"$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.
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
branches/blackosx/package/Scripts/Sub/MountESP.sh
99
1010
1111
12
1213
1314
14
15
1516
1617
17
18
19
1820
1921
22
2023
2124
2225
2326
2427
2528
29
30
31
2632
27
28
29
30
33
34
35
36
3137
32
33
34
35
38
39
40
41
42
43
44
45
46
47
48
3649
37
38
39
40
4150
4251
# 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
branches/blackosx/package/Scripts/Sub/CheckProceed.sh
66
77
88
9
10
11
912
1013
1114
......
3134
3235
3336
34
37
3538
3639
3740
......
4144
4245
4346
44
47
4548
4649
4750
# 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.
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
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

Archive Download the corresponding diff file

Revision: 1733