Chameleon

Chameleon Commit Details

Date:2011-10-19 18:06:45 (12 years 6 months ago)
Author:blackosx
Commit:1637
Parents: 1636
Message:Make further changes to how the check for previous installations works, and when it's called. Need to check these chnages on my system tonight.
Changes:
A/branches/blackosx/package/Scripts/Sub/MountESP.sh
M/branches/blackosx/package/Scripts/Main/EFI/postinstall
M/branches/blackosx/package/Scripts/Sub/UnMountEFIvolumes.sh
M/branches/blackosx/package/Scripts/Sub/CheckPreviousChameleon.sh
M/branches/blackosx/package/Scripts/Main/Standard/postinstall

File differences

branches/blackosx/package/Scripts/Main/Standard/postinstall
7474
7575
7676
77
78
79
8077
8178
8279
......
125122
126123
127124
128
129
125
126
130127
131128
132129
......
137134
138135
139136
140
141
137
142138
143139
144140
145141
146142
147
148
149
143
144
150145
151
152
153
154
146
147
148
149
150
151
152
155153
156
157
154
155
158156
159
157
158
159
160
161
162
163
160164
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
165176
177
178
179
180
166181
167
168
182
183
169184
170
171
172
173
174
175
176
177
178
179
180
185
186
181187
182188
183189
"$scriptDir"InstallLog.sh "${targetVolume}" "Running Standard postinstall script"
"$scriptDir"InstallLog.sh "${targetVolume}" "Target volume = ${targetVolume} on ${targetDevice}"
# Added from EFI post script as this is now sent to CheckPreviousChameleon.sh
partitiontable=$( diskutil list ${targetDevice%s*} | sed -n '3p' | awk '{print $2}' )
# Double check we can see the selected partition and it's of the right type.
# If the following script finds anything, it returns 1 to indicate failure.
# the following script returns 0 if nothing
"$scriptDir"CheckPartitionScheme.sh "${targetDisk}" "${targetVolume}" "${scriptDir}"
partitionTable=$?
if [ ${partitionTable} = 3 ]; then
partitionScheme=$?
if [ ${partitionScheme} = 3 ]; then
# If MBR partition scheme then check for FAT16 or FAT32
# the following script returns 1 if FAT16
fatType=$?
fi
if [ "${fatType}" = 1 ] && [ "${partitionTable}" = 3 ]; then
echo "ERROR: - Can't install to a device using FAT16"
if [ "${fatType}" = 1 ] && [ "${partitionScheme}" = 3 ]; then
# Write error to Chameleon_Error_Log file
"$scriptDir"InstallLog.sh "${targetVolume}" "FAIL: Cannot install to a device using FAT16"
else
# Continue if the selected device is not a FAT16 format device
# Now also check for another existing Chameleon installation on the same disk.
# If the following script finds anything, it returns 1 to indicate failure.
# It returns 2 to indicate failure to unmount any Volumes named "EFI"
# Append a line break to the installer log
"$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak"
"$scriptDir"CheckPreviousChameleon.sh "${targetDisk}" "${targetDeviceRaw}" "${targetDevice}" "${targetVolume}" "${partitiontable}" "${scriptDir}"
returnValue=$?
if [ ${returnValue} = 0 ] || [ ${returnValue} = 2 ]; then
# OK to proceed
if [ ${diskupdate} = "0" ]; then
# Write the stage 0 loader to the MBR
"$scriptDir"WriteChameleonStage0.sh "${diskSigCheck}" "${stage0Loader}" "${stage0LoaderDualBoot}" "${targetDisk}" "${targetResources}" "${targetVolume}" "${scriptDir}"
else
"$scriptDir"InstallLog.sh "${targetVolume}" "Stage 0 loader not written to ${targetDisk}."
fi
# Append a line break to the installer log
"$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak"
# Write the stage 1 loader to the partition boot sector
"$scriptDir"WriteChameleonStage1.sh "${targetFormat}" "${stage1LoaderHFS}" "${stage1LoaderFAT}" "${3}" "${targetDeviceRaw}" "${targetVolume}" "${scriptDir}"
if [ ${diskupdate} = "0" ]; then
# Write the stage 2 loader to the root of the selected partition
"$scriptDir"WriteChameleonStage2.sh "${stage2Loader}" "${3}" "${targetDevice}" "${targetVolume}" "${scriptDir}"
# Next we look to check for existing Chameleon installations.
# But as it will check /Volumes/EFI for the stage 2 loader,
# we need to make sure it's mounted.
# Write the stage 0 loader to the MBR
"$scriptDir"WriteChameleonStage0.sh "${diskSigCheck}" "${stage0Loader}" "${stage0LoaderDualBoot}" "${targetDisk}" "${targetResources}" "${targetVolume}" "${scriptDir}"
else
"$scriptDir"InstallLog.sh "${targetVolume}" "Stage 0 loader not written to ${targetDisk}."
# Unmount ALL mounted volumes named EFI.
# Returns 0=success, 1=fail
"$scriptDir"UnMountEFIvolumes.sh "${targetVolume}" "${scriptDir}"
returnValue=$?
if [ ${returnValue} = 0 ]; then
# OK to proceed
if [ ${partitionScheme} = 1 ] || [ ${partitionScheme} = 2 ]; then
# Mount the EFI system partition
"$scriptDir"MountESP.sh "${targetDisk}" "${targetVolume}" "${scriptDir}"
fi
# Check for another existing Chameleon installation on the same disk
"$scriptDir"CheckPreviousChameleon.sh "${targetDisk}" "${targetDeviceRaw}" "${targetDevice}" "${targetVolume}" "${scriptDir}"
fi
# Write the stage 1 loader to the partition boot sector
"$scriptDir"WriteChameleonStage1.sh "${targetFormat}" "${stage1LoaderHFS}" "${stage1LoaderFAT}" "${3}" "${targetDeviceRaw}" "${targetVolume}" "${scriptDir}"
# Append a line break to the installer log
"$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak"
# Write the stage 2 loader to the root of the selected partition
"$scriptDir"WriteChameleonStage2.sh "${stage2Loader}" "${3}" "${targetDevice}" "${targetVolume}" "${scriptDir}"
# Append a line break to the installer log
"$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak"
# Set the active partition ONLY if Windows is not installed
"$scriptDir"SetActivePartition.sh "${diskSigCheck}" "${targetDiskRaw}" "${targetSlice}" "${targetVolume}" "${scriptDir}"
else
echo "Stop" >"${targetVolumeChosenByUser}"/.ChameleonExists
fi
# Set the active partition ONLY if Windows is not installed
"$scriptDir"SetActivePartition.sh "${diskSigCheck}" "${targetDiskRaw}" "${targetSlice}" "${targetVolume}" "${scriptDir}"
fi
fi
fi
branches/blackosx/package/Scripts/Main/EFI/postinstall
9191
9292
9393
94
9495
9596
9697
......
129130
130131
131132
132
133
133
134
134135
135
136
137
138
139
140
141
142
136143
137
138
139
140
141
144
145
146
147
148
149
150
151
142152
143
153
144154
145
146
147
148
149
150155
151
152
153
154
155
156
157
158
159
156
157
158
160159
161160
162161
163
164
162
163
164
165165
166
167
168
169
170
166
167
168
169
170
171
171172
172173
173174
# Double check we can see the selected partition and it's of the right type.
# If the following script finds anything, it returns 1 to indicate failure.
"$scriptDir"CheckProceed.sh "${targetVolume}" "${targetDeviceChosenByUser}" "${targetVolumeChosenByUser}" "${scriptDir}"
returnValue=$?
if [ ${returnValue} = 0 ]; then
targetFormat=$( fstyp "$targetDevice" )
# Determine the partition scheme of the selected disk
# is it GPT or a hybrid GPT/MBR
# Append a LineBreak to the installer log
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "LineBreak"
"$scriptDir"CheckPartitionScheme.sh "${targetDisk}" "${targetVolumeChosenByUser}" "${scriptDir}"
if [ ${diskupdate} = "0" ]; then
# Write the stage 0 loader to the MBR
"$scriptDir"WriteChameleonStage0.sh "${diskSigCheck}" "${stage0Loader}" "${stage0LoaderDualBoot}" "${targetDisk}" "${targetResources}" "${targetVolumeChosenByUser}" "${scriptDir}"
else
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Stage 0 loader not written to ${targetDisk}."
fi
# Now also check for another existing Chameleon installation on the same disk.
# This also unmounts all volumes named EFI and then mounts the EFI system partition.
# If the following script finds anything, it returns 1 to indicate failure.
# It returns 2 to indicate failure to unmount any Volumes named "EFI"
"$scriptDir"CheckPreviousChameleon.sh "${targetDisk}" "${targetDeviceRaw}" "${targetDevice}" "${targetVolumeChosenByUser}" "${partitiontable}" "${scriptDir}"
# Write the stage 1 loader to the partition boot sector
"$scriptDir"WriteChameleonStage1.sh "${targetFormat}" "${stage1LoaderHFS}" "${stage1LoaderFAT}" "${targetVolumeChosenByUser}" "${targetDeviceRaw}" "${targetVolumeChosenByUser}" "${scriptDir}"
# Unmount ALL mounted volumes named EFI.
# Returns 0=success, 1=fail
"$scriptDir"UnMountEFIvolumes.sh "${targetVolumeChosenByUser}" "${scriptDir}"
returnValue=$?
if [ ${returnValue} = 0 ] && [ ${returnValue} -ne 2 ]; then
if [ ${returnValue} = 0 ]; then
# OK to proceed
# Append a LineBreak to the installer log
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "LineBreak"
if [ ${diskupdate} = "0" ]; then
# Write the stage 0 loader to the MBR
"$scriptDir"WriteChameleonStage0.sh "${diskSigCheck}" "${stage0Loader}" "${stage0LoaderDualBoot}" "${targetDisk}" "${targetResources}" "${targetVolumeChosenByUser}" "${scriptDir}"
else
"$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 "${targetFormat}" "${stage1LoaderHFS}" "${stage1LoaderFAT}" "${targetVolumeChosenByUser}" "${targetDeviceRaw}" "${targetVolumeChosenByUser}" "${scriptDir}"
# Mount the EFI system partition
"$scriptDir"MountESP.sh "${targetDisk}" "${targetVolumeChosenByUser}" "${scriptDir}"
# Write the stage 2 loader to the root of the selected partition
"$scriptDir"WriteChameleonStage2.sh "${stage2Loader}" "${targetVolume}" "${targetDevice}" "${targetVolumeChosenByUser}" "${scriptDir}"
# Append a LineBreak to the installer log
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "LineBreak"
# Check for another existing Chameleon installation on the same disk
"$scriptDir"CheckPreviousChameleon.sh "${targetDisk}" "${targetDeviceRaw}" "${targetDevice}" "${targetVolumeChosenByUser}" "${scriptDir}"
fi
# Set the active partition ONLY if Windows is not installed
"$scriptDir"SetActivePartition.sh "${diskSigCheck}" "${targetDiskRaw}" "${targetSlice}" "${targetVolumeChosenByUser}" "${scriptDir}"
else
echo "Stop" >"${targetVolumeChosenByUser}"/.ChameleonExists
fi
# Append a LineBreak to the installer log
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "LineBreak"
# Set the active partition ONLY if Windows is not installed
"$scriptDir"SetActivePartition.sh "${diskSigCheck}" "${targetDiskRaw}" "${targetSlice}" "${targetVolumeChosenByUser}" "${scriptDir}"
fi
fi
else
branches/blackosx/package/Scripts/Sub/CheckPreviousChameleon.sh
88
99
1010
11
12
13
1114
1215
1316
1417
15
1618
1719
18
20
1921
2022
2123
2224
23
24
25
2526
2627
2728
2829
29
3030
3131
3232
3333
3434
3535
36
37
38
39
40
41
4236
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
7737
7838
7939
......
9252
9353
9454
95
96
9755
9856
9957
10058
101
102
103
59
10460
10561
62
63
64
65
66
67
68
69
70
71
10672
10773
10874
10975
110
11176
11277
11378
114
115
116
117
118
119
120
121
122
123
124
125
126
79
12780
12881
12982
130
13183
13284
13385
134
13586
13687
13788
......
13990
14091
14192
142
14393
14494
14595
......
167117
168118
169119
120
170121
171122
172123
......
175126
176127
177128
178
129
179130
180131
181132
......
193144
194145
195146
147
196148
197149
198
199150
200
201
202
203
204
205
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
206169
207
208
209
210
211
212
213
214170
215
216
217171
218172
219173
# and tries to make sure the user doesn't end up with an un-bootable
# system due to having installed Chameleon previously elsewhere.
# Called from the Standard/postinstall and EFI/postinstall scripts
# /Volumes/EFI should already be mounted before this is called.
# Receives targetDisk: for example, /dev/disk3.
# Receives targetDeviceRaw: for example, /dev/rdisk3s1.
# Receives targetDevice: Stores device number, for example /dev/disk2s1.
# Receives installerVolume: Volume to write the installer log to.
# Receives partitiontable: for example, GUID_partition_scheme
# Receives scriptDir: The location of the main script dir.
if [ "$#" -eq 6 ]; then
if [ "$#" -eq 5 ]; then
targetDisk="$1"
targetDeviceRaw="$2"
targetDevice="$3"
installerVolume="$4"
partitiontable="$5"
scriptDir="$6"
scriptDir="$5"
echo "DEBUG: passed argument for targetDisk = $targetDisk"
echo "DEBUG: passed argument for targetDeviceRaw = $targetDeviceRaw"
echo "DEBUG: passed argument for targetDevice = $targetDevice"
echo "DEBUG: passed argument for installerVolume = $installerVolume"
echo "DEBUG: passed argument for partitiontable = $partitiontable"
echo "DEBUG: passed argument for scriptDir = $scriptDir"
else
echo "Error - wrong number of values passed"
exit 9
fi
# ===============================================
# Functions
# ===============================================
mountESP()
{
if [ "${partitiontable}" = "GUID_partition_scheme" ]; then
# Unmount ALL mounted volumes named EFI
# 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 "${installerVolume}" "${scriptDir}"
returnValue=$?
if [ ${returnValue} = 0 ]; then
# OK to proceed
if [ ! -e "/Volumes/EFI" ]; then
#echo "DEBUG: Executing Command: mkdir -p ${/Volumes/EFI}"
mkdir -p "/Volumes/EFI"
#else
#echo "DEBUG: folder /Volumes/EFI already exists"
fi
# Mount '/Volumes/EFI' using the correct format type
if [ "$( fstyp "${targetDisk}"s1 | grep hfs )" ]; then
#echo "Executing command: mount_hfs ${targetDevice} ${targetVolume}"
"$scriptDir"InstallLog.sh "${installerVolume}" "Mounting ${targetDisk}s1 as /Volumes/EFI"
mount_hfs "${targetDisk}"s1 "/Volumes/EFI"
fi
if [ "$( fstyp "${targetDisk}"s1 | grep msdos )" ]; then
#echo "Executing command: mount_msdos -u 0 -g 0 ${targetDevice} ${/Volumes/EFI}"
"$scriptDir"InstallLog.sh "${installerVolume}" "Mounting ${targetDisk}s1 as /Volumes/EFI"
mount_msdos -u 0 -g 0 "${targetDisk}"s1 "/Volumes/EFI"
fi
else
# quit out and notify EFI post script not to write Chameleon files.
exit 2
fi
fi
}
# ===============================================
# Prepare some vars
# ===============================================
# if there is more than one partition on the disk.
# ===============================================
if [ $numSlices -gt 1 ]; then
#echo "DEBUG: Checking for existing Chameleon installations on ${targetDisk#/dev/}..."
"$scriptDir"InstallLog.sh "${installerVolume}" "LineBreak"
"$scriptDir"InstallLog.sh "${installerVolume}" "Checking for previous chameleon installations on ${targetDisk#/dev/}"
# If a GPT is used then we are going to have the check the EFI system partition
# for the stage 2 'boot' file. As this script is called from the Main EFI
# postinstall script, so lets mount the EFI system partition here instead.
# for the stage 2 'boot' file so lets mount the EFI system partition.
mountESP
# Check the disk's MBR for existing stage 0 boot code (code from CheckDiskMicrocode.sh script)
stage0type=$( dd 2>/dev/null if="$targetDisk" count=3 bs=1 skip=105 | xxd | awk '{print $2$3}' )
if [ "${stage0type}" == "0a803c" ] || [ "${stage0type}" == "ee7505" ] || [ "${stage0type}" == "742b80" ]; then
(( stagesFound++ ))
stage0type=2
elif [ "${stage0type}" == "0b807c" ]; then
(( stagesFound++ ))
stage0type=1
fi
#Scan all partitions for Chameleon code
for (( i=1; i <= $numSlices; i++ ));
do
stagesFound=0
stage0type=0
stage1Existence="NONE"
stage2Existence=0
targetDiskRaw=$targetDiskRawNoSlice$i
# Check for existing stage 0 boot file (code from CheckDiskMicrocode.sh script)
stage0type=$( dd 2>/dev/null if="$targetDisk" count=3 bs=1 skip=105 | xxd | awk '{print $2$3}' )
if [ "${stage0type}" == "0a803c" ] || [ "${stage0type}" == "ee7505" ] || [ "${stage0type}" == "742b80" ]; then
#echo "DEBUG: stage 0 (hfs) loader found on $targetDisk"
(( stagesFound++ ))
stage0type=2
elif [ "${stage0type}" == "0b807c" ]; then
#echo "DEBUG: stage 0 (active) loader found on $targetDisk"
(( stagesFound++ ))
stage0type=1
fi
# Check for existence of a bootable partition boot sector containing either boot1h or boot1f32
boot1Search=$( dd 2>/dev/null if="$targetDiskRaw" count=1 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )
if [ "${boot1Search:0:16}" == "fa31c08ed0bcf0ff" ] && [ "${boot1Search:1020:2}" == "55" ]; then
#echo "DEBUG: boot1h found on "$targetDiskRaw
(( stagesFound++ ))
stage1Existence="boot1h"
elif [ "${boot1Search:0:4}" == "e962" ] && [ "${boot1Search:180:12}" == "424f4f542020" ] && [ "${boot1Search:1020:2}" == "55" ]; then
#echo "DEBUG: boot1f32 found on "$targetDiskRaw
(( stagesFound++ ))
stage1Existence="boot1f32"
fi
# Check for existing stage 2 boot file.
# Include checking the EFI system partition if it exists and is mounted.
if [ -e "$( df | grep ${targetDisk}s${i} | awk '{ print $6 }' )"/boot ]; then
#echo "DEBUG: boot found on $targetDiskRaw"
(( stagesFound++ ))
stage2Existence=1
fi
"$scriptDir"InstallLog.sh "${installerVolume}" "${message}"
fi
# User could see a b1f:error or boot0:error if the following conditions are true:
# A) Boot0hfs, Boot0md or Boot0md (dmazar's Boot0workV2) is being used.
# B) The previous stage 1 code is on a lower partiton than the one being installed to now.
if [ $stagesFound == 2 ] && [ $stage2Existence == 0 ]; then
# Exisitng boot0 and boot1 only found - missing boot
"$scriptDir"InstallLog.sh "${installerVolume}" "INFO: Found $stage1Existence installed to ${targetDisk}s${i}"
# stage0type=2 is used to know if 'A' is true.
if [ $stage0type == 2 ]; then
# i = current slice we're checking, slicenumber = slice trying to install to.
---"
"$scriptDir"InstallLog.sh "${installerVolume}" "${message}"
# /Volumes/EFI needs unmounting before changing partition boot sector
if [ $i == 1 ]; then
umount /Volumes/EFI
fi
if [ "$( fstyp "${targetDisk}"s1 | grep hfs )" ]; then
#echo "DEBUG: HFS - changing byte 1FEh to 00"
dd if=${targetDisk}s${i} count=2 bs=512 of=originalBootSector
cp originalBootSector newBootSector
dd if="patch" of=newBootSector bs=1 count=1 seek=510 conv=notrunc
dd if=newBootSector of=${targetDisk}s${i} count=2 bs=510
if [ "$( fstyp "${targetDisk}"s1 | grep hfs )" ]; then
#echo "DEBUG: HFS - changing byte 1FEh to 00"
dd if=${targetDisk}s${i} count=2 bs=512 of=originalBootSector
cp originalBootSector newBootSector
dd if="patch" of=newBootSector bs=1 count=1 seek=510 conv=notrunc
dd if=newBootSector of=${targetDisk}s${i} count=2 bs=510
fi
if [ "$( fstyp "${targetDisk}"s1 | grep msdos )" ]; then
#echo "DEBUG: MSDOS - changing byte 1FEh to 00"
dd if=${targetDisk}s${i} count=1 bs=512 of=/tmp/originalBootSector
cp /tmp/originalBootSector /tmp/newBootSector
dd if="$scriptDir/patch" of=/tmp/newBootSector bs=1 count=1 seek=510 conv=notrunc
dd if=/tmp/newBootSector of=${targetDisk}s${i} count=1 bs=512
fi
# /Volumes/EFI needs re-mounting so EFI/postinstall script can use it.
# Don't check for a GPT as wouldn't have got here if it wasn't
"$scriptDir"MountESP.sh "${targetDisk}" "${installerVolume}" "${scriptDir}"
fi
if [ "$( fstyp "${targetDisk}"s1 | grep msdos )" ]; then
#echo "DEBUG: MSDOS - changing byte 1FEh to 00"
dd if=${targetDisk}s${i} count=1 bs=512 of=/tmp/originalBootSector
cp /tmp/originalBootSector /tmp/newBootSector
dd if="$scriptDir/patch" of=/tmp/newBootSector bs=1 count=1 seek=510 conv=notrunc
dd if=/tmp/newBootSector of=${targetDisk}s${i} count=1 bs=512
fi
mountESP
else
"$scriptDir"InstallLog.sh "${installerVolume}" "INFO: but won't interfere as you're installing to an earlier partition."
fi
branches/blackosx/package/Scripts/Sub/MountESP.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
41
42
#!/bin/bash
echo "==============================================="
echo "MountESP: Mount the EFI system partition"
echo "***********************************************"
# Creates a mountpoint and mounts /Volumes/EFI of the
# supplied disk which would have been pre-checked as using a GPT
# Receives targetDisk: for example /dev/disk2.
# Receives installerVolume: Volume to write the installer log to.
# Receives scriptDir: The location of the main script dir.
if [ "$#" -eq 3 ]; then
targetDisk="$1"
installerVolume="$2"
scriptDir="$3"
echo "DEBUG: passed argument for targetDisk = $targetDisk"
echo "DEBUG: passed argument for installerVolume = $installerVolume"
echo "DEBUG: passed argument for scriptDir = $scriptDir"
else
echo "Error - wrong number of values passed"
exit 9
fi
# Does the mountpoint exist?
if [ ! -e "/Volumes/EFI" ]; then
mkdir -p "/Volumes/EFI"
fi
# Mount '/Volumes/EFI' using the correct format type
if [ "$( fstyp "${targetDisk}"s1 | grep hfs )" ]; then
"$scriptDir"InstallLog.sh "${installerVolume}" "Mounting ${targetDisk}s1 as /Volumes/EFI"
mount_hfs "${targetDisk}"s1 "/Volumes/EFI"
fi
if [ "$( fstyp "${targetDisk}"s1 | grep msdos )" ]; then
"$scriptDir"InstallLog.sh "${installerVolume}" "Mounting ${targetDisk}s1 as /Volumes/EFI"
mount_msdos -u 0 -g 0 "${targetDisk}"s1 "/Volumes/EFI"
fi
exit 0
branches/blackosx/package/Scripts/Sub/UnMountEFIvolumes.sh
66
77
88
9
9
1010
1111
1212
......
2323
2424
2525
26
2726
2827
2928
3029
3130
3231
33
3432
3533
3634
# loop through and un-mount ALL mounted 'EFI' system partitions - Thanks kizwan
# Receives targetVolumeChosenByUser: Stores original target if EFI install selected.
# Receives targetVolumeChosenByUser: To write install log to.
# Receives scriptDir: The location of the main script dir.
if [ "$#" -eq 2 ]; then
# be unmounted in which case the loop would run forever.
attempts=1
while [ "$( df | grep EFI )" ] && [ $attempts -lt 5 ]; do
#echo "DEBUG: Unmounting $( df | grep EFI | awk '{print $1}' )"
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Volume named 'EFI' is mounted..."
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Unmounting $( df | grep EFI | awk '{print $1}' )"
umount -f $( df | grep EFI | awk '{print $1}' )
(( attempts++ ))
done
if [ $attempts = 5 ]; then
#echo "DEBUG: failed to unmount 'EFI' System Partition."
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Failed to unmount 'EFI' System Partition."
exit 1
fi

Archive Download the corresponding diff file

Revision: 1637