Chameleon

Chameleon Commit Details

Date:2011-09-28 09:30:12 (8 years 4 months ago)
Author:blackosx
Commit:1583
Parents: 1582
Message:Some early morning tweaks to building the org.Chameleon.Boot.plist and passing messages to the install log.
Changes:
M/branches/blackosx/package/buildpkg.sh
M/branches/blackosx/package/Scripts/Main/Post/postinstall
M/branches/blackosx/package/Scripts/Sub/InstallLog.sh
M/branches/blackosx/package/Scripts/Main/Standard/postinstall

File differences

branches/blackosx/package/Scripts/Main/Standard/postinstall
145145
146146
147147
148
148
149149
150150
151151
......
162162
163163
164164
165
165
166166
167167
168168
......
170170
171171
172172
173
173
174174
175175
176176
# Continue if the selected device is not a FAT16 format device
# Append a line break to the installer log
"$scriptDir"InstallLog.sh "${targetVolume}" "Line Break"
"$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak"
if [ ${diskupdate} = "0" ]; then
# Write the stage 0 loader to the MBR
"$scriptDir"WriteChameleonStage2.sh "${espformat}" "${stage2Loader}" "${3}" "${targetDevice}" "${targetVolume}" "${scriptDir}"
# Append a line break to the installer log
"$scriptDir"InstallLog.sh "${targetVolume}" "Line Break"
"$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak"
# Set the active partition ONLY if Windows is not installed
"$scriptDir"SetActivePartition.sh "${espformat}" "${diskSigCheck}" "${targetDiskRaw}" "${targetSlice}" "${targetVolume}" "${scriptDir}"
fi
fi
"$scriptDir"InstallLog.sh "${targetVolume}" "Line Break"
"$scriptDir"InstallLog.sh "${targetVolume}" "LineBreak"
"$scriptDir"InstallLog.sh "${targetVolume}" "Standard script complete"
echo "==============================================="
branches/blackosx/package/Scripts/Main/Post/postinstall
4141
4242
4343
44
45
46
47
48
49
50
4451
4552
46
53
4754
4855
4956
......
5158
5259
5360
61
62
63
5464
5565
5666
......
6171
6272
6373
64
6574
6675
6776
......
7382
7483
7584
85
86
87
88
89
90
91
7692
7793
7894
7995
80
8196
8297
8398
84
99
100
101
85102
86103
87
88
104
105
89106
90107
91108
92109
93110
94111
112
95113
96114
115
97116
98
117
99118
119
120
121
100122
101
123
102124
103
125
104126
127
128
129
105130
106
131
107132
108133
109134
......
132157
133158
134159
135
160
136161
137162
138163
mkdir "$chamTemp"/Extra
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
# ---------------------------------------------
# Blackosx - Build boot options / Kernel Flags.
# Build boot options / Kernel Flags.
# NEEDS MORE WORK!!!!!!!!!!!!
# ---------------------------------------------
# All options selected are now dummy files with
# 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"
do
options[arrayCount]="${FILE##*/}"
keyRead="${options[$arrayCount]%=*}"
value="${options[$arrayCount]#*=}"
# Check keyRead for 'KF' at beginning to
# 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 "${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
sudo /usr/libexec/plistbuddy -c "Add :$keyToUse string $value" "$tempOCBP"
echo "Add :${keyToUse} string ${value}"
sudo /usr/libexec/plistbuddy -c "Add :${keyToUse} string ${value}" "$tempOCBP"
"$scriptDir"InstallLog.sh "${3}" "Add boot option: ${keyToUse}=${value}"
fi
fi
arrayCount=$(( ${arrayCount} + 1 ))
(( arrayCount++ ))
done
# ---------------------------------------------
# Copy temp Extra folder to target destination
# ---------------------------------------------
# If an existing /Extra folder is found, then back it up.
# Extra folder now resides in /usr/local/chamTemp/
# Copy /usr/local/chamTemp/Extra to correct location.
if [ ! -f "$dest_vol"/.ChameleonEFI ]; then
if [ ! -f "$dest_vol"/Extra ]; then
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" )"
mv "$dest_vol/Extra" "$dest_vol/Extra_OLD-"$( date "+%H-%M-%S" )
fi
cp -R "$chamTemp"/Extra/* "$dest_vol"/Extra
cp -R "$chamTemp"/Extra "$dest_vol"
else
if [ ! -f "/Volumes/EFI/Extra" ]; then
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" )"
mv "/Volumes/EFI/Extra" "/Volumes/EFI/Extra_OLD-"$( date "+%H-%M-%S" )
fi
cp -R "$chamTemp"/Extra/* /Volumes/EFI/Extra
cp -R "$chamTemp"/Extra "/Volumes/EFI"
# unmount /Volumes/EFI
attempts=1
# delete the temporary Chameleon folder
echo "Removing $chamTemp file"
rm -rf "$chamTemp"
#rm -rf "$chamTemp"
echo "Done..."
branches/blackosx/package/Scripts/Sub/InstallLog.sh
5353
5454
5555
56
56
5757
5858
5959
......
6565
6666
6767
68
68
6969
7070
7171
echo "Log" >"${logLocation}"/.ChameleonLogFlag
else
# Append messages to the log as passed by other scripts.
if [ "${verboseText}" = "Line Break" ]; then
if [ "${verboseText}" = "LineBreak" ]; then
echo "
======================================================
" >>"${logFile}"
echo " " >>"${logFile}"
fi
if [ "${verboseText}" != "Line Break" ] && [[ "${verboseText}" != *fdisk* ]]; then
if [ "${verboseText}" != "LineBreak" ] && [[ "${verboseText}" != *fdisk* ]]; then
echo "${verboseText}" >> "${logFile}"
fi
fi
branches/blackosx/package/buildpkg.sh
288288
289289
290290
291
291292
292293
293294
......
298299
299300
300301
301
302
302303
303304
304305
......
418419
419420
420421
421
422
422423
423424
424425
......
455456
456457
457458
458
459
459460
460461
461462
mkdir -p ${1}/Post/Root
mkdir -p ${1}/Post/Scripts
cp -f ${pkgroot}/Scripts/Main/Post/* ${1}/Post/Scripts
cp -f ${pkgroot}/Scripts/Sub/InstallLog.sh ${1}/Post/Scripts
echo "[BUILD] Post "
buildpackage "${1}/Post" "/" "" "start_visible=\"false\" start_selected=\"true\"" >/dev/null 2>&1
outline[$((outlinecount++))]="${indent[$xmlindent]}</choices-outline>"
# clean up
rm -R -f "${1}"
#rm -R -f "${1}"
}
header+="auth=\"root\">\n"
header+="\t<payload installKBytes=\"${installedsize##* }\" numberOfFiles=\"${filecount##* }\"/>\n"
rm -R -f "${1}/Temp"
#rm -R -f "${1}/Temp"
[ -d "${1}/Temp" ] || mkdir -m 777 "${1}/Temp"
[ -d "${1}/Root" ] && mkbom "${1}/Root" "${1}/Temp/Bom"
fi
choices[$((choicescount++))]="<choice\n\tid=\"${packagename// /}\"\n\ttitle=\"${packagename}_title\"\n\tdescription=\"${packagename}_description\"\n${choiceoptions}>\n\t<pkg-ref id=\"${identifier}\" installKBytes='${installedsize}' version='${version}.0.0.${timestamp}' auth='root'>#${packagename// /}.pkg</pkg-ref>\n</choice>\n"
rm -R -f "${1}"
#rm -R -f "${1}"
fi
}

Archive Download the corresponding diff file

Revision: 1583