Chameleon Applications

Chameleon Applications Commit Details

Date:2010-12-04 00:59:57 (13 years 4 months ago)
Author:blackosx
Commit:255
Parents: 254
Message:Various tweaks and changes
Changes:
D/branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/CheckDiskSignature.sh
D/branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/CheckDiskMicrocodeType.sh
A/branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/CheckWindowsDiskSignature.sh
A/branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/CheckGRUBLinuxLoader.sh
M/branches/blackosx/trunk/PackageBuilder/Build/Chameleon Installer v2.1.3b.pkg
M/branches/blackosx/trunk/PackageBuilder/Chameleon_Installer.pmdoc/10fdisk-contents.xml
M/branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/CheckFatType.sh
M/branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/WriteChameleonStage0.sh
M/branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/WriteChameleonStage1.sh
M/branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/WriteChameleonStage2.sh
M/branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/CheckDiskMicrocode.sh
M/branches/blackosx/trunk/PackageBuilder/Chameleon_Installer.pmdoc/04bdmesg-contents.xml
M/branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/CheckProceed.sh
M/branches/blackosx/trunk/PackageBuilder/Chameleon_Installer.pmdoc/05boot-contents.xml
M/branches/blackosx/trunk/PackageBuilder/Chameleon_Installer.pmdoc/06boot-contents.xml
M/branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/SetActivePartition.sh
M/branches/blackosx/trunk/PackageBuilder/Chameleon_Installer.pmdoc/07boot-contents.xml
M/branches/blackosx/trunk/PackageBuilder/Chameleon_Installer.pmdoc/08boot-contents.xml
M/branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/postflight.sh
M/branches/blackosx/trunk/PackageBuilder/Chameleon_Installer.pmdoc/09boot-contents.xml
M/branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/CheckFormat.sh
M/branches/blackosx/trunk/PackageBuilder/Chameleon_Installer.pmdoc/01fakesmc.xml
M/branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/MainESPPostinstall.sh
M/branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/CheckPartitionScheme.sh
M/branches/blackosx/trunk/PackageBuilder/Chameleon_Installer.pmdoc/03embed.xml
M/branches/blackosx/trunk/PackageBuilder/Chameleon_Installer.pmdoc/11postflight-contents.xml
M/branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/BuildBootOptions.sh
M/branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/MainStandardPostinstall.sh

File differences

