Chameleon

Chameleon Commit Details

Date:2011-09-20 15:20:49 (12 years 7 months ago)
Author:blackosx
Commit:1545
Parents: 1544
Message:Added more output to the log file. Added check for boot0md. Cleaned up some annotations.
Changes:
M/branches/blackosx/package/Scripts/Install/CheckGRUBLinuxLoader.sh
M/branches/blackosx/package/Scripts/Install/CheckWindowsDiskSignature.sh
M/branches/blackosx/package/Scripts/Install/InstallLog.sh
M/branches/blackosx/package/Scripts/Install/WriteChameleonStage0.sh
M/branches/blackosx/package/Scripts/Install/WriteChameleonStage1.sh
M/branches/blackosx/package/Scripts/Install/WriteChameleonStage2.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
7171
7272
7373
74
74
7575
7676
7777
......
9898
9999
100100
101
101
102102
103103
104104
......
133133
134134
135135
136
136
137137
138138
139139
140
141
142
140
141
142
143
144
145
146
147
143148
144149
145150
146
151
147152
148153
149
154
150155
151156
152157
# 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}" "${targetVolume}" "${targetDeviceTemp}" "${scriptDir}"
"$scriptDir"CheckProceed.sh "${targetVolume}" "${targetDevice}" "${targetVolume}" "${scriptDir}"
returnValue=$?
if [ ${returnValue}=0 ]; then
# OK to proceed
# the following script returns 0 if we can proceed
# with writing the boot files, and 1 for not.
"$scriptDir"CheckDiskMicrocode.sh "${targetDisk}" "${diskSigCheck}"
"$scriptDir"CheckDiskMicrocode.sh "${targetDisk}" "${diskSigCheck}" "${targetVolume}" "${scriptDir}"
diskupdate=$?
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"
"$scriptDir"InstallLog.sh "${targetVolume}" "FAIL: Cannot install to a device using FAT16"
else
# Continue if the selected device is not a FAT16 format device
# If diskupdate is flagged as 0 then the stage 0 loader can be written to the MBR
if [ ${diskupdate} = 0 ]; then
"$scriptDir"WriteChameleonStage0.sh "${diskupdate}" "${diskSigCheck}" "${stage0Loader}" "${stage0LoaderDualBoot}" "${targetDisk}" "${targetVolume}" "${scriptDir}"
if [ ${diskupdate} = "0" ]; then
echo "Diskupdate = true, so the stage 0 loader can be written to the MBR"
# Write the stage 0 loader to the MBR
"$scriptDir"WriteChameleonStage0.sh "${diskSigCheck}" "${stage0Loader}" "${stage0LoaderDualBoot}" "${targetDisk}" "${targetVolume}" "${scriptDir}"
else
echo "Diskupdate = false, so didn't write the stage 0 loader to the MBR."
"$scriptDir"InstallLog.sh "${targetVolume}" "Stage 0 loader not written to ${targetDisk}."
fi
# Write the stage 1 loader to the partition boot sector
"$scriptDir"WriteChameleonStage1.sh "${espformat}" "${stage1LoaderHFS}" "${stage1LoaderFAT}" "${3}" "${targetDeviceRaw}" "${targetVolume}"
"$scriptDir"WriteChameleonStage1.sh "${espformat}" "${stage1LoaderHFS}" "${stage1LoaderFAT}" "${3}" "${targetDeviceRaw}" "${targetVolume}" "${scriptDir}"
# Write the stage 2 loader to the root of the selected partition
"$scriptDir"WriteChameleonStage2.sh "${espformat}" "${stage2Loader}" "${3}" "${targetDevice}" "${targetVolume}"
"$scriptDir"WriteChameleonStage2.sh "${espformat}" "${stage2Loader}" "${3}" "${targetDevice}" "${targetVolume}" "${scriptDir}"
# Set the active partition ONLY if Windows is not installed
"$scriptDir"SetActivePartition.sh "${espformat}" "${diskSigCheck}" "${targetDiskRaw}" "${targetSlice}" "${targetVolume}" "${scriptDir}"
branches/blackosx/package/Scripts/EFI/postinstall
3636
3737
3838
39
40
39
40
4141
4242
43
43
4444
4545
4646
......
5757
5858
5959
60
61
60
61
6262
6363
6464
......
7171
7272
7373
74
75
74
75
7676
7777
7878
7979
80
80
8181
82
82
8383
8484
8585
......
8888
8989
9090
91
91
9292
9393
9494
......
106106
107107
108108
109
109
110110
111111
112112
......
129129
130130
131131
132
132
133133
134134
135135
136136
137
138
137139
138
139
140
140
141
142
143
144
141145
142146
143147
144
148
145149
146150
147
151
148152
149153
150
151
154
152155
153156
154157
......
172175
173176
174177
175
178
176179
177180
178181
stage1LoaderFAT="boot1f32"
stage2Loader="boot"
targetVolumeTemp=$3
targetDeviceTemp=$( df "${targetVolumeTemp}" | sed -n '2p' | awk '{print $1}' )
targetVolumeChosenByUser=$3
targetDeviceChosenByUser=$( df "${targetVolumeChosenByUser}" | sed -n '2p' | awk '{print $1}' )
targetVolume="/Volumes/EFI"
targetDevice=${targetDeviceTemp%s*}s1
targetDevice=${targetDeviceChosenByUser%s*}s1
targetDeviceRaw=${targetDevice/disk/rdisk}
targetDisk=${targetDevice%s*}
targetDiskRaw=${targetDisk/disk/rdisk}
echo "DEBUG: stage1LoaderHFS: Partition loader is ${stage1LoaderHFS}"
echo "DEBUG: stage1LoaderFat: Partition loader is ${stage1LoaderFAT}"
echo "DEBUG: stage2Loader: Filesystem loader is ${stage2Loader}"
echo "DEBUG: targetVolumeTemp: Volume is ${targetVolumeTemp}"
echo "DEBUG: targetDeviceTemp: Volume device is ${targetDeviceTemp}"
echo "DEBUG: targetVolumeChosenByUser: Volume is ${targetVolumeChosenByUser}"
echo "DEBUG: targetDeviceChosenByUser: Volume device is ${targetDeviceChosenByUser}"
echo "DEBUG: targetVolume: Volume is ${targetVolume}"
echo "DEBUG: targetDevice: Volume device is ${targetDevice}"
echo "DEBUG: targetDeviceRaw: Volume raw device is ${targetDeviceRaw}"
# Check to see if the selected disk uses a GPT
bootuuid=$( diskutil info "$targetDeviceTemp" | grep Volume\ UUID | awk {'print $3'} )
partitiontable=$( diskutil list ${targetDeviceTemp%s*} | sed -n '3p' | awk '{print $2}' )
bootuuid=$( diskutil info "$targetDeviceChosenByUser" | grep Volume\ UUID | awk {'print $3'} )
partitiontable=$( diskutil list ${targetDeviceChosenByUser%s*} | sed -n '3p' | awk '{print $2}' )
if [ ${partitiontable} = "GUID_partition_scheme" ]; then
echo "Confirm this is a GPT partitioned disk."
# Double check we can see the selected partition and it's of the right type
# Double check we can see the selected partition, it's of the right type and /Volumes/EFI exists.
"$scriptDir"CheckProceed.sh "${targetVolumeTemp}" "${targetVolume}" "${targetDeviceTemp}" "${scriptDir}"
"$scriptDir"CheckProceed.sh "${targetVolume}" "${targetDeviceChosenByUser}" "${targetVolumeChosenByUser}" "${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}" "${targetVolumeTemp}" "${scriptDir}"
"$scriptDir"CheckGRUBLinuxLoader.sh "${targetDisk}" "${targetVolumeChosenByUser}" "${scriptDir}"
returnValue=$?
if [ ${returnValue} = 0 ]; then
# OK to proceed
# the following script returns 0 if we can proceed
# with writing the boot files, and 1 for not.
"$scriptDir"CheckDiskMicrocode.sh "${targetDisk}" "${diskSigCheck}"
"$scriptDir"CheckDiskMicrocode.sh "${targetDisk}" "${diskSigCheck}" "${targetVolumeChosenByUser}" "${scriptDir}"
diskupdate=$?
# 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 "${targetVolumeTemp}" "${scriptDir}"
"$scriptDir"UnMountEFIvolumes.sh "${targetVolumeChosenByUser}" "${scriptDir}"
returnValue=$?
if [ ${returnValue} = 0 ]; then
# OK to proceed
if [ ${diskupdate} = "0" ]; then
echo "Diskupdate = true, so the stage 0 loader can be written to the MBR"
# If diskupdate is flagged as 0 then the stage 0 loader can be written to the MBR
if [ ${diskupdate} = 0 ]; then
"$scriptDir"WriteChameleonStage0.sh "${diskupdate}" "${diskSigCheck}" "${stage0Loader}" "${stage0LoaderDualBoot}" "${targetDisk}" "${targetVolumeTemp}" "${scriptDir}"
# Write the stage 0 loader to the MBR
"$scriptDir"WriteChameleonStage0.sh "${diskSigCheck}" "${stage0Loader}" "${stage0LoaderDualBoot}" "${targetDisk}" "${targetVolumeChosenByUser}" "${scriptDir}"
else
echo "Diskupdate = false, so didn't write the stage 0 loader to the MBR."
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Stage 0 loader not written to ${targetDisk}."
fi
# Write the stage 1 loader to the partition boot sector
"$scriptDir"WriteChameleonStage1.sh "${espformat}" "${stage1LoaderHFS}" "${stage1LoaderFAT}" "${targetVolumeTemp}" "${targetDeviceRaw}" "${targetVolume}"
"$scriptDir"WriteChameleonStage1.sh "${espformat}" "${stage1LoaderHFS}" "${stage1LoaderFAT}" "${targetVolumeChosenByUser}" "${targetDeviceRaw}" "${targetVolume}" "${scriptDir}"
# Write the stage 2 loader to the root of the selected partition
"$scriptDir"WriteChameleonStage2.sh "${espformat}" "${stage2Loader}" "${targetVolumeTemp}" "${targetDevice}" "${targetVolume}"
"$scriptDir"WriteChameleonStage2.sh "${espformat}" "${stage2Loader}" "${targetVolumeChosenByUser}" "${targetDevice}" "${targetVolume}" "${scriptDir}"
# Set the active partition ONLY if Windows is not installed
"$scriptDir"SetActivePartition.sh "${espformat}" "${diskSigCheck}" "${targetDiskRaw}" "${targetSlice}" "${targetVolumeTemp}" "${scriptDir}"
"$scriptDir"SetActivePartition.sh "${espformat}" "${diskSigCheck}" "${targetDiskRaw}" "${targetSlice}" "${targetVolumeChosenByUser}" "${scriptDir}"
fi
fi
fi
# Create temporary file on target volume to notify
# boot option scripts than EFI (ESP) option was chosen
echo "EFI" >"${targetVolumeTemp}"/.ChameleonEFI
echo "EFI" >"${targetVolumeChosenByUser}"/.ChameleonEFI
echo "==============================================="
echo "END - Main EFI System Partition Post-Install Script"
branches/blackosx/package/Scripts/Install/InstallLog.sh
44
55
66
7
7
88
99
1010
......
1616
1717
1818
19
20
19
20
2121
2222
2323
2424
2525
26
27
2628
27
28
29
30
29
30
3131
32
32
3333
3434
3535
echo "InstallLog: Create/Append installation log"
echo "**********************************************"
# Creates text file named 'Chameleon_Installer_Fail_Log.txt'
# Creates text file named 'Chameleon_Installer_Log.txt'
# at the root of the target volume. This is to help show the
# user why the installation process failed (even though the
# package installer ends reading 'Installation Successful'.
if [ "$#" -eq 2 ]; then
logLocation="$1"
verboseText="$2"
#echo "DEBUG: passed argument = $logLocation"
#echo "DEBUG: passed argument = $verboseText"
echo "DEBUG: passed argument = $logLocation"
echo "DEBUG: passed argument = $verboseText"
else
echo "Error - wrong number of values passed"
exit 9
fi
logName="Chameleon_Installer_Log.txt"
logFile="${logLocation}"/$logName
logfile="${logLocation}"/Chameleon_Installer_Fail_Log.txt
if [ -f "${logfile}" ]; then
echo "${verboseText}" >> "${logLocation}"/Chameleon_Installer_Fail_Log.txt
if [ -f "${logFile}" ]; then
echo "${verboseText}" >> "${logFile}"
else
echo "${verboseText}" > "${logLocation}"/Chameleon_Installer_Fail_Log.txt
echo "${verboseText}" > "${logFile}"
fi
exit 0
branches/blackosx/package/Scripts/Install/WriteChameleonStage0.sh
44
55
66
7
7
88
9
10
11
12
13
14
15
16
17
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
1824
1925
2026
......
2632
2733
2834
29
30
31
32
33
35
36
37
3438
35
36
37
38
39
40
41
42
43
3944
40
41
42
45
46
47
4348
4449
50
4551
4652
4753
echo "Write Chameleon Stage 0 Loader:"
echo "*******************************"
# Writes Chameleon stage 0 loader.
if [ "$#" -eq 7 ]; then
diskupdate="$1"
disksignature="$2"
stage0Loader="$3"
stage0Loaderdualboot="$4"
targetDisk="$5"
targetVolume="$6"
scriptDir="$7"
echo "DEBUG: passed argument for diskupdate = $diskupdate"
# Receives disksignature: 0 = Windows not found, 1 = Windows Found
# Receives stage0Loader: Name of file - boot0
# Receives stage0Loaderdualboot: Name of file - boot0hfs
# Receives targetDisk: for example, /dev/disk3
# Receives targetVolume: for example, /Volumes/USB
# Receives scriptDir: The location of the main script dir.
if [ "$#" -eq 6 ]; then
disksignature="$1"
stage0Loader="$2"
stage0Loaderdualboot="$3"
targetDisk="$4"
targetVolume="$5"
scriptDir="$6"
echo "DEBUG: passed argument for disksignature = $disksignature"
echo "DEBUG: passed argument for stage0Loader = $stage0Loader"
echo "DEBUG: passed argument for stage0Loaderdualboot = $stage0Loaderdualboot"
exit 9
fi
if [ ${diskupdate} = "0" ]; then
echo "Diskupdate = true, so yes"
if [ ${disksignature} = "0" ]; then
if [ ${disksignature} = "0" ]; then
echo "Executing command: fdisk440 -u -f /usr/standalone/i386/${stage0Loader} -y ${targetDisk}"
"${scriptDir}"/Tools/fdisk440 -u -f "${targetVolume}"/usr/standalone/i386/${stage0Loader} -y ${targetDisk}
else
# Windows is also installed on the HDD and we need to write boot0hfs
echo "Executing command: fdisk440 -u -f /usr/standalone/i386/${stage0Loader} -y ${targetDisk}"
"${scriptDir}"/Tools/fdisk440 -u -f "${targetVolume}"/usr/standalone/i386/${stage0Loader} -y ${targetDisk}
"$scriptDir"InstallLog.sh "${targetVolume}" "Written boot0 to ${targetDisk}."
else
# Windows is also installed on the HDD so we need to write boot0hfs
echo "Executing command: /fdisk440 -u -f /usr/standalone/i386/${stage0Loaderdualboot} -y ${targetDisk}"
"${scriptDir}"/Tools/fdisk440 -u -f "${targetVolume}"/usr/standalone/i386/${stage0Loaderdualboot} -y ${targetDisk}
fi
echo "Executing command: /fdisk440 -u -f /usr/standalone/i386/${stage0Loaderdualboot} -y ${targetDisk}"
"${scriptDir}"/Tools/fdisk440 -u -f "${targetVolume}"/usr/standalone/i386/${stage0Loaderdualboot} -y ${targetDisk}
"$scriptDir"InstallLog.sh "${targetVolume}" "Written boot0hfs to ${targetDisk}."
fi
echo "-----------------------------------------------"
echo ""
echo ""
branches/blackosx/package/Scripts/Install/WriteChameleonStage1.sh
44
55
66
7
7
88
9
9
10
11
12
13
14
15
16
17
1018
1119
1220
1321
1422
1523
24
1625
1726
1827
1928
2029
2130
31
2232
2333
2434
......
2939
3040
3141
42
43
3244
3345
3446
......
4557
4658
4759
60
61
4862
4963
5064
echo "Write Chameleon Stage 1 Loader:"
echo "*******************************"
# espformat code is 1 for HFS, 2 for MSDOS, 0 for unknown
# Writes Chameleon stage 1 loader.
if [ "$#" -eq 6 ]; then
# Receives espformat: 1 for HFS, 2 for MSDOS, 0 for unknown
# Receives stage1LoaderHFS: Name of file - boot1h
# Receives stage1LoaderFAT: Name of file - boot1f32
# Receives selectedDestination: for example, /Volumes/USB
# Receives targetDeviceRaw: for example, /dev/disk3s1
# Receives targetVolume: for example, /Volumes/USB
# Receives scriptDir: The location of the main script dir.
if [ "$#" -eq 7 ]; then
espformat="$1"
stage1LoaderHFS="$2"
stage1LoaderFAT="$3"
selectedDestination="$4"
targetDeviceRaw="$5"
targetVolume="$6"
scriptDir="$7"
echo "DEBUG: passed argument for espformat = $espformat"
echo "DEBUG: passed argument for stage1LoaderHFS = $stage1LoaderHFS"
echo "DEBUG: passed argument for stage1LoaderFAT = $stage1LoaderFAT"
echo "DEBUG: passed argument for selectedDestination = $selectedDestination"
echo "DEBUG: passed argument for targetDeviceRaw = $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 "Executing command: dd if=${selectedDestination}/usr/standalone/i386/${stage1LoaderHFS} of=${targetDeviceRaw}"
dd if="${selectedDestination}"/usr/standalone/i386/${stage1LoaderHFS} of=${targetDeviceRaw}
"$scriptDir"InstallLog.sh "${targetVolume}" "Written ${stage1LoaderHFS} to ${targetDeviceRaw}."
fi
if [ ${espformat} = "2" ]; then
echo "Executing command: dd of=${targetDeviceRaw} count=1 bs=512 if=/tmp/newbs"
dd if=/tmp/newbs of="${targetDeviceRaw}" count=1 bs=512
"$scriptDir"InstallLog.sh "${targetVolume}" "Written ${stage1LoaderFAT} to ${targetDeviceRaw}."
fi
echo "-----------------------------------------------"
branches/blackosx/package/Scripts/Install/WriteChameleonStage2.sh
44
55
66
7
8
9
7
108
9
10
11
12
13
14
1115
12
16
17
1318
1419
1520
1621
1722
23
1824
1925
2026
2127
2228
29
2330
2431
2532
......
2936
3037
3138
32
3339
3440
3541
......
6167
6268
6369
70
6471
6572
6673
echo "Write Chameleon Stage 2 Loader:"
echo "*******************************"
# for example:
# espformat code is 1 for HFS, 2 for MSDOS, 0 for unknown
# Writes Chameleon stage 2 loader.
# Receives espformat: 1 for HFS, 2 for MSDOS, 0 for unknown
# Receives stage2Loader: Name of file - boot
# Receives selectedDestination: for example, /Volumes/USB
# Receives targetDevice: for example, /dev/disk3s1
# Receives targetVolume: for example, /Volumes/USB
# Receives scriptDir: The location of the main script dir.
if [ "$#" -eq 5 ]; then
if [ "$#" -eq 6 ]; then
espformat="$1"
stage2Loader="$2"
selectedDestination="$3"
targetDevice="$4"
targetVolume="$5"
scriptDir="$6"
echo "DEBUG: passed argument for espformat = $espformat"
echo "DEBUG: passed argument for stage2Loader = $stage2Loader"
echo "DEBUG: passed argument for selectedDestination = $selectedDestination"
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
# if chosen, the package installer will add a file named 'nullESP'
# in to the temporary directory /.Chameleon
#if [ -f "${selectedDestination}"/.Chameleon/nullESP ]; then
if [ "${targetVolume}" = "/Volumes/EFI" ]; then
echo "DEBUG: EFI install chosen"
cp "${targetVolume}"/usr/standalone/i386/"${stage2Loader}" "${targetVolume}"
fi
"$scriptDir"InstallLog.sh "${targetVolume}" "Written boot to ${targetVolume}."
branches/blackosx/package/Scripts/Install/CheckDiskMicrocode.sh
44
55
66
7
8
9
7
108
119
1210
13
1411
1512
1613
17
14
15
16
17
18
19
20
1821
1922
23
24
2025
2126
27
28
2229
2330
2431
......
4754
4855
4956
50
57
5158
5259
5360
54
61
5562
5663
5764
5865
5966
6067
68
6169
6270
6371
......
6775
6876
6977
78
7079
7180
7281
73
82
83
84
85
86
87
88
7489
7590
7691
7792
7893
94
7995
8096
8197
echo "CheckDiskMicrocode: Any existing bootloaders?"
echo "*********************************************"
# This script is passed the targetDisk and diskSigCheck.
#
# it then reads the GPTdiskProtectiveMBR and searches for an existing
# Reads the GPTdiskProtectiveMBR and searches for an existing
# Windows bootloader and also for an existing Chameleon stage 0 loader
# which might be better changed depending on whether or not a Windows
# signature is found or not.
#
# The script then exits with the value 0 to indicate that Chameleon stage0
# loader can be written, or 1 to indicate not to write the stage0 loader.
if [ "$#" -eq 2 ]; then
# Receives targetDisk: for example, /dev/disk2.
# Receives diskSigCheck: 0 = Windows not installed / 1 = Windows installed.
# Receives targetVolume: Volume to install to.
# Receives scriptDir: The location of the main script dir.
if [ "$#" -eq 4 ]; then
targetDisk="$1"
diskSigCheck="$2"
targetVolume="$3"
scriptDir="$4"
echo "DEBUG: passed argument for targetDisk = $targetDisk"
echo "DEBUG: passed argument for diskSigCheck = $diskSigCheck"
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
# See if a Chameleon stage0 boot file already exists
# Note: The checks for Boot0 and Boot0hfs assume the code stays the same.
# if the code changes then the hex values 0b807c and 0a803c used for matching
# if the code changes then the hex values 0b807c, 0a803c and ee7505 used for matching
# need to be checked to see if they are the same or not.
stage0type=$( dd 2>/dev/null if="$targetDisk" count=3 bs=1 skip=105 | xxd | awk '{print $2$3}' )
echo ${stage0type}
#echo ${stage0type}
if [ "${stage0type}" == "0b807c" ]; then
echo "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"
exit 0
fi
fi
# 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"
exit 0
fi
fi
if [ "${stage0type}" != "0b807c" ] && [ "${stage0type}" != "0a803c" ] && [ "${windowsloader}" != "33c08ed0" ] ; then
if [ "${stage0type}" == "ee7505" ]; then
echo "Found existing Chameleon stage 0 loader - Boot0md"
echo "And will leave boot0md installed."
exit 1
fi
if [ "${stage0type}" != "0b807c" ] && [ "${stage0type}" != "0a803c" ] && [ "${stage0type}" != "ee7505" ] && [ "${windowsloader}" != "33c08ed0" ] ; then
echo "Something other than Chameleon or a Windows bootloader was found"
test=$(echo "${mbr437}" | awk -F0 '{print NF-1}' )
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"
echo ""
exit 1
fi
branches/blackosx/package/Scripts/Install/CheckProceed.sh
44
55
66
7
8
7
98
10
11
12
9
10
11
1312
1413
1514
16
17
18
15
16
17
1918
20
2119
2220
21
2322
2423
2524
......
2827
2928
3029
31
30
3231
3332
3433
......
3635
3736
3837
39
38
4039
4140
4241
......
4645
4746
4847
49
48
5049
5150
52
51
5352
5453
5554
echo "Check Proceed: Can the script continue?"
echo "***************************************"
# Checks the selected volume is present and the disk
# is partitioned.
# Checks the selected volume is present and the disk is partitioned.
# 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 targetVolume: Volume to install to (Will be '/Volumes/EFI' if EFI install)
# Receives targetDevice: Stores device number, for example /dev/disk2s1.
# Receives installerVolume: Volume to write the installer log to.
# Receives scriptDir: The location of the main script dir.
if [ "$#" -eq 4 ]; then
targetVolumeTemp="$1"
targetVolume="$2"
targetDevice="$3"
targetVolume="$1"
targetDevice="$2"
installerVolume="$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 installerVolume = $installerVolume"
echo "DEBUG: passed argument for scriptDir = $scriptDir"
else
echo "Error - wrong number of values passed"
if [ -z "$targetVolume" ]; then
echo "*** Cannot find the volume. Exiting."
"$scriptDir"InstallLog.sh "${targetVolumeTemp}" "Cannot file the volume."
"$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: Cannot file the volume: $targetVolume."
exit 1
else
echo "Confirming target volume exists"
if [ "$targetDevice" = "$targetDevice#*disk*s" ]; then
echo "*** ERROR Volume does not use slices. Exiting."
"$scriptDir"InstallLog.sh "${targetVolumeTemp}" "The selected volume doesn't use slices."
"$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: $targetVolume doesn't use slices."
exit 1
else
echo "Confirming target device uses slices"
# 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'} )
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 "${targetVolumeTemp}" "The selected volume doesn't have an EFI System Partition."
"$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: $installerVolume doesn't have an EFI System Partition."
exit 1
fi
fi
branches/blackosx/package/Scripts/Install/CheckGRUBLinuxLoader.sh
88
99
1010
11
12
11
12
1313
1414
1515
1616
17
17
1818
1919
20
20
2121
2222
2323
......
2727
2828
2929
30
3130
3231
3332
33
3434
3535
3636
3737
3838
39
39
4040
4141
4242
# signature for either the GRUB or Linux bootloaders.
# The script returns 1 if either is found, or 0 if none found.
# Receives targetdisk: Stores device number: for example /dev/disk2
# Receives targetVolumeTemp: Stores original target if EFI install selected.
# Receives targetdisk: for example, /dev/disk2.
# Receives targetVolume: Volume to install to.
# Receives scriptDir: The location of the main script dir.
if [ "$#" -eq 3 ]; then
targetDisk="$1"
targetVolumeTemp="$2"
targetVolume="$2"
scriptDir="$3"
echo "DEBUG: passed argument for targetDisk = $targetDisk"
echo "DEBUG: passed argument for targetVolumeTemp = $targetVolumeTemp"
echo "DEBUG: passed argument for targetVolume = $targetVolume"
echo "DEBUG: passed argument for scriptDir = $scriptDir"
else
echo "Error - wrong number of values passed"
diskmicrocodetype[1]="GRUB,47525542"
diskmicrocodetype[2]="LILO,4c494c4f"
diskmicrocode=$( dd 2>/dev/null if="$targetDisk" count=1 | dd 2>/dev/null count=1 bs=437 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )
#echo "${diskmicrocode}"
diskmicrocodetypecounter=0
while [ ${diskmicrocodetypecounter} -lt ${#diskmicrocodetype[@]} ]; do
diskmicrocodetypecounter=$(( ${diskmicrocodetypecounter} + 1 ))
diskmicrocodetypeid=${diskmicrocodetype[${diskmicrocodetypecounter}]#*,}
if [ ! "${diskmicrocode}" = "${diskmicrocode/${diskmicrocodetypeid}/}" ]; then
echo "${diskmicrocodetype[${diskmicrocodetypecounter}]%,*} found."
"$scriptDir"InstallLog.sh "${targetVolumeTemp}" "Found an exisitng GRUB/LILO bootloader."
"$scriptDir"InstallLog.sh "${targetVolume}" "FAIL: Found an exisitng GRUB/LILO bootloader."
exit 1
else
echo "Didn't find a match for ${diskmicrocodetype[${diskmicrocodetypecounter}]%,*}"
branches/blackosx/package/Scripts/Install/CheckWindowsDiskSignature.sh
44
55
66
7
8
7
98
109
10
11
12
1113
1214
1315
......
1820
1921
2022
21
23
2224
2325
2426
echo "CheckWindowsDiskSignature: Is Windows installed?"
echo "************************************************"
# this script is passed the targetdisk to work from, for example /dev/disk0
# It then checks the disk sector for a 4-byte Windows disk signature
# Checks the disk sector for a 4-byte Windows disk signature
# if one is found then it exits with 1, otherwise it exits with 0
# Receives targetdisk: for example, /dev/disk0
if [ "$#" -eq 1 ]; then
targetDisk="$1"
echo "DEBUG: passed argument for targetDisk = $targetDisk"
disksignature=$( dd 2>/dev/null if="$targetDisk" count=1 | dd 2>/dev/null count=4 bs=1 skip=440 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )
echo "${disksignature}"
#echo "${disksignature}"
if [ "${disksignature}" = "00000000" ]; then
echo "No Windows installation detected."

Archive Download the corresponding diff file

Revision: 1545