Chameleon

Chameleon Commit Details

Date:2011-09-28 19:12:18 (12 years 6 months ago)
Author:blackosx
Commit:1584
Parents: 1583
Message:More tweaks.
Changes:
M/branches/blackosx/package/Scripts/Main/EFI/postinstall
M/branches/blackosx/package/Scripts/Main/Post/postinstall
M/branches/blackosx/package/Scripts/Sub/InstallLog.sh

File differences

branches/blackosx/package/Scripts/Main/EFI/postinstall
144144
145145
146146
147
148
147
148
149149
150150
151151
......
163163
164164
165165
166
167
166
167
168168
169169
170170
......
194194
195195
196196
197
197
198198
199199
200200
if [ ${returnValue} = 0 ]; then
# OK to proceed
# Append a line break to the installer log
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Line Break"
# Append a LineBreak to the installer log
"$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 2 loader to the root of the selected partition
"$scriptDir"WriteChameleonStage2.sh "${espformat}" "${stage2Loader}" "${targetVolume}" "${targetDevice}" "${targetVolumeChosenByUser}" "${scriptDir}"
# Append a line break to the installer log
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Line Break"
# 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 "${espformat}" "${diskSigCheck}" "${targetDiskRaw}" "${targetSlice}" "${targetVolumeChosenByUser}" "${scriptDir}"
# boot option scripts than EFI (ESP) option was chosen
echo "EFI" >"${targetVolumeChosenByUser}"/.ChameleonEFI
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Line Break"
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "LineBreak"
"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "EFI script complete"
echo "==============================================="
branches/blackosx/package/Scripts/Main/Post/postinstall
3333
3434
3535
36
37
38
39
40
41
42
43
3644
37
45
3846
39
47
48
49
50
51
4052
4153
4254
4355
4456
45
46
57
4758
48
49
50
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
5175
76
5277
53
54
78
5579
5680
5781
5882
5983
6084
61
62
63
6485
6586
66
87
6788
6889
6990
70
91
7192
7293
7394
7495
75
96
97
98
7699
77100
78101
79102
80
81
82
83
103
104
105
106
107
108
84109
85
86
87
88
89
90
91
92110
93111
94112
95113
96
97
98
99
114
100115
101
116
102117
103
104
118
105119
106120
107121
......
117131
118132
119133
120
134
121135
122136
123137
......
125139
126140
127141
128
142
129143
130144
131145
132146
133147
134148
135
136
137
138
139
149
150
151
152
153
140154
141155
142156
......
157171
158172
159173
160
174
161175
176
177
162178
163179
dest_vol="$3"
fi
# ---------------------------------------------
# Get location of this script so we know where
# to find the Install Log script.
# ---------------------------------------------
MYLOCATION="${PWD}/${BASH_ARGV[0]}"
export MYLOCATION="${MYLOCATION%/*}"
scriptDir=$MYLOCATION
# set temporary directory
chamTemp="$dest_vol/usr/local/chamTemp" #blackosx added
chamTemp="$dest_vol/usr/local/chamTemp"
# Check for temporary directory/Extra folder.
# Write script information to the Install Log
"$scriptDir"InstallLog.sh "${dest_vol}" "Running Post postinstall script"
Check for temporary directory/Extra folder.
if [ ! -d "$chamTemp"/Extra ]; then
mkdir "$chamTemp"/Extra
fi
# ---------------------------------------------
# Get location of this script so we know where
# to find the Install Log script.
# Add any installed modules to the Install Log
# ---------------------------------------------
MYLOCATION="${PWD}/${BASH_ARGV[0]}"
export MYLOCATION="${MYLOCATION%/*}"
scriptDir=$MYLOCATION
if [ -e "${chamTemp}"/Extra/modules ]; then
ls "${chamTemp}"/Extra/modules | while read FILE
do
"$scriptDir"InstallLog.sh "${dest_vol}" "Installed module:$FILE"
done
fi
# ---------------------------------------------
# Add any installed themes to the Install Log
# ---------------------------------------------
if [ -e "${chamTemp}"/Extra/Themes ]; then
ls "${chamTemp}"/Extra/Themes | while read FILE
do
"$scriptDir"InstallLog.sh "${dest_vol}" "Installed Theme:$FILE"
done
fi
# ---------------------------------------------
# Build boot options / Kernel Flags.
# NEEDS MORE WORK!!!!!!!!!!!!
# Build org.chameleon.Boot.plist
# ---------------------------------------------
# All options selected are now dummy files with
# the filename of the option and value residing
# in /usr/local/chamTemp/options/
# for example. Boot Banner=Yes
# Write some information to the Install Log
"$scriptDir"InstallLog.sh "${3}" "Running Post postinstall script"
# Create template for org.chameleon.Boot.plist"
tempOCBP="$chamTemp"/Extra/org.chameleon.Boot.plist
cp "$dest_vol"/Library/Preferences/SystemConfiguration/com.apple.Boot.plist "$tempOCBP"
cp "$4"/Library/Preferences/SystemConfiguration/com.apple.Boot.plist "$tempOCBP"
# Read list of all boot options the user added.
arrayCount=0
find ${chamTemp}/options | while read FILE
ls "${chamTemp}"/options | while read FILE
do
options[arrayCount]="${FILE##*/}"
keyRead="${options[$arrayCount]%=*}"
value="${options[$arrayCount]#*=}"
echo "DEBUG: options: ${options[arrayCount]}"
# Check keyRead for 'KF' at beginning to
# indicate that should be a kernel flag
if [ ${keyRead:0:2} = "KF" ];then
kernelflag=${keyRead#*F }=$value
# write value to org.chameleon.Boot.plist
# but skip first one as that will be 'options'
if [ $arrayCount -gt 0 ]; then
sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelflag" "$tempOCBP"
"$scriptDir"InstallLog.sh "${dest_vol}" "Add kernel flag: ${kernelflag}"
returnValue=$?
if [ ${returnValue}=1 ]; then
# Delete it for now, but need to append as more kernel flags could be added in future!!
sudo /usr/libexec/plistbuddy -c "Delete :Kernel\ Flags" "$tempOCBP"
sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelflag" "$tempOCBP"
"$scriptDir"InstallLog.sh "${3}" "Add kernel flag: ${kernelflag}"
returnValue=$?
if [ ${returnValue}=1 ]; then
# Delete it for now, but need to append as more kernel flags could be added in future!!
sudo /usr/libexec/plistbuddy -c "Delete :Kernel\ Flags" "$tempOCBP"
sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelflag" "$tempOCBP"
fi
fi
else
# escape any spaces
keyToUse=$( echo $keyRead | sed 's/ /\\ /g' )
# write value to org.chameleon.Boot.plist
# but skip first one as that will be 'options'
if [ $arrayCount -gt 0 ]; then
echo "Add :${keyToUse} string ${value}"
if [ ${keyToUse} != "DONT" ] && [ ${value} != "USE" ]; then
sudo /usr/libexec/plistbuddy -c "Add :${keyToUse} string ${value}" "$tempOCBP"
"$scriptDir"InstallLog.sh "${3}" "Add boot option: ${keyToUse}=${value}"
"$scriptDir"InstallLog.sh "${dest_vol}" "Add boot option: ${keyToUse}=${value}"
fi
fi
fi
(( arrayCount++ ))
done
if [ ! -e "$dest_vol"/Extra ]; then
mkdir "$dest_vol"/Extra
else
"$scriptDir"InstallLog.sh "${3}" "Found existing $dest_vol/Extra folder. Renaming it $dest_vol/Extra-OLD-$( date "+%H-%M-%S" )"
"$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" )
fi
cp -R "$chamTemp"/Extra "$dest_vol"
if [ ! -e "/Volumes/EFI/Extra" ]; then
mkdir "/Volumes/EFI/Extra"
else
"$scriptDir"InstallLog.sh "${3}" "Found existing /Volumes/EFI/Extra folder. Renaming it Extra-OLD-$( date "+%H-%M-%S" )"
"$scriptDir"InstallLog.sh "${dest_vol}" "Found existing /Volumes/EFI/Extra folder. Renaming it Extra-OLD-$( date "+%H-%M-%S" )"
mv "/Volumes/EFI/Extra" "/Volumes/EFI/Extra_OLD-"$( date "+%H-%M-%S" )
fi
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}' )"
umount -f $( df | grep EFI | awk '{print $1}' )
attempts=$(( ${attempts} + 1 ))
done
while [ "$( df | grep EFI )" ] && [ "${attempts}" -lt 5 ]; do
echo "Unmounting $( df | grep EFI | awk '{print $1}' )"
umount -f $( df | grep EFI | awk '{print $1}' )
attempts=$(( ${attempts} + 1 ))
done
fi
# delete the temporary Chameleon folder
echo "Removing $chamTemp file"
#rm -rf "$chamTemp"
rm -rf "$chamTemp"
"$scriptDir"InstallLog.sh "${dest_vol}" "LineBreak"
"$scriptDir"InstallLog.sh "${dest_vol}" "Post script complete"
echo "Done..."
branches/blackosx/package/Scripts/Sub/InstallLog.sh
5454
5555
5656
57
58
59
57
6058
6159
6260
else
# Append messages to the log as passed by other scripts.
if [ "${verboseText}" = "LineBreak" ]; then
echo "
======================================================
" >>"${logFile}"
echo "======================================================" >>"${logFile}"
fi
if [[ "${verboseText}" == *fdisk* ]]; then

Archive Download the corresponding diff file

Revision: 1584