Chameleon Applications

Chameleon Applications Commit Details

Date:2011-07-20 02:33:50 (9 years 4 months ago)
Author:ErmaC
Commit:330
Parents: 329
Message:Minus update from latest main Chamleon trunk
Changes:
R/branches/iFabio/Chameleon/package/slimpkg → /branches/iFabio/Chameleon/package/slimpkg.sh
R/branches/iFabio/Chameleon/package/builddmg → /branches/iFabio/Chameleon/package/builddmg.sh
R/branches/iFabio/Chameleon/package/buildpkg → /branches/iFabio/Chameleon/package/buildpkg.sh
M/branches/iFabio/Chameleon/i386/libsaio/ati.c
M/branches/iFabio/Chameleon/CREDITS
M/branches/iFabio/Chameleon/Makefile

File differences

branches/iFabio/Chameleon/i386/libsaio/ati.c
448448
449449
450450
451
451452
452453
453454
......
11481149
11491150
11501151
1151
1152
1152
11531153
11541154
11551155
{ 0x68F9,0x5470174B, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5470",kNull},
{ 0x68F9,0x5490174B, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5490",kNull},
{ 0x68F9,0x5530174B, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5530",kNull},
{ 0x68F9, 0x20091787, CHIP_FAMILY_CEDAR, "ATI Radeon HD 5450", kEulemur },
/* Northen Islands */
{ 0x6718,0x0B001002,CHIP_FAMILY_CAYMAN,"AMD Radeon HD 6970",kNull},
if (!card->info->device_id || !card->info->cfg_name)
{
printf("Unsupported card!\nUse AtiConfig key to specify a framebuffer for your card.\nIf still unsupported, report dev id, subsys id and vendor.");
pause();
printf("Unsupported card!\n");
return false;
}
branches/iFabio/Chameleon/package/buildpkg
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
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
#!/bin/bash
# $1 Path to store built package
packagesidentity="org.chameleon"
packagename="Chameleon"
pkgroot="${0%/*}"
COL_BLACK="\x1b[30;01m"
COL_RED="\x1b[31;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##*-}
revision=$( grep I386BOOT_CHAMELEONREVISION sym/i386/vers.h | awk '{ print $3 }' | tr -d '\"' )
builddate=$( grep I386BOOT_BUILDDATE sym/i386/vers.h | awk '{ print $3,$4 }' | tr -d '\"' )
timestamp=$( date -j -f "%Y-%m-%d %H:%M:%S" "${builddate}" "+%s" )
# =================
develop=" Crazor, Dense, fassl, fxtentacle, iNDi, JrCs, Kabyl, kaitek, mackerintel, mercurysquad, munky, Slice, meklort, mozodojo, rekursor, Turbo, cparm, valv & zef "
credits=" andyvand, asereBLN, Azimut, bumby, cosmo1t, dfe, Galaxy, kalyway, Krazubu, MasterChief, netkas, sckevyn, smith@@, THeKiNG, blackosx, .: ErmaC :., scrax, DutchHockeyPro & Andy"
# =================
distributioncount=0
xmlindent=0
indent[0]="\t"
indent[1]="\t\t"
indent[2]="\t\t\t"
indent[3]="\t\t\t\t"
main ()
{
# clean up the destination path
rm -R -f "${1}"
echo ""
echo -e $COL_BLACK"----------------------------------"$COL_RESET
echo -e $COL_BLACK"Building $packagename Install Package"$COL_RESET
echo -e $COL_BLACK"----------------------------------"$COL_RESET
echo ""
outline[$((outlinecount++))]="${indent[$xmlindent]}<choices-outline>"
# build core package
echo "================= Core ================="
((xmlindent++))
packagesidentity="org.chameleon.core"
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/usr/standalone/i386/modules
cp -R ${1%/*}/i386/modules ${1}/Core/Root/usr/standalone/i386
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/boot0md ${1}/Core/Root/usr/standalone/i386
cp -f ${1%/*}/i386/boot1f32 ${1}/Core/Root/usr/standalone/i386
cp -f ${1%/*}/i386/boot1h ${1}/Core/Root/usr/standalone/i386
cp -f ${1%/*}/i386/boot1he ${1}/Core/Root/usr/standalone/i386
cp -f ${1%/*}/i386/boot1hp ${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 -f ${1%/*}/i386/fdisk440 ${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 "[BUILD] i386 "
buildpackage "${1}/Core" "/" "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"
# build standard package
mkdir -p ${1}/Standard/Root
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 "[BUILD] Standard "
buildpackage "${1}/Standard" "/" "${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/Root
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 "[BUILD] EFI "
buildpackage "${1}/EFI" "/" "${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 "[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
# build Modules package
echo "================= Modules ================="
outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Module\">"
choices[$((choicescount++))]="<choice\n\tid=\"Module\"\n\ttitle=\"Module_title\"\n\tdescription=\"Module_description\"\n>\n</choice>\n"
((xmlindent++))
packagesidentity="org.chameleon.module"
modules=($( find "${pkgroot}/Scripts/Modules" -type d -depth 1 -not -name '.svn' ))
for (( i = 0 ; i < ${#modules[@]} ; i++ ))
do
mkdir -p "${1}/${modules[$i]##*/}/Root"
mkdir -p "${1}/${modules[$i]##*/}/Scripts"
ditto --noextattr --noqtn "${modules[$i]}/postinstall" "${1}/${modules[$i]##*/}/Scripts/postinstall"
echo "[BUILD] ${modules[$i]##*/} "
buildpackage "${1}/${modules[$i]##*/}" "/" "" "start_selected=\"false\"" >/dev/null 2>&1
rm -R -f "${1}/${i##*/}"
done
((xmlindent--))
outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
# End build Modules packages
((xmlindent--))
outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
# 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++))
packagesidentity="org.chameleon.extras.com"
# build utility package
outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Utility\">"
choices[$((choicescount++))]="<choice\n\tid=\"Utility\"\n\ttitle=\"Utility_title\"\n\tdescription=\"Utility_description\"\n>\n</choice>\n"
((xmlindent++))
packagesidentity="org.chameleon.utility.com"
# build package for Chameleon PrefPanel
mkdir -p "${1}/PrefPanel/Root"
ditto --noextattr --noqtn "${pkgroot}/Configuration/PrefPanel/Chameleon.prefPane" "${1}/PrefPanel/Root"
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 "[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 "[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
mkdir -p "${1}/Documentation/Root"
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 "[BUILD] Documentation "
buildpackage "${1}/Documentation" "/Library/Documentation/Chameleon2RC5" "" "start_selected=\"false\"" >/dev/null 2>&1
# End build package for Documentation
((xmlindent--))
outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
# 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++))
# build base options packages
packagesidentity="org.chameleon.options.com"
options=($( find "${pkgroot}/Scripts/BaseOptions" -type d -depth 1 -not -name '.svn' ))
for (( i = 0 ; i < ${#options[@]} ; i++ ))
do
mkdir -p "${1}/${options[$i]##*/}/Root"
mkdir -p "${1}/${options[$i]##*/}/Scripts"
ditto --noextattr --noqtn "${options[$i]}/postinstall" "${1}/${options[$i]##*/}/Scripts/postinstall"
echo "[BUILD] ${options[$i]##*/} "
buildpackage "${1}/${options[$i]##*/}" "/" "" "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++))
packagesidentity="org.chameleon.resolution"
resolutions=($( find "${pkgroot}/Scripts/Resolutions" -type d -depth 1 -not -name '.svn' ))
for (( i = 0 ; i < ${#resolutions[@]} ; i++ ))
do
mkdir -p "${1}/${resolutions[$i]##*/}/Root/"
mkdir -p "${1}/${resolutions[$i]##*/}/Scripts/"
ditto --noextattr --noqtn "${resolutions[$i]}/postinstall" "${1}/${resolutions[$i]##*/}/Scripts/postinstall"
echo "[BUILD] ${resolutions[$i]##*/} "
buildpackage "${1}/${resolutions[$i]##*/}" "/tmpcham" "" "start_selected=\"false\"" >/dev/null 2>&1
done
((xmlindent--))
outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
# 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++))
packagesidentity="org.chameleon.advanced.options.pkg"
optionsadv=($( find "${pkgroot}/Scripts/Advanced" -type d -depth 1 -not -name '.svn' ))
for (( i = 0 ; i < ${#optionsadv[@]} ; i++ ))
do
mkdir -p "${1}/${optionsadv[$i]##*/}/Root"
mkdir -p "${1}/${optionsadv[$i]##*/}/Scripts"
ditto --noextattr --noqtn "${optionsadv[$i]}/postinstall" "${1}/${optionsadv[$i]##*/}/Scripts/postinstall"
echo "[BUILD] ${optionsadv[$i]##*/} "
buildpackage "${1}/${optionsadv[$i]##*/}" "/" "" "start_selected=\"false\"" >/dev/null 2>&1
done
((xmlindent--))
outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
# End build Advanced packages
((xmlindent--))
outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
# 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++))
packagesidentity="org.chameleon.theme.pkg"
artwork="${1%/*}"
themes=($( find "${artwork%/*}/artwork/themes" -type d -depth 1 -not -name '.svn' ))
for (( i = 0 ; i < ${#themes[@]} ; i++ ))
do
theme=$( echo ${themes[$i]##*/} | awk 'BEGIN{OFS=FS=""}{$1=toupper($1);print}' )
mkdir -p "${1}/${theme}/Root/"
rsync -r --exclude=.svn "${themes[$i]}" "${1}/${themes[$i]##*/}/Root/${theme}"
# #### Comment out thx meklort
# 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 "[BUILD] ${themes[$i]##*/} "
buildpackage "${1}/${theme}" "/Extra/Themes" "" "start_selected=\"false\"" >/dev/null 2>&1
rm -R -f "${1}/${i##*/}"
done
((xmlindent--))
outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
# End build theme 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++))
packagesidentity="org.chameleon.kext.pkg"
kexts=($( find "${pkgroot}/Kexts" -type d -name '*.kext' -depth 1 ))
for (( i = 0 ; i < ${#kexts[@]} ; i++ ))
do
filename="${kexts[$i]##*/}"
mkdir -p "${1}/${filename%.kext}/Root"
ditto --noextattr --noqtn --arch i386 "${kexts[$i]}" "${1}/${filename%.kext}/Root/${filename}"
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 "[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 kext packages
((xmlindent--))
outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
# End build Extras 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
echo "[BUILD] Post "
buildpackage "${1}/Post" "/" "" "start_visible=\"false\" start_selected=\"true\"" >/dev/null 2>&1
outline[$((outlinecount++))]="${indent[$xmlindent]}</choices-outline>"
# build meta package
makedistribution "${1}" "${2}" "${3}" "${4}" "${5}"
# clean up
rm -R -f "${1}"
}
fixperms ()
{
# $1 path
find "${1}" -type f -exec chmod 644 {} \;
find "${1}" -type d -exec chmod 755 {} \;
chown -R 0:0 "${1}"
}
buildpackage ()
{
# $1 Path to package to build containing Root and or Scripts
# $2 Install Location
# $3 Size
# $4 Options
if [ -d "${1}/Root" ] && [ "${1}/Scripts" ]; then
local packagename="${1##*/}"
local identifier=$( echo ${packagesidentity}.${packagename//_/.} | tr [:upper:] [:lower:] )
find "${1}" -name '.DS_Store' -delete
local filecount=$( find "${1}/Root" | wc -l )
if [ "${3}" ]; then
local installedsize="${3}"
else
local installedsize=$( du -hkc "${1}/Root" | tail -n1 | awk {'print $1'} )
fi
local header="<?xml version=\"1.0\"?>\n<pkg-info format-version=\"2\" "
#[ "${3}" == "relocatable" ] && header+="relocatable=\"true\" "
header+="identifier=\"${identifier}\" "
header+="version=\"${version}\" "
[ "${2}" != "relocatable" ] && header+="install-location=\"${2}\" "
header+="auth=\"root\">\n"
header+="\t<payload installKBytes=\"${installedsize##* }\" numberOfFiles=\"${filecount##* }\"/>\n"
rm -R -f "${1}/Temp"
[ -d "${1}/Temp" ] || mkdir -m 777 "${1}/Temp"
[ -d "${1}/Root" ] && mkbom "${1}/Root" "${1}/Temp/Bom"
if [ -d "${1}/Scripts" ]; then
header+="\t<scripts>\n"
for script in $( find "${1}/Scripts" -type f \( -name 'pre*' -or -name 'post*' \) )
do
header+="\t\t<${script##*/} file=\"./${script##*/}\"/>\n"
done
header+="\t</scripts>\n"
chown -R 0:0 "${1}/Scripts"
pushd "${1}/Scripts" >/dev/null
find . -print | cpio -o -z -H cpio > "../Temp/Scripts"
popd >/dev/null
fi
header+="</pkg-info>"
echo -e "${header}" > "${1}/Temp/PackageInfo"
pushd "${1}/Root" >/dev/null
find . -print | cpio -o -z -H cpio > "../Temp/Payload"
popd >/dev/null
pushd "${1}/Temp" >/dev/null
xar -c -f "${1%/*}/${packagename// /}.pkg" --compression none .
popd >/dev/null
outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"${packagename// /}\"/>"
if [ "${4}" ]; then
local choiceoptions="${indent[$xmlindent]}${4}\n"
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}"
fi
}
makedistribution ()
{
rm -f "${1%/*}/${packagename// /}"*.pkg
find "${1}" -type f -name '*.pkg' -depth 1 | while read component
do
mkdir -p "${1}/${packagename}/${component##*/}"
pushd "${1}/${packagename}/${component##*/}" >/dev/null
xar -x -f "${1%}/${component##*/}"
popd >/dev/null
done
ditto --noextattr --noqtn "${pkgroot}/Distribution" "${1}/${packagename}/Distribution"
ditto --noextattr --noqtn "${pkgroot}/Resources" "${1}/${packagename}/Resources"
find "${1}/${packagename}/Resources" -type d -name '.svn' -exec rm -R -f {} \; 2>/dev/null
for (( i=0; i < ${#outline[*]} ; i++));
do
echo -e "${outline[$i]}" >> "${1}/${packagename}/Distribution"
done
for (( i=0; i < ${#choices[*]} ; i++));
do
echo -e "${choices[$i]}" >> "${1}/${packagename}/Distribution"
done
echo "</installer-gui-script>" >> "${1}/${packagename}/Distribution"
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`
#
# Adding Developer and credits
perl -i -p -e "s/%DEVELOP%/${develop}/g" `find "${1}/${packagename}/Resources" -type f`
perl -i -p -e "s/%CREDITS%/${credits}/g" `find "${1}/${packagename}/Resources" -type f`
#
stage=${stage/RC/Release Candidate }
stage=${stage/FINAL/2.0 Final}
perl -i -p -e "s/%CHAMELEONSTAGE%/${stage}/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}-r${revision}.pkg" --compression none .
popd >/dev/null
# Here is the place for assign a Icon to the pkg
# command use to generate the file:
# ditto -c -k --sequesterRsrc --keepParent Icon.icns Icon.zip
ditto -xk "${pkgroot}/Icons/pkg.zip" "${pkgroot}/Icons/"
DeRez -only icns "${pkgroot}/Icons/Icons/pkg.icns" > tempicns.rsrc
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}/Icons/Icons"
# End
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"--------------------------"$COL_RESET
echo -e $COL_BLACK"Building process complete!"$COL_RESET
echo -e $COL_BLACK"--------------------------"$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}"
branches/iFabio/Chameleon/package/slimpkg
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
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
#!/bin/bash
# $1 Path to store built package
packagesidentity="org.chameleon"
packagename="Chameleon"
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##*-}
revision=$( grep I386BOOT_CHAMELEONREVISION sym/i386/vers.h | awk '{ print $3 }' | tr -d '\"' )
builddate=$( grep I386BOOT_BUILDDATE sym/i386/vers.h | awk '{ print $3,$4 }' | tr -d '\"' )
timestamp=$( date -j -f "%Y-%m-%d %H:%M:%S" "${builddate}" "+%s" )
# =================
develop=" Crazor, Dense, fassl, fxtentacle, iNDi, JrCs, Kabyl, kaitek, mackerintel, mercurysquad, munky, Slice, meklort, mozodojo, rekursor, Turbo, cparm, valv & zef "
credits=" andyvand, asereBLN, Azimut, bumby, cosmo1t, dfe, Galaxy, kalyway, Krazubu, MasterChief, netkas, sckevyn, smith@@, THeKiNG, blackosx, .: ErmaC :., scrax, DutchHockeyPro & Andy"
# =================
distributioncount=0
xmlindent=0
indent[0]="\t"
indent[1]="\t\t"
indent[2]="\t\t\t"
indent[3]="\t\t\t\t"
main ()
{
# clean up the destination path
rm -R -f "${1}"
echo ""
echo -e $COL_BLACK"---------------------"$COL_RESET
echo -e $COL_BLACK"Building Slim Package"$COL_RESET
echo -e $COL_BLACK"---------------------"$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/usr/standalone/i386/modules
cp -R ${1%/*}/i386/modules ${1}/Core/Root/usr/standalone/i386
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/boot0md ${1}/Core/Root/usr/standalone/i386
cp -f ${1%/*}/i386/boot1f32 ${1}/Core/Root/usr/standalone/i386
cp -f ${1%/*}/i386/boot1h ${1}/Core/Root/usr/standalone/i386
cp -f ${1%/*}/i386/boot1he ${1}/Core/Root/usr/standalone/i386
cp -f ${1%/*}/i386/boot1hp ${1}/Core/Root/usr/standalone/i386
fixperms "${1}/Core/Root/"
cp -f ${1%/*}/i386/fdisk440 ${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 "[BUILD] i386 "
buildpackage "${1}/Core" "/" "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"
# build standard package
mkdir -p ${1}/Standard/Root
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 "[BUILD] Standard "
buildpackage "${1}/Standard" "/" "${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/Root
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 "[BUILD] EFI "
buildpackage "${1}/EFI" "/" "${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 "[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
# build Modules package
echo "================= Modules ================="
outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Module\">"
choices[$((choicescount++))]="<choice\n\tid=\"Module\"\n\ttitle=\"Module_title\"\n\tdescription=\"Module_description\"\n>\n</choice>\n"
((xmlindent++))
packagesidentity="org.chameleon.module"
modules=($( find "${pkgroot}/Scripts/Modules" -type d -depth 1 -not -name '.svn' ))
for (( i = 0 ; i < ${#modules[@]} ; i++ ))
do
mkdir -p "${1}/${modules[$i]##*/}/Root"
mkdir -p "${1}/${modules[$i]##*/}/Scripts"
ditto --noextattr --noqtn "${modules[$i]}/postinstall" "${1}/${modules[$i]##*/}/Scripts/postinstall"
echo "[BUILD] ${modules[$i]##*/} "
buildpackage "${1}/${modules[$i]##*/}" "/" "" "start_selected=\"false\"" >/dev/null 2>&1
rm -R -f "${1}/${i##*/}"
done
((xmlindent--))
outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
# End build Modules packages
((xmlindent--))
outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
# End build Chameleon 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
echo "[BUILD] Post "
buildpackage "${1}/Post" "/" "" "start_visible=\"false\" start_selected=\"true\"" >/dev/null 2>&1
outline[$((outlinecount++))]="${indent[$xmlindent]}</choices-outline>"
# build meta package
makedistribution "${1}" "${2}" "${3}" "${4}" "${5}"
# clean up
rm -R -f "${1}"
}
fixperms ()
{
# $1 path
find "${1}" -type f -exec chmod 644 {} \;
find "${1}" -type d -exec chmod 755 {} \;
chown -R 0:0 "${1}"
}
buildpackage ()
{
# $1 Path to package to build containing Root and or Scripts
# $2 Install Location
# $3 Size
# $4 Options
if [ -d "${1}/Root" ] && [ "${1}/Scripts" ]; then
local packagename="${1##*/}"
local identifier=$( echo ${packagesidentity}.${packagename//_/.} | tr [:upper:] [:lower:] )
find "${1}" -name '.DS_Store' -delete
local filecount=$( find "${1}/Root" | wc -l )
if [ "${3}" ]; then
local installedsize="${3}"
else
local installedsize=$( du -hkc "${1}/Root" | tail -n1 | awk {'print $1'} )
fi
local header="<?xml version=\"1.0\"?>\n<pkg-info format-version=\"2\" "
#[ "${3}" == "relocatable" ] && header+="relocatable=\"true\" "
header+="identifier=\"${identifier}\" "
header+="version=\"${version}\" "
[ "${2}" != "relocatable" ] && header+="install-location=\"${2}\" "
header+="auth=\"root\">\n"
header+="\t<payload installKBytes=\"${installedsize##* }\" numberOfFiles=\"${filecount##* }\"/>\n"
rm -R -f "${1}/Temp"
[ -d "${1}/Temp" ] || mkdir -m 777 "${1}/Temp"
[ -d "${1}/Root" ] && mkbom "${1}/Root" "${1}/Temp/Bom"
if [ -d "${1}/Scripts" ]; then
header+="\t<scripts>\n"
for script in $( find "${1}/Scripts" -type f \( -name 'pre*' -or -name 'post*' \) )
do
header+="\t\t<${script##*/} file=\"./${script##*/}\"/>\n"
done
header+="\t</scripts>\n"
chown -R 0:0 "${1}/Scripts"
pushd "${1}/Scripts" >/dev/null
find . -print | cpio -o -z -H cpio > "../Temp/Scripts"
popd >/dev/null
fi
header+="</pkg-info>"
echo -e "${header}" > "${1}/Temp/PackageInfo"
pushd "${1}/Root" >/dev/null
find . -print | cpio -o -z -H cpio > "../Temp/Payload"
popd >/dev/null
pushd "${1}/Temp" >/dev/null
xar -c -f "${1%/*}/${packagename// /}.pkg" --compression none .
popd >/dev/null
outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"${packagename// /}\"/>"
if [ "${4}" ]; then
local choiceoptions="${indent[$xmlindent]}${4}\n"
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}"
fi
}
makedistribution ()
{
rm -f "${1%/*}/${packagename// /}"*.pkg
find "${1}" -type f -name '*.pkg' -depth 1 | while read component
do
mkdir -p "${1}/${packagename}/${component##*/}"
pushd "${1}/${packagename}/${component##*/}" >/dev/null
xar -x -f "${1%}/${component##*/}"
popd >/dev/null
done
ditto --noextattr --noqtn "${pkgroot}/Distribution" "${1}/${packagename}/Distribution"
ditto --noextattr --noqtn "${pkgroot}/Resources" "${1}/${packagename}/Resources"
find "${1}/${packagename}/Resources" -type d -name '.svn' -exec rm -R -f {} \; 2>/dev/null
for (( i=0; i < ${#outline[*]} ; i++));
do
echo -e "${outline[$i]}" >> "${1}/${packagename}/Distribution"
done
for (( i=0; i < ${#choices[*]} ; i++));
do
echo -e "${choices[$i]}" >> "${1}/${packagename}/Distribution"
done
echo "</installer-gui-script>" >> "${1}/${packagename}/Distribution"
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 Developer and credits
perl -i -p -e "s/%DEVELOP%/${develop}/g" `find "${1}/${packagename}/Resources" -type f`
perl -i -p -e "s/%CREDITS%/${credits}/g" `find "${1}/${packagename}/Resources" -type f`
#
stage=${stage/RC/Release Candidate }
stage=${stage/FINAL/2.0 Final}
perl -i -p -e "s/%CHAMELEONSTAGE%/${stage}/g" `find "${1}/${packagename}/Resources" -type f`
find "${1}/${packagename}" -name '.DS_Store' -delete
pushd "${1}/${packagename}" >/dev/null
xar -c -f "${1%/*}/$packagename.pkg" --compression none .
popd >/dev/null
# Here is the place for assign a Icon to the pkg
ditto -xk "${pkgroot}/Icons/pkg.zip" "${pkgroot}/Icons/"
DeRez -only icns "${pkgroot}/Icons/Icons/pkg.icns" > tempicns.rsrc
Rez -append tempicns.rsrc -o "${1%/*}/$packagename.pkg"
SetFile -a C "${1%/*}/$packagename.pkg"
rm -f tempicns.rsrc
rm -rf "${pkgroot}/Icons/Icons"
# End
}
main "${1}" "${2}" "${3}" "${4}" "${5}"
branches/iFabio/Chameleon/package/builddmg
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
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
#!/bin/bash
# $1 Path to store built dmg
pkgroot="${0%/*}"
SYM_ROOT="${1%/*}"
DMG_ROOT=$SYM_ROOT
OPENUP_TOOL=${1%/*}/i386/openUp
SRC_FOLDER=${1%/*}/source
VOLUME_NAME="Chameleon"
TEMP_NAME="rw.dmg"
DMG_TEMP_NAME=${DMG_ROOT}/${TEMP_NAME}
TEMPLATE_DMG=${pkgroot}/dmg/ro.dmg
EULA_RSRC=${pkgroot}/dmg/SLAResources
# =============================
# Setting color for text output
# =============================
COL_BLACK="\x1b[30;01m"
COL_RED="\x1b[31;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"
# ======================
# Setting Chameleon info
# ======================
version=$( cat version )
stage=${version##*-}
revision=$( grep I386BOOT_CHAMELEONREVISION sym/i386/vers.h | awk '{ print $3 }' | tr -d '\"' )
builddate=$( grep I386BOOT_BUILDDATE sym/i386/vers.h | awk '{ print $3,$4 }' | tr -d '\"' )
timestamp=$( date -j -f "%Y-%m-%d %H:%M:%S" "${builddate}" "+%s" )
# =========================
# Start of building process
# =========================
echo ""
echo -e $COL_BLACK"----------------------"$COL_RESET
echo -e $COL_BLACK"Building $VOLUME_NAME DMG"$COL_RESET
echo -e $COL_BLACK"----------------------"$COL_RESET
echo ""
# =================================
# 1) Clean previus builded contents
# =================================
if [ -x ${SRC_FOLDER} ]; then
echo "Deleting previus existing source folder/content "
rm -R ${SRC_FOLDER}
rm -f ${DMG_TEMP_NAME}
fi
# ===========================
# 2) Create the source folder
# ===========================
echo "[mkdir] Creating source folder "
mkdir "${SRC_FOLDER}"
# ==================================
# 3) Copy content into source folder
# ==================================
ditto -xk "${pkgroot}/Icons/i386.zip" "${SRC_FOLDER}/"
ditto -xk "${pkgroot}/Icons/doc.zip" "${SRC_FOLDER}/"
ditto -xk "${pkgroot}/Icons/pan.zip" "${SRC_FOLDER}/"
ditto -xk "${pkgroot}/Icons/tm.zip" "${SRC_FOLDER}/"
mv ${SYM_ROOT}/${VOLUME_NAME}.pkg ${SRC_FOLDER}/${VOLUME_NAME}.pkg
cp -r ${pkgroot}/doc/* ${SRC_FOLDER}/Documentation/
cp -r ${pkgroot}/Configuration/PrefPanel/* ${SRC_FOLDER}/PrefPanel/
cp -r ${SYM_ROOT}/i386/* ${SRC_FOLDER}/i386/
cp -r ${SYM_ROOT%/*}/artwork/themes/* ${SRC_FOLDER}/Themes/
rm -rf ${SRC_FOLDER}`find . -type d -name .svn`
# =======================================
# 4) Find the size of the folder contents
# =======================================
FOLDER_SIZE=`/usr/bin/du -s "${SRC_FOLDER}" | sed s/[^0-9].*//`
# =====================================================
# 4) Allow for partition table and other overhead (10%)
# =====================================================
IMAGE_SIZE=$(($FOLDER_SIZE * 110/100))
# ============================================
# 5) Minimum size for an HFS+ partition is 4Mb
# ============================================
[ $IMAGE_SIZE -lt 19960 ] && IMAGE_SIZE=19960 # [ $IMAGE_SIZE -lt 8300 ] && IMAGE_SIZE=8300
# =================================================================
# 6) Make sure NEXT_ROOT is not set (if we're building with an SDK)
# =================================================================
unset NEXT_ROOT
echo "Source folder size = $FOLDER_SIZE"
echo "DMG image size (+10%) = $IMAGE_SIZE"
echo " "
# =======================================
# 7) Convert the DMG template into RW-DMG
# =======================================
echo "[hdutil] Creating disk image "
test -f "${DMG_TEMP_NAME}" && rm -f "${DMG_TEMP_NAME}"
hdiutil convert $TEMPLATE_DMG -format UDRW -o "${DMG_TEMP_NAME}" >/dev/null 2>&1
hdiutil resize -limits "${DMG_TEMP_NAME}" >/dev/null 2>&1
hdiutil resize -size 15m "${DMG_TEMP_NAME}" >/dev/null 2>&1
echo " "
# ===========
# 8) Mount it
# ===========
echo "[hdutil] Mounting disk image "
MOUNT_DIR=/Volumes/$VOLUME_NAME
DEV_NAME=$(hdiutil attach -readwrite -noverify -noautoopen "${DMG_TEMP_NAME}" | egrep '^/dev/' | sed 1q | awk '{print $1}') >/dev/null 2>&1
echo "Device name:$DEV_NAME"
echo "Mount directory: $MOUNT_DIR"
echo " "
# =====================================
# 9) Make sure it's not world writeable
# =====================================
mv ${SRC_FOLDER}/${VOLUME_NAME}.pkg ${MOUNT_DIR}/${VOLUME_NAME}.pkg
cp -R ${SRC_FOLDER}/Documentation ${MOUNT_DIR}/
cp -R ${SRC_FOLDER}/PrefPanel ${MOUNT_DIR}/
cp -R ${SRC_FOLDER}/i386 ${MOUNT_DIR}/
cp -R ${SRC_FOLDER}/Themes ${MOUNT_DIR}/
echo "[chmod] Fixing permission for \"${MOUNT_DIR}\""
chmod -Rf go-w "${MOUNT_DIR}" || true
chmod -f a-w "${MOUNT_DIR}"/.DS_Store || true
echo "Done fixing permissions."
echo " "
# =============================================
# 10) Make the top window open itself on mount:
# =============================================
echo "[openUp] Setting auto open flag"
if [ -x ${OPENUP_TOOL} ]; then
echo "Applying openUp..."
${OPENUP_TOOL} "${MOUNT_DIR}" >/dev/null 2>&1
fi
echo " "
# ===========
# 11) Unmount
# ===========
echo "[hdutil] Unmounting disk image"
hdiutil detach "${DEV_NAME}" >/dev/null 2>&1
echo " "
# ==================
# 12) Compress image
# ==================
test -f "${DMG_ROOT}/${VOLUME_NAME}.dmg" && rm -f "${DMG_ROOT}/${VOLUME_NAME}.dmg"
echo "[hdutil] Compressing disk image"
hdiutil convert ${DMG_TEMP_NAME} -format UDZO -imagekey zlib-level=9 -o ${DMG_ROOT}/${VOLUME_NAME} >/dev/null 2>&1
rm -f "${DMG_TEMP_NAME}"
echo " "
# =========================
# 13) Adding EULA resources
# =========================
if [ ! -z "${EULA_RSRC}" -a "${EULA_RSRC}" != "-null-" ]; then
echo "[ResMerger] Adding EULA resources"
hdiutil unflatten ${DMG_ROOT}/${VOLUME_NAME}.dmg >/dev/null 2>&1
ResMerger -a ${EULA_RSRC} -o ${DMG_ROOT}/${VOLUME_NAME}.dmg
hdiutil flatten ${DMG_ROOT}/${VOLUME_NAME}.dmg >/dev/null 2>&1
fi
# =======================
# 14) Adding Icon to .dmg
# =======================
ditto -xk ${pkgroot}/Icons/dmg.zip "${pkgroot}/Icons"
DeRez -only icns ${pkgroot}/Icons/Icons/dmg.icns > tempicns.rsrc
Rez -append tempicns.rsrc -o ${DMG_ROOT}/${VOLUME_NAME}.dmg
SetFile -a C ${DMG_ROOT}/${VOLUME_NAME}.dmg
rm -f tempicns.rsrc
rm -rf "${pkgroot}/Icons/Icons"
rm -R ${SRC_FOLDER}
# ===
# END
# ===
echo "===================="
echo "Finish $VOLUME_NAME.dmg"
echo "===================="
echo ""
#-----
exit 0
branches/iFabio/Chameleon/package/slimpkg.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
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
#!/bin/bash
# $1 Path to store built package
packagesidentity="org.chameleon"
packagename="Chameleon"
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##*-}
revision=$( grep I386BOOT_CHAMELEONREVISION sym/i386/vers.h | awk '{ print $3 }' | tr -d '\"' )
builddate=$( grep I386BOOT_BUILDDATE sym/i386/vers.h | awk '{ print $3,$4 }' | tr -d '\"' )
timestamp=$( date -j -f "%Y-%m-%d %H:%M:%S" "${builddate}" "+%s" )
# =================
develop=" Crazor, Dense, fassl, fxtentacle, iNDi, JrCs, Kabyl, kaitek, mackerintel, mercurysquad, munky, Slice, meklort, mozodojo, rekursor, Turbo, cparm, valv & zef "
credits=" andyvand, asereBLN, Azimut, bumby, cosmo1t, dfe, Galaxy, kalyway, Krazubu, MasterChief, netkas, sckevyn, smith@@, THeKiNG, blackosx, .: ErmaC :., scrax, DutchHockeyPro & Andy"
# =================
distributioncount=0
xmlindent=0
indent[0]="\t"
indent[1]="\t\t"
indent[2]="\t\t\t"
indent[3]="\t\t\t\t"
main ()
{
# clean up the destination path
rm -R -f "${1}"
echo ""
echo -e $COL_BLACK"---------------------"$COL_RESET
echo -e $COL_BLACK"Building Slim Package"$COL_RESET
echo -e $COL_BLACK"---------------------"$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/usr/standalone/i386/modules
cp -R ${1%/*}/i386/modules ${1}/Core/Root/usr/standalone/i386
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/boot0md ${1}/Core/Root/usr/standalone/i386
cp -f ${1%/*}/i386/boot1f32 ${1}/Core/Root/usr/standalone/i386
cp -f ${1%/*}/i386/boot1h ${1}/Core/Root/usr/standalone/i386
cp -f ${1%/*}/i386/boot1he ${1}/Core/Root/usr/standalone/i386
cp -f ${1%/*}/i386/boot1hp ${1}/Core/Root/usr/standalone/i386
fixperms "${1}/Core/Root/"
cp -f ${1%/*}/i386/fdisk440 ${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 "[BUILD] i386 "
buildpackage "${1}/Core" "/" "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"
# build standard package
mkdir -p ${1}/Standard/Root
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 "[BUILD] Standard "
buildpackage "${1}/Standard" "/" "${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/Root
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 "[BUILD] EFI "
buildpackage "${1}/EFI" "/" "${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 "[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
# build Modules package
echo "================= Modules ================="
outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Module\">"
choices[$((choicescount++))]="<choice\n\tid=\"Module\"\n\ttitle=\"Module_title\"\n\tdescription=\"Module_description\"\n>\n</choice>\n"
((xmlindent++))
packagesidentity="org.chameleon.module"
modules=($( find "${pkgroot}/Scripts/Modules" -type d -depth 1 -not -name '.svn' ))
for (( i = 0 ; i < ${#modules[@]} ; i++ ))
do
mkdir -p "${1}/${modules[$i]##*/}/Root"
mkdir -p "${1}/${modules[$i]##*/}/Scripts"
ditto --noextattr --noqtn "${modules[$i]}/postinstall" "${1}/${modules[$i]##*/}/Scripts/postinstall"
echo "[BUILD] ${modules[$i]##*/} "
buildpackage "${1}/${modules[$i]##*/}" "/" "" "start_selected=\"false\"" >/dev/null 2>&1
rm -R -f "${1}/${i##*/}"
done
((xmlindent--))
outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
# End build Modules packages
((xmlindent--))
outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
# End build Chameleon 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
echo "[BUILD] Post "
buildpackage "${1}/Post" "/" "" "start_visible=\"false\" start_selected=\"true\"" >/dev/null 2>&1
outline[$((outlinecount++))]="${indent[$xmlindent]}</choices-outline>"
# build meta package
makedistribution "${1}" "${2}" "${3}" "${4}" "${5}"
# clean up
rm -R -f "${1}"
}
fixperms ()
{
# $1 path
find "${1}" -type f -exec chmod 644 {} \;
find "${1}" -type d -exec chmod 755 {} \;
chown -R 0:0 "${1}"
}
buildpackage ()
{
# $1 Path to package to build containing Root and or Scripts
# $2 Install Location
# $3 Size
# $4 Options
if [ -d "${1}/Root" ] && [ "${1}/Scripts" ]; then
local packagename="${1##*/}"
local identifier=$( echo ${packagesidentity}.${packagename//_/.} | tr [:upper:] [:lower:] )
find "${1}" -name '.DS_Store' -delete
local filecount=$( find "${1}/Root" | wc -l )
if [ "${3}" ]; then
local installedsize="${3}"
else
local installedsize=$( du -hkc "${1}/Root" | tail -n1 | awk {'print $1'} )
fi
local header="<?xml version=\"1.0\"?>\n<pkg-info format-version=\"2\" "
#[ "${3}" == "relocatable" ] && header+="relocatable=\"true\" "
header+="identifier=\"${identifier}\" "
header+="version=\"${version}\" "
[ "${2}" != "relocatable" ] && header+="install-location=\"${2}\" "
header+="auth=\"root\">\n"
header+="\t<payload installKBytes=\"${installedsize##* }\" numberOfFiles=\"${filecount##* }\"/>\n"
rm -R -f "${1}/Temp"
[ -d "${1}/Temp" ] || mkdir -m 777 "${1}/Temp"
[ -d "${1}/Root" ] && mkbom "${1}/Root" "${1}/Temp/Bom"
if [ -d "${1}/Scripts" ]; then
header+="\t<scripts>\n"
for script in $( find "${1}/Scripts" -type f \( -name 'pre*' -or -name 'post*' \) )
do
header+="\t\t<${script##*/} file=\"./${script##*/}\"/>\n"
done
header+="\t</scripts>\n"
chown -R 0:0 "${1}/Scripts"
pushd "${1}/Scripts" >/dev/null
find . -print | cpio -o -z -H cpio > "../Temp/Scripts"
popd >/dev/null
fi
header+="</pkg-info>"
echo -e "${header}" > "${1}/Temp/PackageInfo"
pushd "${1}/Root" >/dev/null
find . -print | cpio -o -z -H cpio > "../Temp/Payload"
popd >/dev/null
pushd "${1}/Temp" >/dev/null
xar -c -f "${1%/*}/${packagename// /}.pkg" --compression none .
popd >/dev/null
outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"${packagename// /}\"/>"
if [ "${4}" ]; then
local choiceoptions="${indent[$xmlindent]}${4}\n"
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}"
fi
}
makedistribution ()
{
rm -f "${1%/*}/${packagename// /}"*.pkg
find "${1}" -type f -name '*.pkg' -depth 1 | while read component
do
mkdir -p "${1}/${packagename}/${component##*/}"
pushd "${1}/${packagename}/${component##*/}" >/dev/null
xar -x -f "${1%}/${component##*/}"
popd >/dev/null
done
ditto --noextattr --noqtn "${pkgroot}/Distribution" "${1}/${packagename}/Distribution"
ditto --noextattr --noqtn "${pkgroot}/Resources" "${1}/${packagename}/Resources"
find "${1}/${packagename}/Resources" -type d -name '.svn' -exec rm -R -f {} \; 2>/dev/null
for (( i=0; i < ${#outline[*]} ; i++));
do
echo -e "${outline[$i]}" >> "${1}/${packagename}/Distribution"
done
for (( i=0; i < ${#choices[*]} ; i++));
do
echo -e "${choices[$i]}" >> "${1}/${packagename}/Distribution"
done
echo "</installer-gui-script>" >> "${1}/${packagename}/Distribution"
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 Developer and credits
perl -i -p -e "s/%DEVELOP%/${develop}/g" `find "${1}/${packagename}/Resources" -type f`
perl -i -p -e "s/%CREDITS%/${credits}/g" `find "${1}/${packagename}/Resources" -type f`
#
stage=${stage/RC/Release Candidate }
stage=${stage/FINAL/2.0 Final}
perl -i -p -e "s/%CHAMELEONSTAGE%/${stage}/g" `find "${1}/${packagename}/Resources" -type f`
find "${1}/${packagename}" -name '.DS_Store' -delete
pushd "${1}/${packagename}" >/dev/null
xar -c -f "${1%/*}/$packagename.pkg" --compression none .
popd >/dev/null
# Here is the place for assign a Icon to the pkg
ditto -xk "${pkgroot}/Icons/pkg.zip" "${pkgroot}/Icons/"
DeRez -only icns "${pkgroot}/Icons/Icons/pkg.icns" > tempicns.rsrc
Rez -append tempicns.rsrc -o "${1%/*}/$packagename.pkg"
SetFile -a C "${1%/*}/$packagename.pkg"
rm -f tempicns.rsrc
rm -rf "${pkgroot}/Icons/Icons"
# End
}
main "${1}" "${2}" "${3}" "${4}" "${5}"
branches/iFabio/Chameleon/package/builddmg.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
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
#!/bin/bash
# $1 Path to store built dmg
pkgroot="${0%/*}"
SYM_ROOT="${1%/*}"
DMG_ROOT=$SYM_ROOT
OPENUP_TOOL=${1%/*}/i386/openUp
SRC_FOLDER=${1%/*}/source
VOLUME_NAME="Chameleon"
TEMP_NAME="rw.dmg"
DMG_TEMP_NAME=${DMG_ROOT}/${TEMP_NAME}
TEMPLATE_DMG=${pkgroot}/dmg/ro.dmg
EULA_RSRC=${pkgroot}/dmg/SLAResources
# =============================
# Setting color for text output
# =============================
COL_BLACK="\x1b[30;01m"
COL_RED="\x1b[31;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"
# ======================
# Setting Chameleon info
# ======================
version=$( cat version )
stage=${version##*-}
revision=$( grep I386BOOT_CHAMELEONREVISION sym/i386/vers.h | awk '{ print $3 }' | tr -d '\"' )
builddate=$( grep I386BOOT_BUILDDATE sym/i386/vers.h | awk '{ print $3,$4 }' | tr -d '\"' )
timestamp=$( date -j -f "%Y-%m-%d %H:%M:%S" "${builddate}" "+%s" )
# =========================
# Start of building process
# =========================
echo ""
echo -e $COL_BLACK"----------------------"$COL_RESET
echo -e $COL_BLACK"Building $VOLUME_NAME DMG"$COL_RESET
echo -e $COL_BLACK"----------------------"$COL_RESET
echo ""
# =================================
# 1) Clean previus builded contents
# =================================
if [ -x ${SRC_FOLDER} ]; then
echo "Deleting previus existing source folder/content "
rm -R ${SRC_FOLDER}
rm -f ${DMG_TEMP_NAME}
fi
# ===========================
# 2) Create the source folder
# ===========================
echo "[mkdir] Creating source folder "
mkdir "${SRC_FOLDER}"
# ==================================
# 3) Copy content into source folder
# ==================================
ditto -xk "${pkgroot}/Icons/i386.zip" "${SRC_FOLDER}/"
ditto -xk "${pkgroot}/Icons/doc.zip" "${SRC_FOLDER}/"
ditto -xk "${pkgroot}/Icons/pan.zip" "${SRC_FOLDER}/"
ditto -xk "${pkgroot}/Icons/tm.zip" "${SRC_FOLDER}/"
mv ${SYM_ROOT}/${VOLUME_NAME}.pkg ${SRC_FOLDER}/${VOLUME_NAME}.pkg
cp -r ${pkgroot}/doc/* ${SRC_FOLDER}/Documentation/
cp -r ${pkgroot}/Configuration/PrefPanel/* ${SRC_FOLDER}/PrefPanel/
cp -r ${SYM_ROOT}/i386/* ${SRC_FOLDER}/i386/
cp -r ${SYM_ROOT%/*}/artwork/themes/* ${SRC_FOLDER}/Themes/
rm -rf ${SRC_FOLDER}`find . -type d -name .svn`
# =======================================
# 4) Find the size of the folder contents
# =======================================
FOLDER_SIZE=`/usr/bin/du -s "${SRC_FOLDER}" | sed s/[^0-9].*//`
# =====================================================
# 4) Allow for partition table and other overhead (10%)
# =====================================================
IMAGE_SIZE=$(($FOLDER_SIZE * 110/100))
# ============================================
# 5) Minimum size for an HFS+ partition is 4Mb
# ============================================
[ $IMAGE_SIZE -lt 19960 ] && IMAGE_SIZE=19960 # [ $IMAGE_SIZE -lt 8300 ] && IMAGE_SIZE=8300
# =================================================================
# 6) Make sure NEXT_ROOT is not set (if we're building with an SDK)
# =================================================================
unset NEXT_ROOT
echo "Source folder size = $FOLDER_SIZE"
echo "DMG image size (+10%) = $IMAGE_SIZE"
echo " "
# =======================================
# 7) Convert the DMG template into RW-DMG
# =======================================
echo "[hdutil] Creating disk image "
test -f "${DMG_TEMP_NAME}" && rm -f "${DMG_TEMP_NAME}"
hdiutil convert $TEMPLATE_DMG -format UDRW -o "${DMG_TEMP_NAME}" >/dev/null 2>&1
hdiutil resize -limits "${DMG_TEMP_NAME}" >/dev/null 2>&1
hdiutil resize -size 15m "${DMG_TEMP_NAME}" >/dev/null 2>&1
echo " "
# ===========
# 8) Mount it
# ===========
echo "[hdutil] Mounting disk image "
MOUNT_DIR=/Volumes/$VOLUME_NAME
DEV_NAME=$(hdiutil attach -readwrite -noverify -noautoopen "${DMG_TEMP_NAME}" | egrep '^/dev/' | sed 1q | awk '{print $1}') >/dev/null 2>&1
echo "Device name:$DEV_NAME"
echo "Mount directory: $MOUNT_DIR"
echo " "
# =====================================
# 9) Make sure it's not world writeable
# =====================================
mv ${SRC_FOLDER}/${VOLUME_NAME}.pkg ${MOUNT_DIR}/${VOLUME_NAME}.pkg
cp -R ${SRC_FOLDER}/Documentation ${MOUNT_DIR}/
cp -R ${SRC_FOLDER}/PrefPanel ${MOUNT_DIR}/
cp -R ${SRC_FOLDER}/i386 ${MOUNT_DIR}/
cp -R ${SRC_FOLDER}/Themes ${MOUNT_DIR}/
echo "[chmod] Fixing permission for \"${MOUNT_DIR}\""
chmod -Rf go-w "${MOUNT_DIR}" || true
chmod -f a-w "${MOUNT_DIR}"/.DS_Store || true
echo "Done fixing permissions."
echo " "
# =============================================
# 10) Make the top window open itself on mount:
# =============================================
echo "[openUp] Setting auto open flag"
if [ -x ${OPENUP_TOOL} ]; then
echo "Applying openUp..."
${OPENUP_TOOL} "${MOUNT_DIR}" >/dev/null 2>&1
fi
echo " "
# ===========
# 11) Unmount
# ===========
echo "[hdutil] Unmounting disk image"
hdiutil detach "${DEV_NAME}" >/dev/null 2>&1
echo " "
# ==================
# 12) Compress image
# ==================
test -f "${DMG_ROOT}/${VOLUME_NAME}.dmg" && rm -f "${DMG_ROOT}/${VOLUME_NAME}.dmg"
echo "[hdutil] Compressing disk image"
hdiutil convert ${DMG_TEMP_NAME} -format UDZO -imagekey zlib-level=9 -o ${DMG_ROOT}/${VOLUME_NAME} >/dev/null 2>&1
rm -f "${DMG_TEMP_NAME}"
echo " "
# =========================
# 13) Adding EULA resources
# =========================
if [ ! -z "${EULA_RSRC}" -a "${EULA_RSRC}" != "-null-" ]; then
echo "[ResMerger] Adding EULA resources"
hdiutil unflatten ${DMG_ROOT}/${VOLUME_NAME}.dmg >/dev/null 2>&1
ResMerger -a ${EULA_RSRC} -o ${DMG_ROOT}/${VOLUME_NAME}.dmg
hdiutil flatten ${DMG_ROOT}/${VOLUME_NAME}.dmg >/dev/null 2>&1
fi
# =======================
# 14) Adding Icon to .dmg
# =======================
ditto -xk ${pkgroot}/Icons/dmg.zip "${pkgroot}/Icons"
DeRez -only icns ${pkgroot}/Icons/Icons/dmg.icns > tempicns.rsrc
Rez -append tempicns.rsrc -o ${DMG_ROOT}/${VOLUME_NAME}.dmg
SetFile -a C ${DMG_ROOT}/${VOLUME_NAME}.dmg
rm -f tempicns.rsrc
rm -rf "${pkgroot}/Icons/Icons"
rm -R ${SRC_FOLDER}
# ===
# END
# ===
echo "===================="
echo "Finish $VOLUME_NAME.dmg"
echo "===================="
echo ""
#-----
exit 0
branches/iFabio/Chameleon/package/buildpkg.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
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
#!/bin/bash
# $1 Path to store built package
packagesidentity="org.chameleon"
packagename="Chameleon"
pkgroot="${0%/*}"
COL_BLACK="\x1b[30;01m"
COL_RED="\x1b[31;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##*-}
revision=$( grep I386BOOT_CHAMELEONREVISION sym/i386/vers.h | awk '{ print $3 }' | tr -d '\"' )
builddate=$( grep I386BOOT_BUILDDATE sym/i386/vers.h | awk '{ print $3,$4 }' | tr -d '\"' )
timestamp=$( date -j -f "%Y-%m-%d %H:%M:%S" "${builddate}" "+%s" )
# =================
develop=" Crazor, Dense, fassl, fxtentacle, iNDi, JrCs, Kabyl, kaitek, mackerintel, mercurysquad, munky, Slice, meklort, mozodojo, rekursor, Turbo, cparm, valv & zef "
credits=" andyvand, asereBLN, Azimut, bumby, cosmo1t, dfe, Galaxy, kalyway, Krazubu, MasterChief, netkas, sckevyn, smith@@, THeKiNG, blackosx, .: ErmaC :., scrax, DutchHockeyPro & Andy"
# =================
distributioncount=0
xmlindent=0
indent[0]="\t"
indent[1]="\t\t"
indent[2]="\t\t\t"
indent[3]="\t\t\t\t"
main ()
{
# clean up the destination path
rm -R -f "${1}"
echo ""
echo -e $COL_BLACK"----------------------------------"$COL_RESET
echo -e $COL_BLACK"Building $packagename Install Package"$COL_RESET
echo -e $COL_BLACK"----------------------------------"$COL_RESET
echo ""
outline[$((outlinecount++))]="${indent[$xmlindent]}<choices-outline>"
# build core package
echo "================= Core ================="
((xmlindent++))
packagesidentity="org.chameleon.core"
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/usr/standalone/i386/modules
cp -R ${1%/*}/i386/modules ${1}/Core/Root/usr/standalone/i386
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/boot0md ${1}/Core/Root/usr/standalone/i386
cp -f ${1%/*}/i386/boot1f32 ${1}/Core/Root/usr/standalone/i386
cp -f ${1%/*}/i386/boot1h ${1}/Core/Root/usr/standalone/i386
cp -f ${1%/*}/i386/boot1he ${1}/Core/Root/usr/standalone/i386
cp -f ${1%/*}/i386/boot1hp ${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 -f ${1%/*}/i386/fdisk440 ${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 "[BUILD] i386 "
buildpackage "${1}/Core" "/" "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"
# build standard package
mkdir -p ${1}/Standard/Root
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 "[BUILD] Standard "
buildpackage "${1}/Standard" "/" "${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/Root
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 "[BUILD] EFI "
buildpackage "${1}/EFI" "/" "${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 "[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
# build Modules package
echo "================= Modules ================="
outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Module\">"
choices[$((choicescount++))]="<choice\n\tid=\"Module\"\n\ttitle=\"Module_title\"\n\tdescription=\"Module_description\"\n>\n</choice>\n"
((xmlindent++))
packagesidentity="org.chameleon.module"
modules=($( find "${pkgroot}/Scripts/Modules" -type d -depth 1 -not -name '.svn' ))
for (( i = 0 ; i < ${#modules[@]} ; i++ ))
do
mkdir -p "${1}/${modules[$i]##*/}/Root"
mkdir -p "${1}/${modules[$i]##*/}/Scripts"
ditto --noextattr --noqtn "${modules[$i]}/postinstall" "${1}/${modules[$i]##*/}/Scripts/postinstall"
echo "[BUILD] ${modules[$i]##*/} "
buildpackage "${1}/${modules[$i]##*/}" "/" "" "start_selected=\"false\"" >/dev/null 2>&1
rm -R -f "${1}/${i##*/}"
done
((xmlindent--))
outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
# End build Modules packages
((xmlindent--))
outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
# 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++))
packagesidentity="org.chameleon.extras.com"
# build utility package
outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Utility\">"
choices[$((choicescount++))]="<choice\n\tid=\"Utility\"\n\ttitle=\"Utility_title\"\n\tdescription=\"Utility_description\"\n>\n</choice>\n"
((xmlindent++))
packagesidentity="org.chameleon.utility.com"
# build package for Chameleon PrefPanel
mkdir -p "${1}/PrefPanel/Root"
ditto --noextattr --noqtn "${pkgroot}/Configuration/PrefPanel/Chameleon.prefPane" "${1}/PrefPanel/Root"
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 "[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 "[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
mkdir -p "${1}/Documentation/Root"
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 "[BUILD] Documentation "
buildpackage "${1}/Documentation" "/Library/Documentation/Chameleon2RC5" "" "start_selected=\"false\"" >/dev/null 2>&1
# End build package for Documentation
((xmlindent--))
outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
# 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++))
# build base options packages
packagesidentity="org.chameleon.options.com"
options=($( find "${pkgroot}/Scripts/BaseOptions" -type d -depth 1 -not -name '.svn' ))
for (( i = 0 ; i < ${#options[@]} ; i++ ))
do
mkdir -p "${1}/${options[$i]##*/}/Root"
mkdir -p "${1}/${options[$i]##*/}/Scripts"
ditto --noextattr --noqtn "${options[$i]}/postinstall" "${1}/${options[$i]##*/}/Scripts/postinstall"
echo "[BUILD] ${options[$i]##*/} "
buildpackage "${1}/${options[$i]##*/}" "/" "" "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++))
packagesidentity="org.chameleon.resolution"
resolutions=($( find "${pkgroot}/Scripts/Resolutions" -type d -depth 1 -not -name '.svn' ))
for (( i = 0 ; i < ${#resolutions[@]} ; i++ ))
do
mkdir -p "${1}/${resolutions[$i]##*/}/Root/"
mkdir -p "${1}/${resolutions[$i]##*/}/Scripts/"
ditto --noextattr --noqtn "${resolutions[$i]}/postinstall" "${1}/${resolutions[$i]##*/}/Scripts/postinstall"
echo "[BUILD] ${resolutions[$i]##*/} "
buildpackage "${1}/${resolutions[$i]##*/}" "/tmpcham" "" "start_selected=\"false\"" >/dev/null 2>&1
done
((xmlindent--))
outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
# 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++))
packagesidentity="org.chameleon.advanced.options.pkg"
optionsadv=($( find "${pkgroot}/Scripts/Advanced" -type d -depth 1 -not -name '.svn' ))
for (( i = 0 ; i < ${#optionsadv[@]} ; i++ ))
do
mkdir -p "${1}/${optionsadv[$i]##*/}/Root"
mkdir -p "${1}/${optionsadv[$i]##*/}/Scripts"
ditto --noextattr --noqtn "${optionsadv[$i]}/postinstall" "${1}/${optionsadv[$i]##*/}/Scripts/postinstall"
echo "[BUILD] ${optionsadv[$i]##*/} "
buildpackage "${1}/${optionsadv[$i]##*/}" "/" "" "start_selected=\"false\"" >/dev/null 2>&1
done
((xmlindent--))
outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
# End build Advanced packages
((xmlindent--))
outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
# 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++))
packagesidentity="org.chameleon.theme.pkg"
artwork="${1%/*}"
themes=($( find "${artwork%/*}/artwork/themes" -type d -depth 1 -not -name '.svn' ))
for (( i = 0 ; i < ${#themes[@]} ; i++ ))
do
theme=$( echo ${themes[$i]##*/} | awk 'BEGIN{OFS=FS=""}{$1=toupper($1);print}' )
mkdir -p "${1}/${theme}/Root/"
rsync -r --exclude=.svn "${themes[$i]}" "${1}/${themes[$i]##*/}/Root/${theme}"
# #### Comment out thx meklort
# 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 "[BUILD] ${themes[$i]##*/} "
buildpackage "${1}/${theme}" "/Extra/Themes" "" "start_selected=\"false\"" >/dev/null 2>&1
rm -R -f "${1}/${i##*/}"
done
((xmlindent--))
outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
# End build theme 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++))
packagesidentity="org.chameleon.kext.pkg"
kexts=($( find "${pkgroot}/Kexts" -type d -name '*.kext' -depth 1 ))
for (( i = 0 ; i < ${#kexts[@]} ; i++ ))
do
filename="${kexts[$i]##*/}"
mkdir -p "${1}/${filename%.kext}/Root"
ditto --noextattr --noqtn --arch i386 "${kexts[$i]}" "${1}/${filename%.kext}/Root/${filename}"
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 "[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 kext packages
((xmlindent--))
outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
# End build Extras 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
echo "[BUILD] Post "
buildpackage "${1}/Post" "/" "" "start_visible=\"false\" start_selected=\"true\"" >/dev/null 2>&1
outline[$((outlinecount++))]="${indent[$xmlindent]}</choices-outline>"
# build meta package
makedistribution "${1}" "${2}" "${3}" "${4}" "${5}"
# clean up
rm -R -f "${1}"
}
fixperms ()
{
# $1 path
find "${1}" -type f -exec chmod 644 {} \;
find "${1}" -type d -exec chmod 755 {} \;
chown -R 0:0 "${1}"
}
buildpackage ()
{
# $1 Path to package to build containing Root and or Scripts
# $2 Install Location
# $3 Size
# $4 Options
if [ -d "${1}/Root" ] && [ "${1}/Scripts" ]; then
local packagename="${1##*/}"
local identifier=$( echo ${packagesidentity}.${packagename//_/.} | tr [:upper:] [:lower:] )
find "${1}" -name '.DS_Store' -delete
local filecount=$( find "${1}/Root" | wc -l )
if [ "${3}" ]; then
local installedsize="${3}"
else
local installedsize=$( du -hkc "${1}/Root" | tail -n1 | awk {'print $1'} )
fi
local header="<?xml version=\"1.0\"?>\n<pkg-info format-version=\"2\" "
#[ "${3}" == "relocatable" ] && header+="relocatable=\"true\" "
header+="identifier=\"${identifier}\" "
header+="version=\"${version}\" "
[ "${2}" != "relocatable" ] && header+="install-location=\"${2}\" "
header+="auth=\"root\">\n"
header+="\t<payload installKBytes=\"${installedsize##* }\" numberOfFiles=\"${filecount##* }\"/>\n"
rm -R -f "${1}/Temp"
[ -d "${1}/Temp" ] || mkdir -m 777 "${1}/Temp"
[ -d "${1}/Root" ] && mkbom "${1}/Root" "${1}/Temp/Bom"
if [ -d "${1}/Scripts" ]; then
header+="\t<scripts>\n"
for script in $( find "${1}/Scripts" -type f \( -name 'pre*' -or -name 'post*' \) )
do
header+="\t\t<${script##*/} file=\"./${script##*/}\"/>\n"
done
header+="\t</scripts>\n"
chown -R 0:0 "${1}/Scripts"
pushd "${1}/Scripts" >/dev/null
find . -print | cpio -o -z -H cpio > "../Temp/Scripts"
popd >/dev/null
fi
header+="</pkg-info>"
echo -e "${header}" > "${1}/Temp/PackageInfo"
pushd "${1}/Root" >/dev/null
find . -print | cpio -o -z -H cpio > "../Temp/Payload"
popd >/dev/null
pushd "${1}/Temp" >/dev/null
xar -c -f "${1%/*}/${packagename// /}.pkg" --compression none .
popd >/dev/null
outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"${packagename// /}\"/>"
if [ "${4}" ]; then
local choiceoptions="${indent[$xmlindent]}${4}\n"
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}"
fi
}
makedistribution ()
{
rm -f "${1%/*}/${packagename// /}"*.pkg
find "${1}" -type f -name '*.pkg' -depth 1 | while read component
do
mkdir -p "${1}/${packagename}/${component##*/}"
pushd "${1}/${packagename}/${component##*/}" >/dev/null
xar -x -f "${1%}/${component##*/}"
popd >/dev/null
done
ditto --noextattr --noqtn "${pkgroot}/Distribution" "${1}/${packagename}/Distribution"
ditto --noextattr --noqtn "${pkgroot}/Resources" "${1}/${packagename}/Resources"
find "${1}/${packagename}/Resources" -type d -name '.svn' -exec rm -R -f {} \; 2>/dev/null
for (( i=0; i < ${#outline[*]} ; i++));
do
echo -e "${outline[$i]}" >> "${1}/${packagename}/Distribution"
done
for (( i=0; i < ${#choices[*]} ; i++));
do
echo -e "${choices[$i]}" >> "${1}/${packagename}/Distribution"
done
echo "</installer-gui-script>" >> "${1}/${packagename}/Distribution"
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`
#
# Adding Developer and credits
perl -i -p -e "s/%DEVELOP%/${develop}/g" `find "${1}/${packagename}/Resources" -type f`
perl -i -p -e "s/%CREDITS%/${credits}/g" `find "${1}/${packagename}/Resources" -type f`
#
stage=${stage/RC/Release Candidate }
stage=${stage/FINAL/2.0 Final}
perl -i -p -e "s/%CHAMELEONSTAGE%/${stage}/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}-r${revision}.pkg" --compression none .
popd >/dev/null
# Here is the place for assign a Icon to the pkg
# command use to generate the file:
# ditto -c -k --sequesterRsrc --keepParent Icon.icns Icon.zip
ditto -xk "${pkgroot}/Icons/pkg.zip" "${pkgroot}/Icons/"
DeRez -only icns "${pkgroot}/Icons/Icons/pkg.icns" > tempicns.rsrc
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}/Icons/Icons"
# End
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"--------------------------"$COL_RESET
echo -e $COL_BLACK"Building process complete!"$COL_RESET
echo -e $COL_BLACK"--------------------------"$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}"
branches/iFabio/Chameleon/CREDITS
33
44
55
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
6
237
248
259
26
27
28
29
30
31
32
33
34
35
36
37
38
10
11
Developers:
----------
Crazor
Dense
fassl
iNDi
JrCs
Kabyl
kaitek
mackerintel
mercurysquad
munky
meklort
mozodojo
rekursor
Turbo
valv
zef
cparm
zef, Turbo, dfe, netkas, mackerintel, fassl, Kabyl, kaitek, iNDi, asereBLN, mozodojo, meklort, AzimutZ, Slice
Thanks to:
---------
asereBLN
Azimutz
bumby
cosmo1t
dfe
Galaxy
kalyway
Krazubu
MasterChief
netkas
sckevyn
smith@@
THeKiNG
JrCs, mercurysquad, munky, rekursor, cosmolt, kalyway, Krazubu, THeKiNG, XyZ, blackosx, DHP, cparm
branches/iFabio/Chameleon/Makefile
1919
2020
2121
22
2223
2324
2425
......
8990
9091
9192
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
92122
93123
94124
......
97127
98128
99129
100
130
101131
102132
103133
104134
105
106
135
136
107137
108138
109139
110140
111141
142
112143
113144
PRODUCT = Chameleon-$(VERSION)-r$(REVISION)
CDLABEL = ${PRODUCT}
ISOIMAGE = ${SYMROOT}/${CDLABEL}.iso
DISTFILE = ${SYMROOT}/${PRODUCT}
EXCLUDE = --exclude=.svn --exclude=.DS_Store --exclude=sym --exclude=obj \
--exclude=package --exclude=archive --exclude=User_Guide_src --exclude=*.sh
fi; \
done
dist image: all
@echo "================= Distrib ================="
@echo "\t[RM] ${IMGROOT}"
@rm -rf ${IMGROOT}
@echo "\t[MKDIR] ${IMGROOT}/usr/standalone/i386"
@mkdir -p ${IMGROOT}/usr/standalone/i386
@echo "\t[MKDIR] ${IMGROOT}/Extra/modules"
@mkdir -p ${IMGROOT}/Extra/modules
@if [ -e "$(IMGSKELROOT)" ]; then\
@echo "\t[CP] ${IMGROOTSKEL} ${IMGROOT}"\
@cp -R -f "${IMGSKELROOT}"/* "${IMGROOT}";\
fi;
@cp -f ${SYMROOT}/i386/cdboot ${CDBOOT}
@cp -f ${SYMROOT}/i386/modules/* ${IMGROOT}/Extra/modules
@cp -f ${SYMROOT}/i386/boot ${IMGROOT}/usr/standalone/i386
@cp -f ${SYMROOT}/i386/boot0 ${IMGROOT}/usr/standalone/i386
@cp -f ${SYMROOT}/i386/boot0md ${IMGROOT}/usr/standalone/i386
@cp -f ${SYMROOT}/i386/boot1h ${IMGROOT}/usr/standalone/i386
@cp -f ${SYMROOT}/i386/boot1f32 ${IMGROOT}/usr/standalone/i386
@echo "\t[HDIUTIL] ${ISOIMAGE}"
@hdiutil makehybrid -iso -joliet -hfs -hfs-volume-name \
${CDLABEL} -eltorito-boot ${CDBOOT} -no-emul-boot -ov -o \
"${ISOIMAGE}" ${IMGROOT} -quiet
@echo "\t[GZ] ${DISTFILE}.tar.gz"
@rm -f ${DISTFILE}.tar.gz
@tar -cf ${DISTFILE}.tar ${IMGROOT}
@gzip --best ${DISTFILE}.tar
$(SYMROOT)/i386/vers.h: version
@echo "#define I386BOOT_VERSION \"5.0.132\"" > $@
@echo "#define I386BOOT_BUILDDATE \"`date \"+%Y-%m-%d %H:%M:%S\"`\"" >> $@
pkg: all
@if [ -e "$(SYMROOT)" ]; then \
"${SRCROOT}/package/buildpkg" "${SYMROOT}/package"; \
${SRCROOT}/package/buildpkg.sh ${SYMROOT}/package; \
fi;
dmg: all
@if [ -e "$(SYMROOT)" ]; then \
"${SRCROOT}/package/slimpkg" "${SYMROOT}/package"; \
"${SRCROOT}/package/builddmg" "${SYMROOT}/package"; \
${SRCROOT}/package/slimpkg.sh ${SYMROOT}/package; \
${SRCROOT}/package/builddmg.sh ${SYMROOT}/package; \
fi;
.PHONY: $(SYMROOT)/i386/vers.h
.PHONY: config
.PHONY: clean
.PHONY: image
.PHONY: pkg
.PHONY: dmg

Archive Download the corresponding diff file

Revision: 330