Chameleon Applications

Chameleon Applications Commit Details

Date:2011-05-20 05:11:51 (12 years 10 months ago)
Author:ErmaC
Commit:274
Parents: 273
Message:Play a bit with the script. Pretty print and printout.
Changes:
M/branches/iFabio/Chameleon/package/buildpkg

File differences

branches/iFabio/Chameleon/package/buildpkg
88
99
1010
11
12
13
14
15
16
17
18
19
20
1121
1222
1323
......
2939
3040
3141
32
33
42
43
44
3445
3546
3647
3748
38
49
3950
4051
4152
42
4353
44
4554
4655
4756
......
5261
5362
5463
55
56
5764
5865
5966
60
61
62
67
68
6369
64
6570
71
6672
6773
6874
......
7177
7278
7379
74
75
80
81
7682
7783
7884
......
8086
8187
8288
83
84
89
90
8591
8692
8793
8894
89
90
95
96
9197
9298
9399
......
95101
96102
97103
104
98105
99106
100107
......
108115
109116
110117
111
112
118
119
113120
114121
115122
116123
117124
118
119
125
126
120127
121128
122129
123130
124131
125
126
132
133
127134
128135
129136
......
131138
132139
133140
134
135
136
141
142
137143
138144
139145
......
141147
142148
143149
150
144151
145152
146153
......
154161
155162
156163
157
158
164
165
159166
160167
161168
162169
170
163171
164172
165173
......
170178
171179
172180
173
174
181
182
175183
176184
177185
......
179187
180188
181189
190
182191
183192
184193
......
190199
191200
192201
193
194
202
203
195204
196205
197206
......
204213
205214
206215
216
207217
208218
209219
......
217227
218228
219229
220
221
230
231
222232
223233
224234
......
226236
227237
228238
229
239
240
230241
231242
232243
......
240251
241252
242253
243
244
254
255
245256
246257
247258
......
252263
253264
254265
255
266
267
256268
257269
258270
259
271
272
260273
261274
262275
......
375388
376389
377390
391
378392
379393
380394
......
385399
386400
387401
388
402
389403
390404
391405
......
393407
394408
395409
396
397
410
411
398412
399413
400414
401415
402
403
416
417
418
419
420
421
422
423
424
425
426
427
428
429
404430
405431
406432
pkgroot="${0%/*}"
COL_BLACK="\x1b[30;01m"
COL_RED="\x1b[31;01m"
COL_GREEN="\x1b[32;01m" #COL_GREEN="\x1b[32;01m"
COL_YELLOW="\x1b[33;01m"
COL_MAGENTA="\x1b[35;01m"
COL_CYAN="\x1b[36;01m"
COL_WHITE="\x1b[37;01m"
COL_BLUE="\x1b[34;01m"
COL_RESET="\x1b[39;49;00m"
#version=$( grep I386BOOT_CHAMELEONVERSION sym/i386/vers.h | awk '{ print $3 }' | tr -d '\"' )
version=$( cat version )
stage=${version##*-}
# clean up the destination path
rm -R -f "${1}"
echo "Building $packagename Install Package v${version%%-*} $stage r$revision $builddate"
echo ""
echo -e $COL_BLACK"Building $packagename Install Package"$COL_RESET
echo ""
outline[$((outlinecount++))]="${indent[$xmlindent]}<choices-outline>"
# build core package
echo "================= core ================="
((xmlindent++))
packagesidentity="org.chameleon"
mkdir -p ${1}/Core/Root/usr/sbin
#mkdir -p ${1}/Core/Root/usr/local/bin
mkdir -p ${1}/Core/Root/usr/standalone/i386
#mkdir -p ${1}/Core/Root/Extra
cp -f ${1%/*}/i386/boot ${1}/Core/Root/usr/standalone/i386
cp -f ${1%/*}/i386/boot0 ${1}/Core/Root/usr/standalone/i386
cp -f ${1%/*}/i386/boot0hfs ${1}/Core/Root/usr/standalone/i386
cp -f ${1%/*}/i386/cdboot ${1}/Core/Root/usr/standalone/i386
cp -f ${1%/*}/i386/chain0 ${1}/Core/Root/usr/standalone/i386
fixperms "${1}/Core/Root/"
#cp -Rf ${pkgroot}/Configuration/Chameleon.prefPane ${1}/Core/Root/Library/PreferencePanes
#cp -f ${pkgroot}/Configuration/smbios.plist ${1}/Core/Root/Extra
cp -f ${pkgroot}/fdisk ${1}/Core/Root/usr/sbin
cp -f ${1%/*}/i386/bdmesg ${1}/Core/Root/usr/sbin
local coresize=$( du -hkc "${1}/Core/Root" | tail -n1 | awk {'print $1'} )
echo "Building core package"
buildpackage "${1}/Core" "/tmpcham" "0" "start_visible=\"false\" start_selected=\"true\""
#buildpackage "${1}/Core" "/" "0" "start_visible=\"true\" start_selected=\"true\""
echo "[BUILD] core "
buildpackage "${1}/Core" "/tmpcham" "0" "start_visible=\"false\" start_selected=\"true\"" >/dev/null 2>&1
# build Chameleon package
echo "================= Chameleon ================="
outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Chameleon\">"
choices[$((choicescount++))]="<choice\n\tid=\"Chameleon\"\n\ttitle=\"Chameleon_title\"\n\tdescription=\"Chameleon_description\"\n>\n</choice>\n"
mkdir -p ${1}/Standard/Scripts/Tools
cp -f ${pkgroot}/Scripts/Standard/* ${1}/Standard/Scripts
ditto --arch i386 `which SetFile` ${1}/Standard/Scripts/Tools/SetFile
echo "Building standard package"
buildpackage "${1}/Standard" "/tmpcham" "${coresize}" "start_enabled=\"true\" start_selected=\"upgrade_allowed()\" selected=\"exclusive(choices['EFI']) &amp;&amp; exclusive(choices['noboot'])\""
echo "[BUILD] standard "
buildpackage "${1}/Standard" "/tmpcham" "${coresize}" "start_enabled=\"true\" start_selected=\"upgrade_allowed()\" selected=\"exclusive(choices['EFI']) &amp;&amp; exclusive(choices['noboot'])\"" >/dev/null 2>&1
# End build standard package
# build efi package
mkdir -p ${1}/EFI/Scripts/Tools
cp -f ${pkgroot}/Scripts/EFI/* ${1}/EFI/Scripts
ditto --arch i386 `which SetFile` ${1}/EFI/Scripts/Tools/SetFile
echo "Building efi package"
buildpackage "${1}/EFI" "/tmpcham" "${coresize}" "start_visible=\"systemHasGPT()\" start_selected=\"false\" selected=\"exclusive(choices['Standard']) &amp;&amp; exclusive(choices['noboot'])\""
echo "[BUILD] EFI "
buildpackage "${1}/EFI" "/tmpcham" "${coresize}" "start_visible=\"systemHasGPT()\" start_selected=\"false\" selected=\"exclusive(choices['Standard']) &amp;&amp; exclusive(choices['noboot'])\"" >/dev/null 2>&1
# End build efi package
# build reset choice package
mkdir -p ${1}/noboot/Root
echo "Building reset choice package"
buildpackage "${1}/noboot" "/tmpcham" "" "start_visible=\"true\" start_selected=\"false\" selected=\"exclusive(choices['Standard']) &amp;&amp; exclusive(choices['EFI'])\""
echo "[BUILD] Reset choice "
buildpackage "${1}/noboot" "/tmpcham" "" "start_visible=\"true\" start_selected=\"false\" selected=\"exclusive(choices['Standard']) &amp;&amp; exclusive(choices['EFI'])\"" >/dev/null 2>&1
# End build reset choice package
((xmlindent--))
# End build Chameleon package
# build Extras package
echo "================= Extras ================="
outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Extras\">"
choices[$((choicescount++))]="<choice\n\tid=\"Extras\"\n\ttitle=\"Extras_title\"\n\tdescription=\"Extras_description\"\n>\n</choice>\n"
((xmlindent++))
# build package for Chameleon PrefPanel
mkdir -p "${1}/PrefPanel/Root/"
ditto --noextattr --noqtn "${pkgroot}/Configuration/PrefPanel/Chameleon.prefPane" "${1}/PrefPanel/Root"
echo "Building Chameleon Preference Panel package"
buildpackage "${1}/PrefPanel" "/Library/PreferencePanes/Chameleon.prefPane" "" "start_selected=\"false\""
echo "[BUILD] Chameleon Preference Panel "
buildpackage "${1}/PrefPanel" "/Library/PreferencePanes/Chameleon.prefPane" "" "start_selected=\"false\"" >/dev/null 2>&1
# End build package for Chameleon PrefPanel
# build package for SMBIOSDefault
mkdir -p "${1}/SMBIOSDefault/Root/"
ditto --noextattr --noqtn "${pkgroot}/Configuration/SMBIOSDefault/smbios.plist" "${1}/SMBIOSDefault/Root"
echo "Building SMBIOSDefault package"
buildpackage "${1}/SMBIOSDefault" "/Extra/Example" "" "start_selected=\"false\""
echo "[BUILD] SMBIOSDefault "
buildpackage "${1}/SMBIOSDefault" "/Extra/Example" "" "start_selected=\"false\"" >/dev/null 2>&1
# End build package for SMBIOSDefault
# build package for EFIMounter
mkdir -p "${1}/EFIMounter/Root/"
ditto --noextattr --noqtn "${pkgroot}/Configuration/EFIMounter/EFI Mounter.app" "${1}/EFIMounter/Root"
echo "Building EFIMounter package"
buildpackage "${1}/EFIMounter" "/Applications/EFI Mounter.app" "" "start_selected=\"false\""
echo "[BUILD] EFIMounter "
buildpackage "${1}/EFIMounter" "/Applications/EFI Mounter.app" "" "start_selected=\"false\"" >/dev/null 2>&1
# End build package for EFIMounter
# build package for Documentation
cp -f ${pkgroot}/doc/BootHelp.txt ${1}/Documentation/Root
cp -f ${pkgroot}/doc/README ${1}/Documentation/Root
cp -f ${pkgroot}/doc/Users_Guide0.5.pdf ${1}/Documentation/Root
echo "Building Documentation package"
#buildpackage "${1}/Documentation" "/Documentation/Chameleon2RC5" "" "start_selected=\"false\""
buildpackage "${1}/Documentation" "/Library/Documentation/Chameleon2RC5" "" "start_selected=\"false\""
echo "[BUILD] Documentation "
buildpackage "${1}/Documentation" "/Library/Documentation/Chameleon2RC5" "" "start_selected=\"false\"" >/dev/null 2>&1
# End build package for Documentation
((xmlindent--))
# End utility package
# build options packages
echo "================= Options ================="
outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Options\">"
choices[$((choicescount++))]="<choice\n\tid=\"Options\"\n\ttitle=\"Options_title\"\n\tdescription=\"Options_description\"\n>\n</choice>\n"
((xmlindent++))
mkdir -p "${1}/${options[$i]##*/}/Root"
mkdir -p "${1}/${options[$i]##*/}/Scripts"
ditto --noextattr --noqtn "${options[$i]}/postinstall" "${1}/${options[$i]##*/}/Scripts/postinstall"
echo "Building ${options[$i]##*/} package"
buildpackage "${1}/${options[$i]##*/}" "/tmpcham" "" "start_selected=\"false\""
echo "[BUILD] ${options[$i]##*/} "
buildpackage "${1}/${options[$i]##*/}" "/tmpcham" "" "start_selected=\"false\"" >/dev/null 2>&1
done
# End build base options packages
# build resolution packages
echo "================= Res. Options ================="
outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Resolution\">"
choices[$((choicescount++))]="<choice\n\tid=\"Resolution\"\n\ttitle=\"Resolution_title\"\n\tdescription=\"Resolution_description\"\n>\n</choice>\n"
((xmlindent++))
mkdir -p "${1}/${resolutions[$i]##*/}/Root/"
mkdir -p "${1}/${resolutions[$i]##*/}/Scripts/"
ditto --noextattr --noqtn "${resolutions[$i]}/postinstall" "${1}/${resolutions[$i]##*/}/Scripts/postinstall"
echo "Building ${resolutions[$i]##*/} package"
buildpackage "${1}/${resolutions[$i]##*/}" "/tmpcham" "" "start_selected=\"false\""
echo "[BUILD] ${resolutions[$i]##*/} "
buildpackage "${1}/${resolutions[$i]##*/}" "/tmpcham" "" "start_selected=\"false\"" >/dev/null 2>&1
done
((xmlindent--))
# End build resolution packages
# build Advanced packages
echo "================= Adv. Options ================="
outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Advanced\">"
choices[$((choicescount++))]="<choice\n\tid=\"Advanced\"\n\ttitle=\"Advanced_title\"\n\tdescription=\"Advanced_description\"\n>\n</choice>\n"
((xmlindent++))
mkdir -p "${1}/${optionsadv[$i]##*/}/Root"
mkdir -p "${1}/${optionsadv[$i]##*/}/Scripts"
ditto --noextattr --noqtn "${optionsadv[$i]}/postinstall" "${1}/${optionsadv[$i]##*/}/Scripts/postinstall"
echo "Building ${optionsadv[$i]##*/} package"
buildpackage "${1}/${optionsadv[$i]##*/}" "/tmpcham" "" "start_selected=\"false\""
echo "[BUILD] ${optionsadv[$i]##*/} "
buildpackage "${1}/${optionsadv[$i]##*/}" "/tmpcham" "" "start_selected=\"false\"" >/dev/null 2>&1
done
((xmlindent--))
# End build options packages
# build theme packages
echo "================= Themes ================="
outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Themes\">"
choices[$((choicescount++))]="<choice\n\tid=\"Themes\"\n\ttitle=\"Themes_title\"\n\tdescription=\"Themes_description\"\n>\n</choice>\n"
((xmlindent++))
ditto --noextattr --noqtn "${themes[$i]}" "${1}/${themes[$i]##*/}/Root/${theme}"
find "${1}/${themes[$i]##*/}" -name '.DS_Store' -or -name '.svn' -exec rm -R {} \+
find "${1}/${themes[$i]##*/}" -type f -exec chmod 644 {} \+
echo "Building ${themes[$i]##*/} package"
buildpackage "${1}/${theme}" "/Extra/Themes" "" "start_selected=\"false\""
echo "[BUILD] ${themes[$i]##*/} "
buildpackage "${1}/${theme}" "/Extra/Themes" "" "start_selected=\"false\"" >/dev/null 2>&1
rm -R -f "${1}/${i##*/}"
done
outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
# End build theme packages
# build kext packages
# build kext packages
echo "================= Kexts ================="
outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Kexts\">"
choices[$((choicescount++))]="<choice\n\tid=\"Kexts\"\n\ttitle=\"Kexts_title\"\n\tdescription=\"Kexts_description\"\n>\n</choice>\n"
((xmlindent++))
find "${1}/${filename%.kext}" -name '.DS_Store' -or -name '.svn' -exec rm -R -f {} \; 2>/dev/null
fixperms "${1}/${filename%.kext}/Root/"
chown 501:20 "${1}/${filename%.kext}/Root/"
echo "Building ${filename%.kext} package"
buildpackage "${1}/${filename%.kext}" "/Extra/Extensions" "" "start_selected=\"false\""
echo "[BUILD] ${filename%.kext} "
buildpackage "${1}/${filename%.kext}" "/Extra/Extensions" "" "start_selected=\"false\"" >/dev/null 2>&1
rm -R -f "${1}/${filename%.kext}"
done
((xmlindent--))
outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
# End build Extras package
# build post install package
# build post install package
echo "================= Post ================="
mkdir -p ${1}/Post/Root
mkdir -p ${1}/Post/Scripts
cp -f ${pkgroot}/Scripts/Post/* ${1}/Post/Scripts
buildpackage "${1}/Post" "/tmpcham" "" "start_visible=\"false\" start_selected=\"true\""
echo "[BUILD] Post "
buildpackage "${1}/Post" "/tmpcham" "" "start_visible=\"false\" start_selected=\"true\"" >/dev/null 2>&1
outline[$((outlinecount++))]="${indent[$xmlindent]}</choices-outline>"
# build meta package
perl -i -p -e "s/%CHAMELEONVERSION%/${version%%-*}/g" `find "${1}/${packagename}/Resources" -type f`
perl -i -p -e "s/%CHAMELEONREVISION%/${revision}/g" `find "${1}/${packagename}/Resources" -type f`
# Adding Package type test (not translated)
#perl -i -p -e "s/%PKGTYPE%/TEST/g" `find "${1}/${packagename}/Resources" -type f`
#
find "${1}/${packagename}" -name '.DS_Store' -delete
pushd "${1}/${packagename}" >/dev/null
xar -c -f "${1%/*}/${packagename// /}-${version}-INSTALLER-r${revision}.pkg" --compression none .
xar -c -f "${1%/*}/${packagename// /}-${version}-r${revision}.pkg" --compression none .
popd >/dev/null
# Here is the place for assign a Icon to the pkg
# ditto -c -k --sequesterRsrc --keepParent Icon.icns Icon.zip
ditto -xk "${pkgroot}/Icon.zip" "${pkgroot}/"
DeRez -only icns "${pkgroot}/Icon/Icon.icns" > tempicns.rsrc
Rez -append tempicns.rsrc -o "${1%/*}/${packagename// /}-${version}-INSTALLER-r${revision}.pkg"
SetFile -a C "${1%/*}/${packagename// /}-${version}-INSTALLER-r${revision}.pkg"
Rez -append tempicns.rsrc -o "${1%/*}/${packagename// /}-${version}-r${revision}.pkg"
SetFile -a C "${1%/*}/${packagename// /}-${version}-r${revision}.pkg"
rm -f tempicns.rsrc
rm -rf "${pkgroot}/Icon"
# End
md5=$( md5 "${1%/*}/${packagename// /}-${version}-INSTALLER-r${revision}.pkg" | awk {'print $4'} )
echo "MD5 (${packagename// /}-${version}-INSTALLER-r${revision}.pkg) = ${md5}" > "${1%/*}/${packagename// /}-${version}-INSTALLER-r${revision}.pkg.md5"
md5=$( md5 "${1%/*}/${packagename// /}-${version}-r${revision}.pkg" | awk {'print $4'} )
echo "MD5 (${packagename// /}-${version}-r${revision}.pkg) = ${md5}" > "${1%/*}/${packagename// /}-${version}-r${revision}.pkg.md5"
echo ""
echo -e $COL_BLACK"Building process complete!"$COL_RESET
echo ""
echo -e $COL_BLACK"Build info."
echo -e $COL_BLACK"==========="
echo -e $COL_BLUE"Package name:"$COL_BLACK"$packagename-${version}-r$revision.pkg"$COL_RESET
echo -e $COL_BLUE"MD5:"$COL_BLACK"$md5"$COL_RESET
echo -e $COL_BLUE"Version:"$COL_BLACK"$version"$COL_RESET
echo -e $COL_BLUE"Stage:"$COL_BLACK"$stage"$COL_RESET
echo -e $COL_BLUE"Date/Time:"$COL_BLACK"$builddate"$COL_RESET
echo ""
}
main "${1}" "${2}" "${3}" "${4}" "${5}"

Archive Download the corresponding diff file

Revision: 274