Chameleon

Chameleon Commit Details

Date:2011-10-06 23:00:44 (12 years 6 months ago)
Author:blackosx
Commit:1614
Parents: 1613
Message:Test whole process, fixing any errors along the way.
Changes:
M/branches/blackosx/package/Scripts/Main/EFI/postinstall
M/branches/blackosx/package/Scripts/Main/Post/postinstall
M/branches/blackosx/package/Scripts/Sub/UnMountEFIvolumes.sh
M/branches/blackosx/package/Scripts/Sub/WriteChameleonStage2.sh
M/branches/blackosx/package/Scripts/Main/Standard/postinstall

File differences

branches/blackosx/package/Scripts/Main/Standard/postinstall
150150
151151
152152
153
153154
154155
155156
156
157157
158158
159159
"$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak"
if [ ${diskupdate} = "0" ]; then
# Write the stage 0 loader to the MBR
"$scriptDir"WriteChameleonStage0.sh "${diskSigCheck}" "${stage0Loader}" "${stage0LoaderDualBoot}" "${targetDisk}" "${targetResources}" "${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
branches/blackosx/package/Scripts/Main/EFI/postinstall
151151
152152
153153
154
155
154
156155
157156
158157
159
160158
161159
162160
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "LineBreak"
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}" "${targetResources}" "${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
branches/blackosx/package/Scripts/Main/Post/postinstall
11
2
3
4
5
6
7
8
9
10
11
12
13
142
15
16
17
18
3
4
5
6
7
198
20
9
10
11
12
2113
14
2215
2316
2417
......
3326
3427
3528
36
29
3730
3831
3932
......
151144
152145
153146
154
155147
156148
157149
158
150
159151
160152
161153
......
164156
165157
166158
167
168159
169160
170161
......
172163
173164
174165
175
176
177
178
179
180
181
182
183
184166
185167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
186182
187183
188184
......
220216
221217
222218
223
219
220
221
222
223
#!/bin/bash
#
# $1: the full path to the installation package; for example:
# /Volumes/Projects/Testing/Simple_Carbon_App.pkg
#
# $2: the full path to the installation destination; for example:
# /Applications
#
# $3: the mountpoint of the destination volume; for example:
# / or /Volumes/External_Drive
#
# $4: the root directory for the current System folder:
# /
echo "preinstall: Path to installer....... $1"
echo "preinstall: Path to destination..... $2"
echo "preinstall: Path to dest volume..... $3"
echo "preinstall: Root of system folder... $4"
echo "==============================================="
echo "Post Post-Install Script"
echo "*********************************"
echo "-----------------------------------------------"
echo ""
#set -x # Useful for echoing everything the script does to the installer log!!
#echo "DEBUG: $ 1 = Full path to the installation package the installer app is processing: " $1
#echo "DEBUG: $ 2 = Full path to the installation destination: " $2
#echo "DEBUG: $ 3 = Installation volume (mountpoint) to receive the payload: " $3
#echo "DEBUG: $ 4 = Root directory for the system: " $4
# Check target exists
if [ ! -e "$3" ]
then
echo "$3 volume does not exist!"
dest_vol="$3"
fi
# Where are we, so to find the Install Log script.
# Find script location so to find the Install Log script.
MYLOCATION="${PWD}/${BASH_ARGV[0]}"
export MYLOCATION="${MYLOCATION%/*}"
scriptDir=$MYLOCATION
# Copy /usr/local/chamTemp/Extra to correct location.
if [ -d "$chamTemp"/Extra ]; then
if [ ! -f "$dest_vol"/.ChameleonEFI ]; then
# The Standard install option chosen
# Does and /Extra folder already exist?
# Does an /Extra folder already exist?
if [ -e "$dest_vol"/Extra ]; then
"$scriptDir"InstallLog.sh "${dest_vol}" "Found existing $dest_vol/Extra folder. Renaming it $dest_vol/Extra-OLD-$( date "+%H-%M-%S" )"
mv "$dest_vol/Extra" "$dest_vol/Extra_OLD-"$( date "+%H-%M-%S" )
cp -R "$chamTemp"/Extra "$dest_vol"
else
# The EFI system partition install option was chosen
# Does a /Volumes/Extra folder already exist?
if [ -e "/Volumes/EFI/Extra" ]; then
"$scriptDir"InstallLog.sh "${dest_vol}" "Found existing /Volumes/EFI/Extra folder. Renaming it Extra-OLD-$( date "+%H-%M-%S" )"
fi
"$scriptDir"InstallLog.sh "${dest_vol}" "Writing folder: /Volumes/EFI/Extra"
cp -R "$chamTemp"/Extra "/Volumes/EFI"
# unmount /Volumes/EFI
attempts=1
while [ "$( df | grep EFI )" ] && [ "${attempts}" -lt 5 ]; do
echo "Unmounting $( df | grep EFI | awk '{print $1}' )"
"$scriptDir"InstallLog.sh "${dest_vol}" "Unmounting $( df | grep EFI | awk '{print $1}' )"
umount -f $( df | grep EFI | awk '{print $1}' )
attempts=$(( ${attempts} + 1 ))
done
fi
fi
if [ -f "$dest_vol"/.ChameleonEFI ]; then
# unmount /Volumes/EFI
# Count of 5 exists incase for some reason /Volumes/EFI fails
# be unmounted in which case the loop would run forever.
attempts=1
while [ "$( df | grep EFI )" ] && [ $attempts -lt 5 ]; do
echo "Unmounting $( df | grep EFI | awk '{print $1}' )"
"$scriptDir"InstallLog.sh "${dest_vol}" "Find and unmount any volume named 'EFI':"
"$scriptDir"InstallLog.sh "${dest_vol}" "$( df | grep EFI | awk '{print $1}' )"
umount -f $( df | grep EFI | awk '{print $1}' )
(( attempts++ ))
done
fi
else
echo "Removing /.ChameleonExists file"
"$scriptDir"InstallLog.sh "${dest_vol}" "Cleanup 4"
rm "$dest_vol"/.ChameleonLogFlag
fi
echo "Done..."
echo "==============================================="
echo "END - Post Post-Install Script"
echo "*********************************"
echo "-----------------------------------------------"
echo ""
branches/blackosx/package/Scripts/Sub/WriteChameleonStage2.sh
88
99
1010
11
11
1212
13
13
1414
1515
1616
......
3434
3535
3636
37
37
3838
3939
4040
4141
42
43
42
43
4444
4545
4646
......
4848
4949
5050
51
52
51
52
53
5354
5455
5556
56
57
58
5759
5860
5961
# Receives espformat: 1 for HFS, 2 for MSDOS, 0 for unknown
# Receives stage2Loader: Name of file - boot
# Receives selectedDestination: for example, /Volumes/USB
# Receives selectedDestination: for example, /Volumes/ChameleonBootUSB (or /Volumes/EFI if ESP install).
# Receives targetDevice: for example, /dev/disk3s1
# Receives targetVolume: for example, /Volumes/USB
# Receives targetVolume: for example, /Volumes/ChameleonBootUSB
# Receives scriptDir: The location of the main script dir.
# check to see if install to EFI system partition was selected
if [ "${selectedDestination}" = "/Volumes/EFI" ]; then
echo "DEBUG: EFI install chosen"
#echo "DEBUG: EFI install chosen"
if [ ! -d "${selectedDestination}" ]; then
echo "Executing Command: mkdir -p ${selectedDestination}"
mkdir -p "${targetVolume}"
else
echo "DEBUG: folder /Volumes/EFI already exists"
#else
#echo "DEBUG: folder /Volumes/EFI already exists"
fi
#if the EFI system partition was selected then
if [ ${espformat} = 1 ]; then
echo "Executing command: mount_hfs ${targetDevice} ${targetVolume}"
mount_hfs "${targetDevice}" "${targetVolume}"
#echo "Executing command: mount_hfs ${targetDevice} ${targetVolume}"
"$scriptDir"InstallLog.sh "${targetVolume}" "Mounting ${targetDevice} as ${selectedDestination}"
mount_hfs "${targetDevice}" "${selectedDestination}"
fi
if [ ${espformat} = 2 ]; then
[ -d "${selectedDestination}" ] || mkdir -p "${selectedDestination}"
echo "Executing command: mount_msdos -u 0 -g 0 ${targetDevice} ${selectedDestination}"
#echo "Executing command: mount_msdos -u 0 -g 0 ${targetDevice} ${selectedDestination}"
"$scriptDir"InstallLog.sh "${targetVolume}" "Mounting ${targetDevice} as ${selectedDestination}"
mount_msdos -u 0 -g 0 "${targetDevice}" "${selectedDestination}"
fi
branches/blackosx/package/Scripts/Sub/UnMountEFIvolumes.sh
66
77
88
9
910
10
1111
1212
13
13
1414
15
15
1616
1717
1818
1919
2020
2121
22
22
23
2324
24
25
2526
27
28
2629
27
30
2831
29
32
3033
3134
32
35
3336
3437
3538
# loop through and un-mount ALL mounted 'EFI' system partitions - Thanks kizwan
# Receives targetVolumeChosenByUser: Stores original target if EFI install selected.
# Receives scriptDir: The location of the main script dir.
# Receives targetVolumeTemp: Stores original target if EFI install selected.
if [ "$#" -eq 2 ]; then
targetVolumeTemp="$1"
targetVolumeChosenByUser="$1"
scriptDir="$2"
echo "DEBUG: passed argument for targetVolumeTemp = $targetVolumeTemp"
echo "DEBUG: passed argument for targetVolumeChosenByUser = $targetVolumeChosenByUser"
echo "DEBUG: passed argument for scriptDir = $scriptDir"
else
echo "Error - wrong number of values passed"
exit 9
fi
# Count of 5 exists incase for some reason /Volumes/EFI fails
# be unmounted in which case the loop would run forever.
attempts=1
while [ "$( df | grep EFI )" ] && [ "${attempts}" -lt 5 ]; do
while [ "$( df | grep EFI )" ] && [ $attempts -lt 5 ]; do
echo "Unmounting $( df | grep EFI | awk '{print $1}' )"
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Find and unmount any volume named 'EFI':"
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "$( df | grep EFI | awk '{print $1}' )"
umount -f $( df | grep EFI | awk '{print $1}' )
attempts=$(( ${attempts} + 1 ))
(( attempts++ ))
done
if [ ${attempts} = 5 ]; then
if [ $attempts = 5 ]; then
echo "failed to unmount 'EFI' System Partition."
echo "-----------------------------------------------"
"$scriptDir"InstallLog.sh "${targetVolumeTemp}" "Failed to unmount 'EFI' System Partition."
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Failed to unmount 'EFI' System Partition."
echo ""
echo ""
echo ""

Archive Download the corresponding diff file

Revision: 1614