Chameleon

Chameleon Commit Details

Date:2011-09-21 09:21:46 (12 years 6 months ago)
Author:blackosx
Commit:1553
Parents: 1552
Message:Further Enhanced install log.
Changes:
M/branches/blackosx/package/Scripts/Install/CheckGRUBLinuxLoader.sh
M/branches/blackosx/package/Scripts/Install/CheckWindowsDiskSignature.sh
M/branches/blackosx/package/Scripts/Install/CheckFormat.sh
M/branches/blackosx/package/Scripts/Install/CheckFatType.sh
M/branches/blackosx/package/Scripts/Install/CheckPartitionScheme.sh
M/branches/blackosx/package/Scripts/Install/CheckDiskMicrocode.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
9292
9393
9494
95
95
9696
9797
9898
......
110110
111111
112112
113
113
114114
115115
116116
......
120120
121121
122122
123
123
124124
125125
126126
......
129129
130130
131131
132
132
133133
134134
135135
# check for a 4-byte Windows disk signature in the disk's MBR.
# the following script returns 1 if a Windows disk signature exists, and 0 if not.
"$scriptDir"CheckWindowsDiskSignature.sh "${targetDisk}"
"$scriptDir"CheckWindowsDiskSignature.sh "${targetDisk}" "${targetVolume}" "${scriptDir}"
diskSigCheck=$?
# the following script returns 2 if MSDOS
# the following script returns 0 if nothing
"$scriptDir"CheckFormat.sh "${targetDevice}"
"$scriptDir"CheckFormat.sh "${targetDevice}" "${targetVolume}" "${scriptDir}"
espformat=$?
# the following script returns 3 if MBR
# the following script returns 0 if nothing
"$scriptDir"CheckPartitionScheme.sh "${targetDisk}"
"$scriptDir"CheckPartitionScheme.sh "${targetDisk}" "${targetVolume}" "${scriptDir}"
partitionTable=$?
if [ ${partitionTable} = 3 ]; then
# If MBR partition scheme then check for FAT16 or FAT32
# the following script returns 2 if FAT32
# the following script returns 0 if nothing
"$scriptDir"CheckFatType.sh "${targetDeviceRaw}"
"$scriptDir"CheckFatType.sh "${targetDeviceRaw}" "${targetVolume}" "${scriptDir}"
fatType=$?
fi
branches/blackosx/package/Scripts/EFI/postinstall
103103
104104
105105
106
106
107107
108108
109109
......
121121
122122
123123
124
124
125125
126126
127127
128128
129129
130130
131
131
132132
133133
134134
# check for a 4-byte Windows disk signature in the disk's MBR.
# the following script returns 1 if a Windows disk signature exists, and 0 if not.
"$scriptDir"CheckWindowsDiskSignature.sh "${targetDisk}"
"$scriptDir"CheckWindowsDiskSignature.sh "${targetDisk}" "${targetVolumeChosenByUser}" "${scriptDir}"
diskSigCheck=$?
# the following script returns 2 if MSDOS
# the following script returns 0 if nothing - **** the script shouldn't continue here??? as the partition is not formatted as either HFS or msdos??? ****
"$scriptDir"CheckFormat.sh "${targetDevice}"
"$scriptDir"CheckFormat.sh "${targetDevice}" "${targetVolumeChosenByUser}" "${scriptDir}"
espformat=$?
# Determine the partition scheme of the selected disk
# is it GPT or a hybrid GPT/MBR
"$scriptDir"CheckPartitionScheme.sh "${targetDisk}"
"$scriptDir"CheckPartitionScheme.sh "${targetDisk}" "${targetVolumeChosenByUser}" "${scriptDir}"
# Unmount ALL mounted volumes named EFI
branches/blackosx/package/Scripts/Install/CheckFormat.sh
44
55
66
7
8
97
108
119
1210
13
11
12
13
14
15
16
1417
18
19
1520
21
22
1623
1724
1825
......
2229
2330
2431
32
2533
2634
2735
......
2937
3038
3139
40
3241
3342
3443
......
3645
3746
3847
48
49
3950
echo "CheckFormat: Is target HFS or MSDOS?"
echo "**********************************************"
# Receives passed value for the Target Volume Device
# for example: /dev/disk0s2
# if the selected partition is formatted as HFS then exit with 1
# if the selected partition is formatted as MSDOS then exit with 2
# if fstyp doesn't return a value then exit with 0
if [ "$#" -eq 1 ]; then
# Receives targetDevice: for example, /dev/disk0s2
# Receives targetVolume: Volume to install to.
# Receives scriptDir: The location of the main script dir.
if [ "$#" -eq 3 ]; then
targetDevice="$1"
targetVolume="$2"
scriptDir="$3"
echo "DEBUG: passed argument for targetDevice = $targetDevice"
echo "DEBUG: passed argument for targetVolume = $targetVolume"
echo "DEBUG: passed argument for scriptDir = $scriptDir"
else
echo "Error - wrong number of values passed"
exit 9
echo "${targetDevice} is currently formatted as HFS"
echo "-----------------------------------------------"
echo ""
"$scriptDir"InstallLog.sh "${targetVolume}" "${targetDevice} is currently formatted as HFS"
exit 1
fi
echo "${targetDevice} is currently formatted as msdos"
echo "-----------------------------------------------"
echo ""
"$scriptDir"InstallLog.sh "${targetVolume}" "${targetDevice} is currently formatted as msdos"
exit 2
fi
echo "-----------------------------------------------"
echo ""
"$scriptDir"InstallLog.sh "${targetVolume}" "WARNING: ${targetDevice} is currently not formatted as either HFS or msdos"
exit 0
branches/blackosx/package/Scripts/Install/CheckFatType.sh
44
55
66
7
8
9
7
108
119
1210
......
1412
1513
1614
17
15
16
17
18
19
20
1821
22
23
1924
25
26
2027
2128
2229
......
2835
2936
3037
38
3139
3240
3341
3442
3543
3644
45
3746
3847
3948
4049
4150
4251
52
4353
4454
4555
4656
4757
4858
59
4960
5061
5162
5263
5364
5465
66
5567
5668
5769
5870
5971
6072
73
6174
6275
6376
echo "CheckFatType: Do we have FAT16 or FAT32?"
echo "****************************************"
# Receives passed value for the raw Target Device
# for example: /dev/rdisk0s2
# Then looks for the following in the partition boot sector
# Looks for the following in the partition boot sector
# Byte number 19 to see if it's either 00 or 02
# Byte number 22 to see if it's either F8 or F0
# Byte number 25 to see if it's either 3F or 20
# Exit with value 1 for FAT16, 2 for FAT32
# Exit with value 0 if nothing is found - this shouldn't happen.?
if [ "$#" -eq 1 ]; then
# Receives targetDeviceRaw: for example, /dev/rdisk0s2.
# Receives targetVolume: Volume to install to.
# Receives scriptDir: The location of the main script dir.
if [ "$#" -eq 3 ]; then
targetDeviceRaw="$1"
targetVolume="$2"
scriptDir="$3"
echo "DEBUG: passed argument = $targetDeviceRaw"
echo "DEBUG: passed argument for targetVolume = $targetVolume"
echo "DEBUG: passed argument for scriptDir = $scriptDir"
else
echo "Error - wrong number of values passed"
exit 9
echo "Found a FAT32 device formatted by Windows Explorer"
echo "--------------------------------------------------"
echo ""
"$scriptDir"InstallLog.sh "${targetVolume}" "${targetDeviceRaw} is on a FAT32 volume formatted by Windows Explorer"
exit 2
fi
if [ "${partitionBootSector:36:2}" == "02" ] && [ "${partitionBootSector:42:2}" == "f8" ] && [ "${partitionBootSector:48:2}" == "3f" ]; then
echo "Found a FAT16 device formatted by Windows Explorer"
echo "--------------------------------------------------"
echo ""
"$scriptDir"InstallLog.sh "${targetVolume}" "${targetDeviceRaw} is on a FAT16 volume formatted by Windows Explorer"
exit 1
fi
if [ "${partitionBootSector:36:2}" == "00" ] && [ "${partitionBootSector:42:2}" == "f0" ] && [ "${partitionBootSector:48:2}" == "20" ]; then
echo "Found a FAT32 device formatted by OS X Snow Leopard Disk Utility"
echo "----------------------------------------------------------------"
echo ""
"$scriptDir"InstallLog.sh "${targetVolume}" "${targetDeviceRaw} is on a FAT32 volume formatted by OS X Snow Leopard Disk Utility"
exit 2
fi
if [ "${partitionBootSector:36:2}" == "02" ] && [ "${partitionBootSector:42:2}" == "f0" ] && [ "${partitionBootSector:48:2}" == "20" ]; then
echo "Found a FAT16 device formatted by OS X Snow Leopard Disk Utility"
echo "----------------------------------------------------------------"
echo ""
"$scriptDir"InstallLog.sh "${targetVolume}" "${targetDeviceRaw} is on a FAT16 volume formatted by OS X Snow Leopard Disk Utility"
exit 1
fi
if [ "${partitionBootSector:36:2}" == "00" ] && [ "${partitionBootSector:42:2}" == "f8" ] && [ "${partitionBootSector:48:2}" == "20" ]; then
echo "Found a FAT32 device formatted by OS X Lion Disk Utility"
echo "--------------------------------------------------------"
echo ""
"$scriptDir"InstallLog.sh "${targetVolume}" "${targetDeviceRaw} is on a FAT32 volume formatted by OS X Lion Disk Utility"
exit 2
fi
if [ "${partitionBootSector:36:2}" == "02" ] && [ "${partitionBootSector:42:2}" == "f8" ] && [ "${partitionBootSector:48:2}" == "20" ]; then
echo "Found a FAT16 device formatted by OS X Lion Disk Utility"
echo "--------------------------------------------------------"
echo ""
"$scriptDir"InstallLog.sh "${targetVolume}" "${targetDeviceRaw} is on a FAT16 volume formatted by OS X Lion Disk Utility"
exit 1
fi
echo "-----------------------------------------------"
branches/blackosx/package/Scripts/Install/CheckPartitionScheme.sh
44
55
66
7
8
9
10
7
118
129
1310
1411
1512
1613
17
14
15
16
17
18
19
1820
21
22
1923
24
25
2026
2127
2228
......
3440
3541
3642
43
3744
3845
3946
4047
4148
4249
50
4351
4452
4553
......
4856
4957
5058
59
5160
5261
5362
5463
5564
5665
66
67
68
5769
echo "Check the Partition Scheme: GPT, GPT/MBR or MBR?"
echo "************************************************"
# Receives passed value for the Target Disk
# for example: /dev/disk0s2
# Then looks for the following:
# First 8 bytes of the GPTdiskGPTHeader to identify a GUID partition table.
# Looks for the first 8 bytes of the GPTdiskGPTHeader to identify a GUID partition table.
# Byte number 450 of the GPTdiskProtectiveMBR to identify ID of 'EE' to identify a GPT partition.
# Byte numbers 466, 482 & 498 of the GPTdiskProtectiveMBR to identify further partitions.
#
# Exit with value 1 for GPT, 2 for GPT/MBR and 3 for MBR.
# Exit with value 0 if nothing is found - this shouldn't happen.?
if [ "$#" -eq 1 ]; then
# Receives targetDisk: for example, /dev/disk0s2
# Receives targetVolume: Volume to install to.
# Receives scriptDir: The location of the main script dir.
if [ "$#" -eq 3 ]; then
targetDisk="$1"
targetVolume="$2"
scriptDir="$3"
echo "DEBUG: passed argument = $targetDisk"
echo "DEBUG: passed argument for targetVolume = $targetVolume"
echo "DEBUG: passed argument for scriptDir = $scriptDir"
else
echo "Error - wrong number of values passed"
exit 9
echo "${partitiontable} found."
echo "-----------------------------------------------"
echo ""
"$scriptDir"InstallLog.sh "${targetVolume}" "Identified ${targetDisk} is on a volume using a GPT."
exit 1
else
partitiontable="GPT/MBR"
echo "${partitiontable} found."
echo "-----------------------------------------------"
echo ""
"$scriptDir"InstallLog.sh "${targetVolume}" "Identified ${targetDisk} is on a volume using a GPT/MBR."
exit 2
fi
fi
echo "${partitiontable} found."
echo "-----------------------------------------------"
echo ""
"$scriptDir"InstallLog.sh "${targetVolume}" "Identified ${targetDisk} is on a volume using MBR."
exit 3
fi
echo "No partition table found."
echo "-----------------------------------------------"
echo ""
"$scriptDir"InstallLog.sh "${targetVolume}" "NOTE: No partition table found."
exit 0
branches/blackosx/package/Scripts/Install/CheckDiskMicrocode.sh
4141
4242
4343
44
4445
4546
4647
......
4950
5051
5152
53
5254
5355
5456
......
6163
6264
6365
66
6467
6568
6669
6770
71
6872
6973
7074
7175
7276
7377
78
7479
7580
7681
7782
83
7884
7985
8086
......
8288
8389
8490
91
8592
8693
8794
......
9198
9299
93100
94
101
95102
96103
97104
if [ $( echo "${mbr437}" | awk -F0 '{print NF-1}' ) = 874 ]; then
echo "The first 437 bytes of the MBR Disk Sector is blank - Updating"
"$scriptDir"InstallLog.sh "${targetVolume}" "First 437 bytes of the MBR are currently blank. Will update."
else
# There is already something on the MBR
windowsloader=$( dd 2>/dev/null if="$targetDisk" count=4 bs=1 | xxd | awk '{print $2$3}' )
if [ "${windowsloader}" == "33c08ed0" ] ; then
echo "Found existing Windows Boot Loader so will replace with Chameleon Boot0hfs"
"$scriptDir"InstallLog.sh "${targetVolume}" "Found existing Windows boot loader - Will replace with boot0hfs"
fi
# See if a Chameleon stage0 boot file already exists
#echo ${stage0type}
if [ "${stage0type}" == "0b807c" ]; then
echo "Found existing Chameleon stage 0 loader - Boot0hfs"
"$scriptDir"InstallLog.sh "${targetVolume}" "Found existing Chameleon stage 0 loader - boot0hfs"
# Script CheckDiskSignature.sh returned 0 if a Windows installation was NOT found
if [ "$diskSigCheck" == "0" ]; then
echo "Found no existing Windows installation so will replace stage 0 loader with Boot0"
"$scriptDir"InstallLog.sh "${targetVolume}" "Windows is not installed - Replace boot0hfs with boot0"
exit 0
fi
fi
if [ "${stage0type}" == "0a803c" ]; then
echo "Found existing Chameleon stage 0 loader - Boot0"
"$scriptDir"InstallLog.sh "${targetVolume}" "Found existing Chameleon stage 0 loader - boot0"
# Script CheckDiskSignature.sh returned 1 if a Windows installation was found
if [ "$diskSigCheck" = "1" ]; then
echo "Found existing Windows installation so will replace stage 0 loader with Boot0hfs"
"$scriptDir"InstallLog.sh "${targetVolume}" "As Windows is installed - Replace boot0 with boot0hfs"
exit 0
fi
fi
if [ "${stage0type}" == "ee7505" ]; then
echo "Found existing Chameleon stage 0 loader - Boot0md"
echo "And will leave boot0md installed."
"$scriptDir"InstallLog.sh "${targetVolume}" "Found existing Chameleon stage 0 loader - boot0md. Leaving as is."
exit 1
fi
echo "Disk microcode found: ${test} - Preserving."
echo "diskupdate is set to false"
echo "-----------------------------------------------"
"$scriptDir"InstallLog.sh "${targetVolume}" "NOTE: Found existing unknown bootcode in the MBR"
"$scriptDir"InstallLog.sh "${targetVolume}" "NOTE: Found existing unknown bootcode in the MBR. Leaving as is."
echo ""
exit 1
fi
branches/blackosx/package/Scripts/Install/CheckProceed.sh
4848
4949
5050
51
51
5252
5353
5454
existESP=$( df | grep $targetDevice | awk {'print $6'} )
if [ ! "$existESP" = "/Volumes/EFI" ]; then
echo "*** The selected volume doesn't have an EFI System Partition. Exiting."
"$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: $installerVolume doesn't have an EFI System Partition."
"$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: Target disk doesn't have an EFI System Partition."
exit 1
fi
fi
branches/blackosx/package/Scripts/Install/CheckGRUBLinuxLoader.sh
3636
3737
3838
39
39
4040
4141
4242
......
4545
4646
4747
48
49
4850
diskmicrocodetypeid=${diskmicrocodetype[${diskmicrocodetypecounter}]#*,}
if [ ! "${diskmicrocode}" = "${diskmicrocode/${diskmicrocodetypeid}/}" ]; then
echo "${diskmicrocodetype[${diskmicrocodetypecounter}]%,*} found."
"$scriptDir"InstallLog.sh "${targetVolume}" "FAIL: Found an exisitng GRUB/LILO bootloader."
"$scriptDir"InstallLog.sh "${targetVolume}" "FAIL: Found an exisitng GRUB/LILO bootloader in the MBR."
exit 1
else
echo "Didn't find a match for ${diskmicrocodetype[${diskmicrocodetypecounter}]%,*}"
echo "-----------------------------------------------"
echo ""
"$scriptDir"InstallLog.sh "${targetVolume}" "GRUB/LILO: PASS"
exit 0
branches/blackosx/package/Scripts/Install/CheckWindowsDiskSignature.sh
88
99
1010
11
12
1113
12
13
14
1415
16
17
1518
19
20
1621
1722
1823
......
2631
2732
2833
34
2935
3036
3137
3238
3339
40
3441
3542
3643
# if one is found then it exits with 1, otherwise it exits with 0
# Receives targetdisk: for example, /dev/disk0
# Receives targetVolume: Volume to install to.
# Receives scriptDir: The location of the main script dir.
if [ "$#" -eq 1 ]; then
if [ "$#" -eq 3 ]; then
targetDisk="$1"
targetVolume="$2"
scriptDir="$3"
echo "DEBUG: passed argument for targetDisk = $targetDisk"
echo "DEBUG: passed argument for targetVolume = $targetVolume"
echo "DEBUG: passed argument for scriptDir = $scriptDir"
else
echo "Error - wrong number of values passed - Exiting"
exit 9
echo "No Windows installation detected."
echo "-----------------------------------------------"
echo ""
"$scriptDir"InstallLog.sh "${targetVolume}" "Windows is not installed on this volume."
exit 0
else
echo "Detected an existing Windows installation"
echo "-----------------------------------------------"
echo ""
"$scriptDir"InstallLog.sh "${targetVolume}" "Detected a Windows installation on this volume."
exit 1
fi

Archive Download the corresponding diff file

Revision: 1553