branches/blackosx/trunk/PackageBuilder/Chameleon_Installer.pmdoc/11postflight-contents.xml
1
1
<pkg-contents spec="1.12"><f n="postflight.sh" o="blackosx" g="staff" p="33261" pt="/Users/blackosx/Documents/Chameleon_SVN/PackageBuilder_Blackosx/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/postflight.sh" m="false" t="file"/></pkg-contents>
<pkg-contents spec="1.12"><f n="postflight.sh" o="blackosx" g="staff" p="33252" pt="/Users/blackosx/Documents/Chameleon_SVN/PackageBuilder_Blackosx/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/postflight.sh" m="true" t="file"><mod>mode</mod></f></pkg-contents>
branches/blackosx/trunk/PackageBuilder/Chameleon_Installer.pmdoc/10fdisk-contents.xml
1
1
<pkg-contents spec="1.12"><f n="fdisk440" o="blackosx" g="staff" p="33261" pt="/Users/blackosx/Documents/Chameleon_SVN/PackageBuilder_Blackosx/blackosx/trunk/PackageBuilder/Main_Package_Elements/i386/fdisk440" m="false" t="file"/></pkg-contents>
<pkg-contents spec="1.12"><f n="fdisk440" o="root" g="admin" p="33252" pt="/Users/blackosx/Documents/Chameleon_SVN/PackageBuilder_Blackosx/blackosx/trunk/PackageBuilder/Main_Package_Elements/i386/fdisk440" m="true" t="file"><mod>group</mod><mod>mode</mod><mod>owner</mod></f></pkg-contents>
branches/blackosx/trunk/PackageBuilder/Chameleon_Installer.pmdoc/05boot-contents.xml
1
1
<pkg-contents spec="1.12"><f n="boot" o="blackosx" g="staff" p="33261" pt="/Users/blackosx/Documents/Chameleon_SVN/PackageBuilder_Blackosx/blackosx/trunk/PackageBuilder/Main_Package_Elements/i386/boot" m="false" t="file"/></pkg-contents>
<pkg-contents spec="1.12"><f n="boot" o="root" g="admin" p="33188" pt="/Users/blackosx/Documents/Chameleon_SVN/PackageBuilder_Blackosx/blackosx/trunk/PackageBuilder/Main_Package_Elements/i386/boot" m="true" t="file"><mod>group</mod><mod>mode</mod><mod>owner</mod></f></pkg-contents>
branches/blackosx/trunk/PackageBuilder/Chameleon_Installer.pmdoc/09boot-contents.xml
1
1
<pkg-contents spec="1.12"><f n="boot1h" o="blackosx" g="staff" p="33188" pt="/Users/blackosx/Documents/Chameleon_SVN/PackageBuilder_Blackosx/blackosx/trunk/PackageBuilder/Main_Package_Elements/i386/boot1h" m="false" t="file"/></pkg-contents>
<pkg-contents spec="1.12"><f n="boot1h" o="root" g="admin" p="33188" pt="/Users/blackosx/Documents/Chameleon_SVN/PackageBuilder_Blackosx/blackosx/trunk/PackageBuilder/Main_Package_Elements/i386/boot1h" m="false" t="file"><mod>group</mod><mod>owner</mod></f></pkg-contents>
branches/blackosx/trunk/PackageBuilder/Chameleon_Installer.pmdoc/03embed.xml
1
1
<pkgref spec="1.12" uuid="43B649F9-205E-4C18-88B5-D8E419E8B617"><config><identifier>voodooprojects.org.chameleon.Embed.pkg</identifier><version>1.0</version><description></description><post-install type="none"/><requireAuthorization/><installFrom relative="true" mod="true">Main_Package_Elements/themes/Embed</installFrom><installTo mod="true" relocatable="true">/.Chameleon/Extra/Themes/</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"></packageStore><mod>installTo.path</mod><mod>installTo</mod><mod>postInstall</mod><mod>relocatable</mod><mod>requireAuthorization</mod><mod>parent</mod><mod>version</mod><mod>extraFiles</mod><mod>identifier</mod><mod>installFrom.isRelativeType</mod></config><contents><file-list>03embed-contents.xml</file-list><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents><extra-files/></pkgref>
<pkgref spec="1.12" uuid="43B649F9-205E-4C18-88B5-D8E419E8B617"><config><identifier>voodooprojects.org.chameleon.Embed.pkg</identifier><version>1.0</version><description></description><post-install type="none"/><requireAuthorization/><installFrom relative="true" mod="true">Main_Package_Elements/themes/Embed</installFrom><installTo mod="true" relocatable="true">/.Chameleon/Extra/Themes/</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"></packageStore><mod>version</mod><mod>installTo</mod><mod>postInstall</mod><mod>relocatable</mod><mod>requireAuthorization</mod><mod>parent</mod><mod>identifier</mod><mod>installTo.path</mod><mod>extraFiles</mod><mod>installFrom.isRelativeType</mod></config><contents><file-list>03embed-contents.xml</file-list><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents><extra-files/></pkgref>
branches/blackosx/trunk/PackageBuilder/Chameleon_Installer.pmdoc/06boot-contents.xml
1
1
<pkg-contents spec="1.12"><f n="boot0" o="blackosx" g="staff" p="33188" pt="/Users/blackosx/Documents/Chameleon_SVN/PackageBuilder_Blackosx/blackosx/trunk/PackageBuilder/Main_Package_Elements/i386/boot0" m="false" t="file"/></pkg-contents>
<pkg-contents spec="1.12"><f n="boot0" o="root" g="admin" p="33188" pt="/Users/blackosx/Documents/Chameleon_SVN/PackageBuilder_Blackosx/blackosx/trunk/PackageBuilder/Main_Package_Elements/i386/boot0" m="false" t="file"><mod>group</mod><mod>owner</mod></f></pkg-contents>
branches/blackosx/trunk/PackageBuilder/Chameleon_Installer.pmdoc/04bdmesg-contents.xml
1
1
<pkg-contents spec="1.12"><f n="bdmesg" o="blackosx" g="staff" p="33261" pt="/Users/blackosx/Documents/Chameleon_SVN/PackageBuilder_Blackosx/blackosx/trunk/PackageBuilder/Main_Package_Elements/i386/bdmesg" m="false" t="file"/></pkg-contents>
<pkg-contents spec="1.12"><f n="bdmesg" o="root" g="admin" p="33252" pt="/Users/blackosx/Documents/Chameleon_SVN/PackageBuilder_Blackosx/blackosx/trunk/PackageBuilder/Main_Package_Elements/i386/bdmesg" m="true" t="file"><mod>group</mod><mod>mode</mod><mod>owner</mod></f></pkg-contents>
branches/blackosx/trunk/PackageBuilder/Chameleon_Installer.pmdoc/07boot-contents.xml
1
1
<pkg-contents spec="1.12"><f n="boot0hfs" o="blackosx" g="staff" p="33188" pt="/Users/blackosx/Documents/Chameleon_SVN/PackageBuilder_Blackosx/blackosx/trunk/PackageBuilder/Main_Package_Elements/i386/boot0hfs" m="false" t="file"/></pkg-contents>
<pkg-contents spec="1.12"><f n="boot0hfs" o="root" g="admin" p="33188" pt="/Users/blackosx/Documents/Chameleon_SVN/PackageBuilder_Blackosx/blackosx/trunk/PackageBuilder/Main_Package_Elements/i386/boot0hfs" m="false" t="file"><mod>group</mod><mod>owner</mod></f></pkg-contents>
branches/blackosx/trunk/PackageBuilder/Chameleon_Installer.pmdoc/01fakesmc.xml
1
1
<pkgref spec="1.12" uuid="930CBEAD-F970-431E-AF91-65B0276E3199"><config><identifier>voodooprojects.org.chameleon.FakeSMC.pkg</identifier><version>1.0</version><description></description><post-install type="none"/><requireAuthorization/><installFrom relative="true" mod="true" includeRoot="true">Main_Package_Elements/Kexts/FakeSMC.kext</installFrom><installTo mod="true" relocatable="true">/.Chameleon/Extra/Extensions/</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"></packageStore><mod>installTo.path</mod><mod>installTo</mod><mod>postInstall</mod><mod>relocatable</mod><mod>requireAuthorization</mod><mod>identifier</mod><mod>parent</mod><mod>extraFiles</mod><mod>version</mod><mod>installFrom.isRelativeType</mod></config><contents><file-list>01fakesmc-contents.xml</file-list><component id="org.netkas.FakeSMC" path="/Users/blackosx/Documents/Chameleon_SVN/PackageBuilder_Blackosx/blackosx/trunk/PackageBuilder/Main_Package_Elements/Kexts/FakeSMC.kext" version="1.0.0d1"/><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents><extra-files/></pkgref>
<pkgref spec="1.12" uuid="930CBEAD-F970-431E-AF91-65B0276E3199"><config><identifier>voodooprojects.org.chameleon.FakeSMC.pkg</identifier><version>1.0</version><description></description><post-install type="none"/><requireAuthorization/><installFrom relative="true" mod="true" includeRoot="true">Main_Package_Elements/Kexts/FakeSMC.kext</installFrom><installTo mod="true" relocatable="true">/.Chameleon/Extra/Extensions/</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"></packageStore><mod>parent</mod><mod>installTo</mod><mod>postInstall</mod><mod>relocatable</mod><mod>requireAuthorization</mod><mod>identifier</mod><mod>version</mod><mod>installTo.path</mod><mod>extraFiles</mod><mod>installFrom.isRelativeType</mod></config><contents><file-list>01fakesmc-contents.xml</file-list><component id="org.netkas.FakeSMC" path="/Users/blackosx/Documents/Chameleon_SVN/PackageBuilder_Blackosx/blackosx/trunk/PackageBuilder/Main_Package_Elements/Kexts/FakeSMC.kext" version="1.0.0d1"/><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents><extra-files/></pkgref>
branches/blackosx/trunk/PackageBuilder/Chameleon_Installer.pmdoc/08boot-contents.xml
1
1
<pkg-contents spec="1.12"><f n="boot1f32" o="blackosx" g="staff" p="33188" pt="/Users/blackosx/Documents/Chameleon_SVN/PackageBuilder_Blackosx/blackosx/trunk/PackageBuilder/Main_Package_Elements/i386/boot1f32" m="false" t="file"/></pkg-contents>
<pkg-contents spec="1.12"><f n="boot1f32" o="root" g="admin" p="33188" pt="/Users/blackosx/Documents/Chameleon_SVN/PackageBuilder_Blackosx/blackosx/trunk/PackageBuilder/Main_Package_Elements/i386/boot1f32" m="false" t="file"><mod>group</mod><mod>owner</mod></f></pkg-contents>
branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/CheckDiskSignature.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
echo "==============================================="
echo "Checkdisksignature:"
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
# if one is found then it exits with 1, otherwise it exits with 0
if [ "$#" -eq 1 ]; then
targetDisk="$1"
echo "DEBUG: passed argument for targetDisk = $targetDisk"
else
echo "Error - wrong number of values passed - Exiting"
exit 9
fi
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}"
if [ "${disksignature}" = "00000000" ]; then
echo "No Windows installation detected."
echo "-----------------------------------------------"
echo ""
exit 0
else
echo "Detected an existing Windows installation"
echo "-----------------------------------------------"
echo ""
exit 1
fi
echo "-----------------------------------------------"
echo ""
exit 0
branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/CheckDiskMicrocodeType.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
echo "==============================================="
echo "Diskmicrocodetype:"
echo "******************"
# This script is passed the targetdisk
# it then 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
targetDisk="$1"
echo "DEBUG: passed argument for targetDisk = $targetDisk"
else
echo "Error - wrong number of values passed"
exit 9
fi
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."
exit 1
else
echo "Didn't find a match for ${diskmicrocodetype[${diskmicrocodetypecounter}]%,*}"
fi
done
echo "-----------------------------------------------"
echo ""
exit 0
branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/CheckFatType.sh
11
22
33
4
5
4
5
66
77
88
......
1717
1818
1919
20
21
22
2023
2124
2225
#!/bin/bash
echo "==============================================="
echo "Check the FAT type"
echo "******************"
echo "CheckFatType: Do we have FAT16 or FAT32?"
echo "****************************************"
# Receives passed value for the raw Target Device
# for example: /dev/rdisk0s2
if [ "$#" -eq 1 ]; then
targetDeviceRaw="$1"
echo "DEBUG: passed argument = $targetDeviceRaw"
else
echo "Error - wrong number of values passed"
exit 9
fi
branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/WriteChameleonStage0.sh
1919
2020
2121
22
23
24
2225
2326
24
27
2528
2629
2730
2831
2932
3033
31
34
3235
3336
3437
3538
36
39
3740
3841
3942
echo "DEBUG: passed argument for stage0Loaderdualboot = $stage0Loaderdualboot"
echo "DEBUG: passed argument for targetDisk = $targetDisk"
echo "DEBUG: passed argument for targetVolume = $targetVolume"
else
echo "Error - wrong number of values passed"
exit 9
fi
if [ ${diskupdate} = "1" ]; then
if [ ${diskupdate} = "0" ]; then
echo "Diskupdate = true, so yes"
if [ ${disksignature} = "0" ]; then
echo "Executing command: ${targetVolume}/.Chameleon/i386/fdisk440 -u -f ${targetVolume}/.Chameleon/i386/$stage0Loader -y ${targetDisk}"
${targetVolume}/.Chameleon/i386/fdisk440 -u -f ${targetVolume}/.Chameleon/i386/${stage0Loader} -y ${targetDisk}
"${targetVolume}"/.Chameleon/i386/fdisk440 -u -f "${targetVolume}"/.Chameleon/i386/${stage0Loader} -y ${targetDisk}
else
# Windows is also installed on the HDD and we need to write boot0hfs
echo "Executing command: ${targetVolume}/.Chameleon/i386/fdisk440 -u -f ${targetVolume}/.Chameleon/i386/${stage0Loaderdualboot} -y ${targetDisk}"
${targetVolume}/.Chameleon/i386/fdisk440 -u -f ${targetVolume}/.Chameleon/i386/${stage0Loaderdualboot} -y ${targetDisk}
"${targetVolume}"/.Chameleon/i386/fdisk440 -u -f "${targetVolume}"/.Chameleon/i386/${stage0Loaderdualboot} -y ${targetDisk}
fi
fi
branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/WriteChameleonStage1.sh
1919
2020
2121
22
23
24
2225
2326
2427
echo "DEBUG: passed argument for selectedDestination = $selectedDestination"
echo "DEBUG: passed argument for targetDeviceRaw = $targetDeviceRaw"
echo "DEBUG: passed argument for targetVolume = $targetVolume"
else
echo "Error - wrong number of values passed"
exit 9
fi
if [ ${espformat} = "1" ]; then
branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/WriteChameleonStage2.sh
2020
2121
2222
23
24
25
2326
2427
2528
echo "DEBUG: passed argument for selectedDestination = $selectedDestination"
echo "DEBUG: passed argument for targetDevice = $targetDevice"
echo "DEBUG: passed argument for targetVolume = $targetVolume"
else
echo "Error - wrong number of values passed"
exit 9
fi
# check to see if install to EFI system partition was selected
branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/CheckDiskMicrocode.sh
11
22
33
4
5
4
5
66
77
88
......
1111
1212
1313
14
15
14
15
1616
1717
1818
......
3434
3535
3636
37
38
39
40
4137
4238
4339
......
4642
4743
4844
49
50
51
52
5345
5446
5547
......
6355
6456
6557
66
58
6759
6860
69
70
71
72
7361
7462
7563
7664
7765
7866
79
67
8068
8169
82
83
84
85
8670
8771
8872
89
9073
74
9175
9276
93
77
9478
9579
96
80
9781
9882
9983
100
84
10185
10286
103
10487
10588
#!/bin/bash
echo "==============================================="
echo "Entering CheckDiskMicrocode:"
echo "****************************"
echo "CheckDiskMicrocode: Any existing bootloaders?"
echo "*********************************************"
# This script is passed the targetDisk and diskSigCheck.
#
# which might be better changed depending on whether or not a Windows
# signature is found or not.
#
# The script then exits with the value 1 to indicate that Chameleon stage0
# loader can be written, or 0 to indicate not to write the stage0 loader.
# 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
targetDisk="$1"
if [ $( echo "${mbr437}" | awk -F0 '{print NF-1}' ) = 874 ]; then
echo "The first 437 bytes of the MBR Disk Sector is blank - Updating"
echo "diskupdate is now set to true."
echo "-----------------------------------------------"
echo ""
exit 1
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"
echo "diskupdate is now set to true."
echo "-----------------------------------------------"
echo ""
exit 1
fi
# See if a Chameleon stage0 boot file already exists
if [ "${stage0type}" == "0b807c" ]; then
echo "Found existing Chameleon stage 0 loader - Boot0hfs"
# CheckDiskSignature.sh returns 0 if a Windows installation was NOT found
# 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"
echo "diskupdate is now set to true."
echo "-----------------------------------------------"
echo ""
exit 1
fi
fi
if [ "${stage0type}" == "0a803c" ]; then
echo "Found existing Chameleon stage 0 loader - Boot0"
# CheckDiskSignature.sh returns 1 if a Windows installation was found
# 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"
echo "diskupdate is now set to true."
echo "-----------------------------------------------"
echo ""
exit 1
fi
fi
# If neither Chameleon Boot Loader or Windows loader exists
if [ "${stage0type}" != "0b807c" ] && [ "${stage0type}" != "0a803c" ] && [ "${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 left at false"
echo "diskupdate is set to false"
echo "-----------------------------------------------"
echo ""
exit 0
exit 1
fi
fi
echo "diskupdate is now set to true."
echo "-----------------------------------------------"
echo ""
echo ""
exit 0
branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/CheckProceed.sh
11
22
33
4
5
4
5
66
77
88
......
1313
1414
1515
16
17
18
1619
1720
1821
#!/bin/bash
echo "==============================================="
echo "Check Proceed - Can the script continue?"
echo "******************************************"
echo "Check Proceed: Can the script continue?"
echo "***************************************"
# Receives targetVolume and targetDevice
# Checks the selected volume is present and the disk
targetDevice="$2"
echo "DEBUG: passed argument for targetVolume = $targetVolume"
echo "DEBUG: passed argument for targetDevice = $targetDevice"
else
echo "Error - wrong number of values passed"
exit 9
fi
if [ -z "$targetVolume" ]; then
branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/SetActivePartition.sh
2121
2222
2323
24
24
25
26
2527
2628
2729
echo "DEBUG: passed argument for targetDiskRaw = $targetDiskRaw"
echo "DEBUG: passed argument for targetSlice = $targetSlice"
echo "DEBUG: passed argument for targetVolume = $targetVolume"
else
echo "Error - wrong number of values passed"
exit 9
fi
if [ ${diskSigCheck} == "0" ]; then
branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/postflight.sh
2525
2626
2727
28
29
28
29
30
31
32
33
34
35
36
37
3038
3139
3240
......
4856
4957
5058
51
52
59
60
61
5362
5463
5564
......
7079
7180
7281
73
74
82
83
7584
7685
7786
if [ -d "${3}"/.Chameleon/Extra ]; then
# Check to see if install to EFI system partition was selected
# if chosen, the package installer would have added a file named
# TO DO - Set permissions of temporary /Extra folder
# If user selected to the standard installation
# then the package installer would have added a file named
# 'nullstandard' in to the temporary directory /.Chameleon
# If user selected to install to EFI system partition
# then the package installer would have added a file named
# 'nullESP' in to the temporary directory /.Chameleon
# We also need to check to see if the user selected both the
rm -f -R "/Volumes/EFI/Extra"
fi
echo "Executing command: ditto ${3}/.Chameleon/Extra /Volumes/EFI/Extra"
ditto "${3}"/.Chameleon/Extra /Volumes/EFI/Extra
# copy temporary /Extra folder to the selected destination.
echo "Executing command: cp ${3}/.Chameleon/Extra /Volumes/EFI/Extra"
cp -R "${3}"/.Chameleon/Extra /Volumes/EFI/Extra
echo "Executing command: umount -f Volumes/EFI"
"$scriptDir"UnMountEFIvolumes.sh
rm -f -R "${3}"/Extra
fi
echo "Executing command: ditto ${3}/.Chameleon/Extra ${3}/Extra"
ditto "${3}"/.Chameleon/Extra "${3}"/Extra
echo "Executing command: cp ${3}/.Chameleon/Extra ${3}/Extra"
cp -R "${3}"/.Chameleon/Extra "${3}"/Extra
fi
fi
branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/CheckWindowsDiskSignature.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
echo "==============================================="
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
# if one is found then it exits with 1, otherwise it exits with 0
if [ "$#" -eq 1 ]; then
targetDisk="$1"
echo "DEBUG: passed argument for targetDisk = $targetDisk"
else
echo "Error - wrong number of values passed - Exiting"
exit 9
fi
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}"
if [ "${disksignature}" = "00000000" ]; then
echo "No Windows installation detected."
echo "-----------------------------------------------"
echo ""
exit 0
else
echo "Detected an existing Windows installation"
echo "-----------------------------------------------"
echo ""
exit 1
fi
echo "-----------------------------------------------"
echo ""
exit 0
branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/CheckFormat.sh
11
22
33
4
5
4
5
66
77
88
......
1313
1414
1515
16
17
18
1619
1720
1821
#!/bin/bash
echo "==============================================="
echo "Check the format of the selected partition"
echo "******************************************"
echo "CheckFormat: Is target HFS or MSDOS?"
echo "**********************************************"
# Receives passed value for the Target Volume Device
# for example: /dev/disk0s2
if [ "$#" -eq 1 ]; then
targetDevice="$1"
echo "DEBUG: passed argument for targetDevice = $targetDevice"
else
echo "Error - wrong number of values passed"
exit 9
fi
if [ "$( fstyp "$targetDevice" | grep hfs )" ]; then
branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/MainESPPostinstall.sh
9797
9898
9999
100
100101
101
102
102103
103104
104105
......
107108
108109
109110
110
111
111112
112113
113114
114115
115116
116
117
117
118
118119
119120
120121
121122
122123
123
124
125
126
127
128
129
130124
131125
132126
......
152146
153147
154148
155
156
149
150
157151
158152
159153
# Does a GRUB or Linux loader already exist in the disk's MBR?
# The script returns 1 if yes, 0 if no.
"$scriptDir"CheckDiskMicrocodeType.sh "${targetDisk}"
"$scriptDir"CheckGRUBLinuxLoader.sh "${targetDisk}"
returnValue=$?
if [ ${returnValue} = 0 ]; then
# OK to proceed
# 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"CheckDiskSignature.sh "${targetDisk}"
"$scriptDir"CheckWindowsDiskSignature.sh "${targetDisk}"
diskSigCheck=$?
# check for existing bootloaders in the disk's MBR
# and find out if we can write the Chameleon boot files.
# the following script returns 1 if we can proceed
# with writing the boot files, and 0 for not.
# the following script returns 0 if we can proceed
# with writing the boot files, and 1 for not.
"$scriptDir"CheckDiskMicrocode.sh "${targetDisk}" "${diskSigCheck}"
diskupdate=$?
# Cancelled this as all it does is read the GPTdiskProtectiveMBR
# and the GPTdiskGPTHeader and look to see if they're blank
#"$scriptDir"FindPartitionBootcode.sh "${targetDeviceRaw}"
# check the format of the selected partition.
# the following script returns 1 if HFS
# the following script returns 2 if MSDOS
# OK to proceed
# If diskupdate is flagged as 1 then the stage 0 loader can be written to the MBR
if [ ${diskupdate} = 1 ]; then
# 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}"
fi
branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/CheckPartitionScheme.sh
11
22
33
4
5
4
5
66
77
88
......
1717
1818
1919
20
21
22
2023
2124
2225
#!/bin/bash
echo "==============================================="
echo "Check the Partition Scheme"
echo "******************************************"
echo "Check the Partition Scheme: GPT, GPT/MBR or MBR?"
echo "************************************************"
# Receives passed value for the Target Disk
# for example: /dev/disk0s2
if [ "$#" -eq 1 ]; then
targetDisk="$1"
echo "DEBUG: passed argument = $targetDisk"
else
echo "Error - wrong number of values passed"
exit 9
fi
branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/BuildBootOptions.sh
4545
4646
4747
48
49
50
48
5149
52
53
54
55
50
5651
57
58
59
60
52
53
54
55
56
57
6158
62
63
64
59
6560
66
67
68
61
62
63
64
65
66
67
6968
70
71
72
69
70
71
72
7373
74
75
74
75
76
77
7678
77
78
79
80
81
79
80
81
82
8283
83
84
84
85
86
87
88
8589
86
87
88
89
90
90
9191
92
93
94
9295
93
94
96
97
9598
96
99
100
101
97102
98
103
104
99105
100
101
102
103
104
105
106
106
107
108
107109
108
109
110
111
112
113
110
111
114112
115
113
114
115
116
117
116118
117
118
119
120
121
119
120
122121
123
124
125
126
127
128
129
130
122
123
124
125
131126
132
133
134
135
127
128
129
130
131
136132
137
138
139
140
133
134
135
141136
142
143
144
145
137
138
139
140
146141
147
148
149
150
151
152
153
154
155
156
157
142
143
158144
159
160
161
145
162146
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
147
148
149
178150
179
180
181
182
183
184
185
186
187
188
151
152
153
189154
190
191
192
155
156
193157
194
195
196
197
158
159
160
161
162
198163
199
164
165
200166
201
202
167
168
169
170
203171
204172
205173
174
206175
207176
208177
echo "Build Extra/com.apple.Boot.plist"
echo "********************************"
for bootOptionFile in $Dirlist ; do
overide=$(echo $bootOptionFile | sed 's/_/ /g' | tr -d "./@" |cut -d '+' -f1)
string=$(echo $bootOptionFile | tr -d "./@" |cut -d'+' -f2)
mv "${bootplist}" "${bootplist}.orig"
bootoptionshdextra[1]="<key>${overide}</key>"
bootoptionshdextra[2]="<string>${string}</string>"
#echo "DEBUG: bootoptionshdextra 1 = ${bootoptionshdextra[1]}"
#echo "DEBUG: bootoptionshdextra 2= ${bootoptionshdextra[2]}"
#prefunctionifs="${IFS}"
echo "Attempting to add ${overide}=${string} to ${bootplist}"
array=("${bootoptionshdextra[@]}")
searchfilereplaceline "${bootplist}" "<key>Kernel Flags</key>" "" "" "2"
echo ""
fileinput="${bootplist}.orig"
fileoutput="${bootplist}"
find="<key>Kernel Flags</key>"
replace=""
deletelines=""
insertlinesskip="2"
#echo "set owner privileges for ${bootplist}"
chown "${USER}:20" "${bootplist}"
done
matchlinefound="0"
echo "-----------------------------------------------"
echo ""
while read line
do
{
if [ ! "${line}" = "${line/${find}/}" ]; then
{
# Trim the longest match from the end for <*
xmlelementindent="${line%%<*}"
echo "==============================================="
echo "Clean up and Remove Boot Option Null Files"
echo "******************************************"
# Trim the longest match from the start for *<
xmlelementtemp="${line#*<}"
# Add back in stripped <
xmlelement="<${xmlelementtemp}"
# make sure we're in the right directory
cd "${tempDir}"
# Trim the shortest match from the start for <
xmltagtemp="${xmlelement#<}"
# Trim the longest match from the end for >*
xmltag="${xmltagtemp%%>*}"
Dirlist=$(find . -type f | grep "@")
for bootOptionFile in ${Dirlist} ; do
echo "Removing temporary boot option file: ${bootOptionFile}"
rm $bootOptionFile
done
# Trim the shortest match from the start for *>
xmltexttemp="${xmlelement#*>}"
# Trim the longest match from the end for <*
xmltext="${xmltexttemp%%<*}"
echo "-----------------------------------------------"
echo ""
if [ "${replace}" ]; then
echo "${xmlelementindent}<${xmltag}>${replace}</${xmltag}>" >>"${fileoutput}"
else
echo "${line}" >>"${fileoutput}"
fi
else
echo "No boot options in the temporary directory."
fi
fi
}
matchlinefound="1"
}
else
{
searchfilereplaceline ()
{
if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then
if [ "${matchlinefound}" = "${insertlinesskip}" ]; then
mv "${1}" "${1}.orig"
for bootOptionFile in $Dirlist ; do
overide=$(echo $bootOptionFile | sed 's/_/ /g' | tr -d "./@" |cut -d '+' -f1)
string=$(echo $bootOptionFile | tr -d "./@" |cut -d'+' -f2)
prefunctionifs="${IFS}"
bootoptionshdextra[1]="<key>${overide}</key>"
bootoptionshdextra[2]="<string>${string}</string>"
unset fileinput
unset fileoutput
unset find
unset replace
unset deletelines
unset deletelinesskip
unset insertlinesskip
echo "Adding ${overide}=${string} to ${bootplist}"
array=("${bootoptionshdextra[@]}")
arraysize=0
fileinput="${1}.orig"
fileoutput="${1}"
find="${2}"
replace="${3}"
deletelines="${4%,*}"
insertlinesskip="${5}"
#prefunctionifs="${IFS}"
#IFS="\n"
matchlinefound="0"
while [ ${arraysize} -lt ${#array[@]} ];
do
echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}"
let arraysize="${arraysize}+1"
done
if [ "${#4}" = "${4#*,}" ]; then
deletelinesskip="0"
else
deletelinesskip="${4#*,}"
fi
#IFS=${prefunctionifs}
done
IFS="\n"
while read line
do
{
if [ ! "${line}" = "${line/${find}/}" ]; then
{
# Trim the longest match from the end for <*
xmlelementindent="${line%%<*}"
#echo "set owner privileges for ${bootplist}"
chown "${USER}:20" "${bootplist}"
fi
fi
# Trim the longest match from the start for *<
xmlelementtemp="${line#*<}"
# Add back in stripped <
xmlelement="<${xmlelementtemp}"
if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then
:
else
echo "${line}" >>"${fileoutput}"
fi
# Trim the shortest match from the start for <
xmltagtemp="${xmlelement#<}"
# Trim the longest match from the end for >*
xmltag="${xmltagtemp%%>*}"
if [ "${matchlinefound}" -gt 0 ]; then
let matchlinefound="${matchlinefound}+1"
fi
# Trim the shortest match from the start for *>
xmltexttemp="${xmlelement#*>}"
# Trim the longest match from the end for <*
xmltext="${xmltexttemp%%<*}"
}
fi
}
done < "${fileinput}"
if [ "${replace}" ]; then
echo "DEBUG: Replace=${replace}"
{
echo "${xmlelementindent}<${xmltag}>${replace}</${xmltag}>" >>"${fileoutput}"
}
else
{
echo "${line}" >>"${fileoutput}"
}
fi
matchlinefound="1"
#IFS=${prefunctionifs}
rm -f "${fileinput}"
}
else
{
echo ""
if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then
{
if [ "${matchlinefound}" = "${insertlinesskip}" ]; then
{
arraysize=0
while [ ${arraysize} -lt ${#array[@]} ];
do
#echo "DEBUG: ${xmlelementindent}${array[${arraysize}]}"
echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}"
let arraysize="${arraysize}+1"
done
}
fi
}
fi
echo "-----------------------------------------------"
echo ""
if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then
echo "DEBUG: Delete=${matchlinefound}"
{
:
}
else
{
echo "${line}" >>"${fileoutput}"
}
fi
echo "==============================================="
echo "Clean up and Remove Boot Option Null Files"
echo "******************************************"
if [ "${matchlinefound}" -gt 0 ]; then
let matchlinefound="${matchlinefound}+1"
fi
# make sure we're in the right directory
cd "${tempDir}"
}
fi
}
done < "${fileinput}"
Dirlist=$(find . -type f | grep "@")
for bootOptionFile in ${Dirlist} ; do
echo "Removing temporary boot option file: ${bootOptionFile}"
rm $bootOptionFile
done
IFS=${prefunctionifs}
echo "-----------------------------------------------"
echo ""
echo " rm -f ${fileinput}"
rm -f "${fileinput}"
else
echo "No boot options in the temporary directory."
fi
fi
}
echo "==============================================="
echo "Enter Build Boot Options script"
echo "*******************************"
branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/MainStandardPostinstall.sh
7676
7777
7878
79
7980
80
81
8182
8283
8384
......
8687
8788
8889
89
90
9091
9192
9293
9394
9495
95
96
96
97
9798
9899
99100
100101
101102
102
103
104
105
106
107
108
109103
110104
111105
......
141135
142136
143137
144
145
138
139
146140
147141
148142
# Does a GRUB or Linux loader already exist in the disk's MBR?
# The script returns 1 if yes, 0 if no.
"$scriptDir"CheckDiskMicrocodeType.sh "${targetDisk}"
"$scriptDir"CheckGRUBLinuxLoader.sh "${targetDisk}"
returnValue=$?
if [ ${returnValue} = 0 ]; then
# OK to proceed
# 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"CheckDiskSignature.sh "${targetDisk}"
"$scriptDir"CheckWindowsDiskSignature.sh "${targetDisk}"
diskSigCheck=$?
# check for existing bootloaders in the disk's MBR
# and find out if we can write the Chameleon boot files.
# the following script returns 1 if we can proceed
# with writing the boot files, and 0 for not.
# the following script returns 0 if we can proceed
# with writing the boot files, and 1 for not.
"$scriptDir"CheckDiskMicrocode.sh "${targetDisk}" "${diskSigCheck}"
diskupdate=$?
# Cancelled this as all it does is read the GPTdiskProtectiveMBR
# and the GPTdiskGPTHeader and look to see if they're blank
#"$scriptDir"FindPartitionBootcode.sh "${targetDeviceRaw}"
# check the format of the selected partition.
# the following script returns 1 if HFS
# the following script returns 2 if MSDOS
else
# Continue if the selected device is not a FAT16 format device
# If diskupdate is flagged as 1 then the stage 0 loader can be written to the MBR
if [ ${diskupdate} = 1 ]; then
# 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}"
fi
branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/CheckGRUBLinuxLoader.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
echo "==============================================="
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
# 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
targetDisk="$1"
echo "DEBUG: passed argument for targetDisk = $targetDisk"
else
echo "Error - wrong number of values passed"
exit 9
fi
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."
exit 1
else
echo "Didn't find a match for ${diskmicrocodetype[${diskmicrocodetypecounter}]%,*}"
fi
done
echo "-----------------------------------------------"
echo ""
exit 0

Archive Download the corresponding diff file

Revision: 255