Chameleon

Chameleon Commit Details

Date:2011-09-20 09:02:44 (12 years 6 months ago)
Author:blackosx
Commit:1542
Parents: 1541
Message:Add check for /Volumes/EFI exists when using a 'small' HFS volume. for example a 1GB USB flash drive. Also add a rudimentary error log to help users understand why the install process should fail (even though the package installer says completed.)
Changes:
M/branches/blackosx/package/Scripts/Install/CheckGRUBLinuxLoader.sh
M/branches/blackosx/package/Scripts/Install/UnMountEFIvolumes.sh
M/branches/blackosx/package/Scripts/Standard/postinstall
M/branches/blackosx/package/Scripts/Install/CheckProceed.sh
M/branches/blackosx/package/Scripts/EFI/postinstall

File differences

branches/blackosx/package/Scripts/Standard/postinstall
7171
7272
7373
74
74
7575
7676
7777
......
8080
8181
8282
83
83
8484
8585
8686
......
133133
134134
135135
136
136137
137138
138139
# Double check we can see the selected partition and it's of the right type
# if not the following script returns to indicate failure.
"$scriptDir"CheckProceed.sh "${targetVolume}" "${targetDevice}"
"$scriptDir"CheckProceed.sh "${targetVolume}" "${targetVolume}" "${targetDeviceTemp}" "${scriptDir}"
returnValue=$?
if [ ${returnValue}=0 ]; then
# OK to proceed
# Does a GRUB or Linux loader already exist in the disk's MBR?
# The script returns 1 if yes, 0 if no.
"$scriptDir"CheckGRUBLinuxLoader.sh "${targetDisk}"
"$scriptDir"CheckGRUBLinuxLoader.sh "${targetDisk}" "${targetVolume}" "${scriptDir}"
returnValue=$?
if [ ${returnValue} = 0 ]; then
# OK to proceed
if [ "${fatType}" = 1 ] && [ "${partitionTable}" = 3 ]; then
echo "ERROR: - Can't install to a device using FAT16"
# Write error to Chameleon_Error_Log file
"$scriptDir"InstallLog.sh "${targetVolume}" "Cannot install to a device using FAT16"
else
# Continue if the selected device is not a FAT16 format device
branches/blackosx/package/Scripts/EFI/postinstall
7979
8080
8181
82
82
8383
8484
8585
......
8888
8989
9090
91
91
9292
9393
9494
......
129129
130130
131131
132
132
133133
134134
135135
# Double check we can see the selected partition and it's of the right type
"$scriptDir"CheckProceed.sh "${targetVolumeTemp}" "${targetDeviceTemp}"
"$scriptDir"CheckProceed.sh "${targetVolumeTemp}" "${targetVolume}" "${targetDeviceTemp}" "${scriptDir}"
returnValue=$?
if [ ${returnValue} = 0 ]; then
# OK to proceed
# Does a GRUB or Linux loader already exist in the disk's MBR?
# The script returns 1 if yes, 0 if no.
"$scriptDir"CheckGRUBLinuxLoader.sh "${targetDisk}"
"$scriptDir"CheckGRUBLinuxLoader.sh "${targetDisk}" "${targetVolumeTemp}" "${scriptDir}"
returnValue=$?
if [ ${returnValue} = 0 ]; then
# OK to proceed
# the following script returns 0 if it succeeds
# the following script returns 1 if it fails to un-mount any EFI volume
"$scriptDir"UnMountEFIvolumes.sh
"$scriptDir"UnMountEFIvolumes.sh "${targetVolumeTemp}" "${scriptDir}"
returnValue=$?
if [ ${returnValue} = 0 ]; then
# OK to proceed
branches/blackosx/package/Scripts/Install/CheckProceed.sh
44
55
66
7
87
98
109
11
12
13
10
11
12
13
14
15
16
17
18
19
20
1421
1522
23
1624
1725
1826
1927
2028
2129
22
30
31
2332
2433
2534
2635
2736
2837
29
38
39
3040
3141
3242
3343
3444
45
46
47
48
49
50
51
52
53
54
55
56
3557
3658
3759
echo "Check Proceed: Can the script continue?"
echo "***************************************"
# Receives targetVolume and targetDevice
# Checks the selected volume is present and the disk
# is partitioned.
if [ "$#" -eq 2 ]; then
targetVolume="$1"
targetDevice="$2"
# Receives targetVolumeTemp: Stores original target if EFI install selected.
# Receives targetVolume: Stores '/Volumes/EFI' if EFI install, or blank if not.
# Receives targetDevice: Stores device number: for example /dev/disk2s1.
# Receives scriptDir: The location of the main script dir.
if [ "$#" -eq 4 ]; then
targetVolumeTemp="$1"
targetVolume="$2"
targetDevice="$3"
scriptDir="$4"
echo "DEBUG: passed argument for targetVolumeTemp = $targetVolumeTemp"
echo "DEBUG: passed argument for targetVolume = $targetVolume"
echo "DEBUG: passed argument for targetDevice = $targetDevice"
echo "DEBUG: passed argument for scriptDir = $scriptDir"
else
echo "Error - wrong number of values passed"
exit 9
fi
if [ -z "$targetVolume" ]; then
echo "Cannot find the volume. Exiting."
echo "*** Cannot find the volume. Exiting."
"$scriptDir"InstallLog.sh "${targetVolumeTemp}" "Cannot file the volume."
exit 1
else
echo "Confirming target volume exists"
fi
if [ "$targetDevice" = "$targetDevice#*disk*s" ]; then
echo "ERROR Volume does not use slices."
echo "*** ERROR Volume does not use slices. Exiting."
"$scriptDir"InstallLog.sh "${targetVolumeTemp}" "The selected volume doesn't use slices."
exit 1
else
echo "Confirming target device uses slices"
fi
# 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
existESP=$( df | grep /dev/disk2s1 | awk {'print $6'} )
if [ ! "$existESP" = "/Volumes/EFI" ]; then
echo "*** The selected volume doesn't have an EFI System Partition. Exiting."
"$scriptDir"InstallLog.sh "${targetVolumeTemp}" "The selected volume doesn't have an EFI System Partition."
exit 1
fi
fi
echo "-----------------------------------------------"
echo ""
branches/blackosx/package/Scripts/Install/CheckGRUBLinuxLoader.sh
44
55
66
7
8
7
98
109
1110
12
11
12
13
14
15
1316
17
18
1419
20
21
1522
1623
1724
......
2936
3037
3138
39
3240
3341
3442
echo "CheckGRUBLinuxLoader: Does GRUB or LILO exist?"
echo "**********************************************"
# This script is passed the targetdisk
# it then reads the MBR of the disk in the attempt to find the
# This reads the MBR of the disk in the attempt to find the
# signature for either the GRUB or Linux bootloaders.
# The script returns 1 if either is found, or 0 if none found.
if [ "$#" -eq 1 ]; then
# Receives targetdisk: Stores device number: for example /dev/disk2
# Receives targetVolumeTemp: Stores original target if EFI install selected.
# Receives scriptDir: The location of the main script dir.
if [ "$#" -eq 3 ]; then
targetDisk="$1"
targetVolumeTemp="$2"
scriptDir="$3"
echo "DEBUG: passed argument for targetDisk = $targetDisk"
echo "DEBUG: passed argument for targetVolumeTemp = $targetVolumeTemp"
echo "DEBUG: passed argument for scriptDir = $scriptDir"
else
echo "Error - wrong number of values passed"
exit 9
diskmicrocodetypeid=${diskmicrocodetype[${diskmicrocodetypecounter}]#*,}
if [ ! "${diskmicrocode}" = "${diskmicrocode/${diskmicrocodetypeid}/}" ]; then
echo "${diskmicrocodetype[${diskmicrocodetypecounter}]%,*} found."
"$scriptDir"InstallLog.sh "${targetVolumeTemp}" "Found an exisitng GRUB/LILO bootloader."
exit 1
else
echo "Didn't find a match for ${diskmicrocodetype[${diskmicrocodetypecounter}]%,*}"
branches/blackosx/package/Scripts/Install/UnMountEFIvolumes.sh
66
77
88
9
10
11
12
13
14
15
16
17
18
19
20
21
22
923
1024
1125
......
1529
1630
1731
32
1833
1934
2035
# loop through and un-mount ALL mounted EFI system partitions - Thanks kizwan
# Receives scriptDir: The location of the main script dir.
# Receives targetVolumeTemp: Stores original target if EFI install selected.
if [ "$#" -eq 2 ]; then
targetVolumeTemp="$1"
scriptDir="$2"
echo "DEBUG: passed argument for targetVolumeTemp = $targetVolumeTemp"
echo "DEBUG: passed argument for scriptDir = $scriptDir"
else
echo "Error - wrong number of values passed"
exit 9
fi
attempts=1
while [ "$( df | grep EFI )" ] && [ "${attempts}" -lt 5 ]; do
echo "Unmounting $( df | grep EFI | awk '{print $1}' )"
if [ ${attempts} = 5 ]; then
echo "failed to unmount EFI System Partition."
echo "-----------------------------------------------"
"$scriptDir"InstallLog.sh "${targetVolumeTemp}" "Failed to unmount EFI System Partition."
echo ""
echo ""
echo ""

Archive Download the corresponding diff file

Revision: 1542