Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/package/buildpkg.sh

  • Property svn:executable set to *
1#!/bin/bash
2
3# $1 Path to store built package
4
5packagesidentity="org.chameleon"
6
7packagename="Chameleon"
8
9pkgroot="${0%/*}"
10
11COL_BLACK="\x1b[30;01m"
12COL_RED="\x1b[31;01m"
13COL_GREEN="\x1b[32;01m"
14COL_YELLOW="\x1b[33;01m"
15COL_MAGENTA="\x1b[35;01m"
16COL_CYAN="\x1b[36;01m"
17COL_WHITE="\x1b[37;01m"
18COL_BLUE="\x1b[34;01m"
19COL_RESET="\x1b[39;49;00m"
20
21#version=$( grep I386BOOT_CHAMELEONVERSION sym/i386/vers.h | awk '{ print $3 }' | tr -d '\"' )
22version=$( cat version )
23stage=${version##*-}
24revision=$( grep I386BOOT_CHAMELEONREVISION sym/i386/vers.h | awk '{ print $3 }' | tr -d '\"' )
25builddate=$( grep I386BOOT_BUILDDATE sym/i386/vers.h | awk '{ print $3,$4 }' | tr -d '\"' )
26timestamp=$( date -j -f "%Y-%m-%d %H:%M:%S" "${builddate}" "+%s" )
27
28# =================
29
30develop=" Crazor, Dense, fassl, fxtentacle, iNDi, JrCs, Kabyl, kaitek, mackerintel, mercurysquad, munky, Slice, meklort, mozodojo, rekursor, Turbo, cparm, valv & zef "
31
32credits=" andyvand, asereBLN, Azimut, bumby, cosmo1t, dfe, Galaxy, kalyway, Krazubu, MasterChief, netkas, sckevyn, smith@@, THeKiNG, DutchHockeyPro & Andy"
33
34pkgdev=" blackosx, ErmaC , scrax"
35
36# =================
37
38distributioncount=0
39xmlindent=0
40
41indent[0]="\t"
42indent[1]="\t\t"
43indent[2]="\t\t\t"
44indent[3]="\t\t\t\t"
45
46main ()
47{
48
49# clean up the destination path
50
51rm -R -f "${1}"
52echo ""
53echo -e $COL_BLACK"----------------------------------"$COL_RESET
54echo -e $COL_BLACK"Building $packagename Install Package"$COL_RESET
55echo -e $COL_BLACK"----------------------------------"$COL_RESET
56echo ""
57
58outline[$((outlinecount++))]="${indent[$xmlindent]}<choices-outline>"
59
60# build core package
61echo "================= Core ================="
62((xmlindent++))
63packagesidentity="org.chameleon.core"
64mkdir -p ${1}/Core/Root/usr/sbin
65mkdir -p ${1}/Core/Root/usr/local/bin
66mkdir -p ${1}/Core/Root/usr/standalone/i386
67ditto --noextattr --noqtn ${1%/*}/i386/boot ${1}/Core/Root/usr/standalone/i386
68ditto --noextattr --noqtn ${1%/*}/i386/boot0 ${1}/Core/Root/usr/standalone/i386
69ditto --noextattr --noqtn ${1%/*}/i386/boot0md ${1}/Core/Root/usr/standalone/i386
70#ditto --noextattr --noqtn ${1%/*}/i386/boot0hf ${1}/Core/Root/usr/standalone/i386
71ditto --noextattr --noqtn ${1%/*}/i386/boot1f32 ${1}/Core/Root/usr/standalone/i386
72ditto --noextattr --noqtn ${1%/*}/i386/boot1h ${1}/Core/Root/usr/standalone/i386
73ditto --noextattr --noqtn ${1%/*}/i386/boot1he ${1}/Core/Root/usr/standalone/i386
74ditto --noextattr --noqtn ${1%/*}/i386/boot1hp ${1}/Core/Root/usr/standalone/i386
75ditto --noextattr --noqtn ${1%/*}/i386/cdboot ${1}/Core/Root/usr/standalone/i386
76ditto --noextattr --noqtn ${1%/*}/i386/chain0 ${1}/Core/Root/usr/standalone/i386
77# fixperms "${1}/Core/Root/"
78ditto --noextattr --noqtn ${1%/*}/i386/fdisk440 ${1}/Core/Root/usr/sbin
79ditto --noextattr --noqtn ${1%/*}/i386/bdmesg ${1}/Core/Root/usr/sbin
80local coresize=$( du -hkc "${1}/Core/Root" | tail -n1 | awk {'print $1'} )
81echo "[BUILD] i386 "
82buildpackage "${1}/Core" "/" "0" "start_visible=\"false\" start_selected=\"true\"" >/dev/null 2>&1
83
84# build Chameleon package
85echo "================= Chameleon ================="
86outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Chameleon\">"
87choices[$((choicescount++))]="<choice\n\tid=\"Chameleon\"\n\ttitle=\"Chameleon_title\"\n\tdescription=\"Chameleon_description\"\n>\n</choice>\n"
88
89# build standard package
90mkdir -p ${1}/Standard/Root
91mkdir -p ${1}/Standard/Scripts/Tools
92cp -f ${pkgroot}/Scripts/Standard/* ${1}/Standard/Scripts
93# ditto --arch i386 `which SetFile` ${1}/Standard/Scripts/Tools/SetFile
94echo "[BUILD] Standard "
95buildpackage "${1}/Standard" "/" "${coresize}" "start_enabled=\"true\" start_selected=\"upgrade_allowed()\" selected=\"exclusive(choices['EFI']) &amp;&amp; exclusive(choices['noboot'])\"" >/dev/null 2>&1
96# End build standard package
97
98# build efi package
99mkdir -p ${1}/EFI/Root
100mkdir -p ${1}/EFI/Scripts/Tools
101cp -f ${pkgroot}/Scripts/EFI/* ${1}/EFI/Scripts
102# ditto --arch i386 `which SetFile` ${1}/EFI/Scripts/Tools/SetFile
103echo "[BUILD] EFI "
104buildpackage "${1}/EFI" "/" "${coresize}" "start_visible=\"systemHasGPT()\" start_selected=\"false\" selected=\"exclusive(choices['Standard']) &amp;&amp; exclusive(choices['noboot'])\"" >/dev/null 2>&1
105# End build efi package
106
107# build reset choice package
108mkdir -p ${1}/noboot/Root
109echo "[BUILD] Reset choice "
110buildpackage "${1}/noboot" "/tmpcham" "" "start_visible=\"true\" start_selected=\"false\" selected=\"exclusive(choices['Standard']) &amp;&amp; exclusive(choices['EFI'])\"" >/dev/null 2>&1
111# End build reset choice package
112
113# build Modules package
114 echo "================= Modules ================="
115 ###############################
116 # Supported Modules #
117 ###############################
118 # AMDGraphicsEnabler.dylib #
119 # ATiGraphicsEnabler.dylib #
120 # IntelGraphicsEnabler.dylib #
121 # klibc.dylib #
122 # NVIDIAGraphicsEnabler.dylib #
123 # Resolution.dylib #
124 # uClibcxx.dylib #
125 ###############################
126 if [ "$(ls -A "${1%/*}/i386/modules")" ]; then
127 {
128 outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Module\">"
129 choices[$((choicescount++))]="<choice\n\tid=\"Module\"\n\ttitle=\"Module_title\"\n\tdescription=\"Module_description\"\n>\n</choice>\n"
130 ((xmlindent++))
131 packagesidentity="org.chameleon.modules"
132# -
133 if [ -e ${1%/*}/i386/modules/AMDGraphicsEnabler.dylib ]; then
134 {
135 mkdir -p ${1}/AMDGraphicsEnabler/Root
136 ditto --noextattr --noqtn ${1%/*}/i386/modules/AMDGraphicsEnabler.dylib ${1}/AMDGraphicsEnabler/Root
137 echo "[BUILD] AMDGraphicsEnabler "
138 buildpackage "${1}/AMDGraphicsEnabler" "/Extra/modules" "" "start_selected=\"false\"" >/dev/null 2>&1
139 }
140 fi
141# -
142 if [ -e ${1%/*}/i386/modules/ATiGraphicsEnabler.dylib ]; then
143 {
144 mkdir -p ${1}/ATiGraphicsEnabler/Root
145 ditto --noextattr --noqtn ${1%/*}/i386/modules/ATiGraphicsEnabler.dylib ${1}/ATiGraphicsEnabler/Root
146 echo "[BUILD] ATiGraphicsEnabler "
147 buildpackage "${1}/ATiGraphicsEnabler" "/Extra/modules" "" "start_selected=\"false\"" >/dev/null 2>&1
148 }
149 fi
150# -
151 if [ -e ${1%/*}/i386/modules/IntelGraphicsEnabler.dylib ]; then
152 {
153 mkdir -p ${1}/IntelGraphicsEnabler/Root
154 ditto --noextattr --noqtn ${1%/*}/i386/modules/IntelGraphicsEnabler.dylib ${1}/IntelGraphicsEnabler/Root
155 echo "[BUILD] IntelGraphicsEnabler "
156 buildpackage "${1}/IntelGraphicsEnabler" "/Extra/modules" "" "start_selected=\"false\"" >/dev/null 2>&1
157 }
158 fi
159# -
160 if [ -e ${1%/*}/i386/modules/klibc.dylib ]; then
161 {
162 mkdir -p ${1}/klibc/Root
163 ditto --noextattr --noqtn ${1%/*}/i386/modules/klibc.dylib ${1}/klibc/Root
164 echo "[BUILD] klibc "
165 buildpackage "${1}/klibc" "/Extra/modules" "" "start_selected=\"true\"" >/dev/null 2>&1
166 }
167 fi
168# -
169 if [ -e ${1%/*}/i386/modules/NVIDIAGraphicsEnabler.dylib ]; then
170 {
171 mkdir -p ${1}/NVIDIAGraphicsEnabler/Root
172 ditto --noextattr --noqtn ${1%/*}/i386/modules/NVIDIAGraphicsEnabler.dylib ${1}/NVIDIAGraphicsEnabler/Root
173 echo "[BUILD] NVIDIAGraphicsEnabler "
174 buildpackage "${1}/NVIDIAGraphicsEnabler" "/Extra/modules" "" "start_selected=\"false\"" >/dev/null 2>&1
175 }
176 fi
177# -
178 if [ -e ${1%/*}/i386/modules/Resolution.dylib ]; then
179 {
180 mkdir -p ${1}/AutoReso/Root
181 ditto --noextattr --noqtn ${1%/*}/i386/modules/Resolution.dylib ${1}/AutoReso/Root
182 echo "[BUILD] Resolution "
183 buildpackage "${1}/AutoReso" "/Extra/modules" "" "start_selected=\"false\"" >/dev/null 2>&1
184 }
185 fi
186# -
187 if [ -e ${1%/*}/i386/modules/uClibcxx.dylib ]; then
188 {
189 mkdir -p ${1}/uClibc/Root
190 ditto --noextattr --noqtn ${1%/*}/i386/modules/uClibcxx.dylib ${1}/uClibc/Root
191 ditto --noextattr --noqtn ${1%/*}/i386/modules/klibc.dylib ${1}/uClibc/Root
192 echo "[BUILD] uClibc++ "
193 buildpackage "${1}/uClibc" "/Extra/modules" "" "start_selected=\"true\"" >/dev/null 2>&1
194 }
195 fi
196 ((xmlindent--))
197 outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
198 }
199 else
200 {
201 echo " -= no modules to include =-"
202 }
203 fi
204# End build Modules packages
205 ((xmlindent--))
206 outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
207# End build Chameleon package
208
209# build Extras package
210echo "================= Extras ================="
211outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Extras\">"
212choices[$((choicescount++))]="<choice\n\tid=\"Extras\"\n\ttitle=\"Extras_title\"\n\tdescription=\"Extras_description\"\n>\n</choice>\n"
213((xmlindent++))
214packagesidentity="org.chameleon.extras"
215
216# build utility package
217outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Utility\">"
218choices[$((choicescount++))]="<choice\n\tid=\"Utility\"\n\ttitle=\"Utility_title\"\n\tdescription=\"Utility_description\"\n>\n</choice>\n"
219((xmlindent++))
220packagesidentity="org.chameleon.utilities"
221
222# build package for Chameleon PrefPanel
223mkdir -p "${1}/PrefPanel/Root"
224ditto --noextattr --noqtn "${pkgroot}/Configuration/PrefPanel/Chameleon.prefPane" "${1}/PrefPanel/Root"
225echo "[BUILD] Chameleon Preference Panel "
226buildpackage "${1}/PrefPanel" "/Library/PreferencePanes/Chameleon.prefPane" "" "start_selected=\"false\"" >/dev/null 2>&1
227# End build package for Chameleon PrefPanel
228
229# build package for SMBIOSDefault
230mkdir -p "${1}/SMBIOSDefault/Root"
231ditto --noextattr --noqtn "${pkgroot}/Configuration/SMBIOSDefault/smbios.plist" "${1}/SMBIOSDefault/Root"
232echo "[BUILD] SMBIOSDefault "
233buildpackage "${1}/SMBIOSDefault" "/Extra/Example" "" "start_selected=\"false\"" >/dev/null 2>&1
234# End build package for SMBIOSDefault
235
236# build package for Documentation
237mkdir -p "${1}/Documentation/Root"
238cp -f ${pkgroot}/../doc/BootHelp.txt ${1}/Documentation/Root
239cp -f ${pkgroot}/../doc/README ${1}/Documentation/Root
240cp -f ${pkgroot}/../doc/Users_Guide0.5.pdf ${1}/Documentation/Root
241echo "[BUILD] Documentation "
242buildpackage "${1}/Documentation" "/Library/Documentation/Chameleon2RC5" "" "start_selected=\"false\"" >/dev/null 2>&1
243# End build package for Documentation
244
245((xmlindent--))
246outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
247# End utility package
248
249# build options packages
250echo "================= Options ================="
251outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Options\">"
252choices[$((choicescount++))]="<choice\n\tid=\"Options\"\n\ttitle=\"Options_title\"\n\tdescription=\"Options_description\"\n>\n</choice>\n"
253((xmlindent++))
254
255# build base options packages
256packagesidentity="org.chameleon.options"
257
258options=($( find "${pkgroot}/Scripts/BaseOptions" -type d -depth 1 -not -name '.svn' ))
259for (( i = 0 ; i < ${#options[@]} ; i++ ))
260do
261mkdir -p "${1}/${options[$i]##*/}/Root"
262mkdir -p "${1}/${options[$i]##*/}/Scripts"
263ditto --noextattr --noqtn "${options[$i]}/postinstall" "${1}/${options[$i]##*/}/Scripts/postinstall"
264echo "[BUILD] ${options[$i]##*/} "
265buildpackage "${1}/${options[$i]##*/}" "/" "" "start_selected=\"false\"" >/dev/null 2>&1
266done
267# End build base options packages
268
269# build resolution packages
270echo "================= Res. Options ================="
271outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Resolution\">"
272choices[$((choicescount++))]="<choice\n\tid=\"Resolution\"\n\ttitle=\"Resolution_title\"\n\tdescription=\"Resolution_description\"\n>\n</choice>\n"
273((xmlindent++))
274packagesidentity="org.chameleon.options.resolution"
275resolutions=($( find "${pkgroot}/Scripts/Resolutions" -type d -depth 1 -not -name '.svn' ))
276for (( i = 0 ; i < ${#resolutions[@]} ; i++ ))
277do
278mkdir -p "${1}/${resolutions[$i]##*/}/Root/"
279mkdir -p "${1}/${resolutions[$i]##*/}/Scripts/"
280ditto --noextattr --noqtn "${resolutions[$i]}/postinstall" "${1}/${resolutions[$i]##*/}/Scripts/postinstall"
281echo "[BUILD] ${resolutions[$i]##*/} "
282buildpackage "${1}/${resolutions[$i]##*/}" "/tmpcham" "" "start_selected=\"false\"" >/dev/null 2>&1
283done
284
285((xmlindent--))
286outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
287# End build resolution packages
288
289# build Advanced packages
290echo "================= Adv. Options ================="
291outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Advanced\">"
292choices[$((choicescount++))]="<choice\n\tid=\"Advanced\"\n\ttitle=\"Advanced_title\"\n\tdescription=\"Advanced_description\"\n>\n</choice>\n"
293((xmlindent++))
294
295packagesidentity="org.chameleon.options.advanced"
296optionsadv=($( find "${pkgroot}/Scripts/Advanced" -type d -depth 1 -not -name '.svn' ))
297for (( i = 0 ; i < ${#optionsadv[@]} ; i++ ))
298do
299mkdir -p "${1}/${optionsadv[$i]##*/}/Root"
300mkdir -p "${1}/${optionsadv[$i]##*/}/Scripts"
301ditto --noextattr --noqtn "${optionsadv[$i]}/postinstall" "${1}/${optionsadv[$i]##*/}/Scripts/postinstall"
302echo "[BUILD] ${optionsadv[$i]##*/} "
303buildpackage "${1}/${optionsadv[$i]##*/}" "/" "" "start_selected=\"false\"" >/dev/null 2>&1
304done
305
306((xmlindent--))
307outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
308# End build Advanced packages
309
310((xmlindent--))
311outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
312
313# End build options packages
314
315# build theme packages
316echo "================= Themes ================="
317outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"Themes\">"
318choices[$((choicescount++))]="<choice\n\tid=\"Themes\"\n\ttitle=\"Themes_title\"\n\tdescription=\"Themes_description\"\n>\n</choice>\n"
319((xmlindent++))
320packagesidentity="org.chameleon.themes"
321artwork="${1%/*}"
322themes=($( find "${artwork%/*}/artwork/themes" -type d -depth 1 -not -name '.svn' ))
323for (( i = 0 ; i < ${#themes[@]} ; i++ ))
324do
325theme=$( echo ${themes[$i]##*/} | awk 'BEGIN{OFS=FS=""}{$1=toupper($1);print}' )
326mkdir -p "${1}/${theme}/Root/"
327 rsync -r --exclude=.svn "${themes[$i]}" "${1}/${themes[$i]##*/}/Root/${theme}"
328 # #### Comment out thx meklort
329 # ditto --noextattr --noqtn "${themes[$i]}" "${1}/${themes[$i]##*/}/Root/${theme}"
330 # ####
331 find "${1}/${themes[$i]##*/}" -name '.DS_Store' -or -name '.svn' -exec rm -R {} \+
332find "${1}/${themes[$i]##*/}" -type f -exec chmod 644 {} \+
333echo "[BUILD] ${themes[$i]##*/} "
334buildpackage "${1}/${theme}" "/Extra/Themes" "" "start_selected=\"false\"" >/dev/null 2>&1
335rm -R -f "${1}/${i##*/}"
336done
337
338((xmlindent--))
339outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
340# End build theme packages
341
342((xmlindent--))
343outline[$((outlinecount++))]="${indent[$xmlindent]}\t</line>"
344# End build Extras package
345
346# build post install package
347echo "================= Post ================="
348mkdir -p ${1}/Post/Root
349mkdir -p ${1}/Post/Scripts
350cp -f ${pkgroot}/Scripts/Post/* ${1}/Post/Scripts
351echo "[BUILD] Post "
352buildpackage "${1}/Post" "/" "" "start_visible=\"false\" start_selected=\"true\"" >/dev/null 2>&1
353outline[$((outlinecount++))]="${indent[$xmlindent]}</choices-outline>"
354
355# build meta package
356
357makedistribution "${1}" "${2}" "${3}" "${4}" "${5}"
358
359# clean up
360
361rm -R -f "${1}"
362
363}
364
365fixperms ()
366{
367# $1 path
368find "${1}" -type f -exec chmod 644 {} \;
369find "${1}" -type d -exec chmod 755 {} \;
370chown -R 0:0 "${1}"
371}
372
373buildpackage ()
374{
375# $1 Path to package to build containing Root and or Scripts
376# $2 Install Location
377# $3 Size
378# $4 Options
379
380if [ -d "${1}/Root" ] && [ "${1}/Scripts" ]; then
381
382local packagename="${1##*/}"
383local identifier=$( echo ${packagesidentity}.${packagename//_/.} | tr [:upper:] [:lower:] )
384find "${1}" -name '.DS_Store' -delete
385local filecount=$( find "${1}/Root" | wc -l )
386if [ "${3}" ]; then
387local installedsize="${3}"
388else
389local installedsize=$( du -hkc "${1}/Root" | tail -n1 | awk {'print $1'} )
390fi
391local header="<?xml version=\"1.0\"?>\n<pkg-info format-version=\"2\" "
392
393#[ "${3}" == "relocatable" ] && header+="relocatable=\"true\" "
394
395header+="identifier=\"${identifier}\" "
396header+="version=\"${version}\" "
397
398[ "${2}" != "relocatable" ] && header+="install-location=\"${2}\" "
399
400header+="auth=\"root\">\n"
401header+="\t<payload installKBytes=\"${installedsize##* }\" numberOfFiles=\"${filecount##* }\"/>\n"
402rm -R -f "${1}/Temp"
403
404[ -d "${1}/Temp" ] || mkdir -m 777 "${1}/Temp"
405[ -d "${1}/Root" ] && mkbom "${1}/Root" "${1}/Temp/Bom"
406
407if [ -d "${1}/Scripts" ]; then
408header+="\t<scripts>\n"
409for script in $( find "${1}/Scripts" -type f \( -name 'pre*' -or -name 'post*' \) )
410do
411header+="\t\t<${script##*/} file=\"./${script##*/}\"/>\n"
412done
413header+="\t</scripts>\n"
414chown -R 0:0 "${1}/Scripts"
415pushd "${1}/Scripts" >/dev/null
416find . -print | cpio -o -z -H cpio > "../Temp/Scripts"
417popd >/dev/null
418fi
419
420header+="</pkg-info>"
421echo -e "${header}" > "${1}/Temp/PackageInfo"
422pushd "${1}/Root" >/dev/null
423find . -print | cpio -o -z -H cpio > "../Temp/Payload"
424popd >/dev/null
425pushd "${1}/Temp" >/dev/null
426
427xar -c -f "${1%/*}/${packagename// /}.pkg" --compression none .
428
429popd >/dev/null
430
431outline[$((outlinecount++))]="${indent[$xmlindent]}\t<line choice=\"${packagename// /}\"/>"
432
433if [ "${4}" ]; then
434local choiceoptions="${indent[$xmlindent]}${4}\n"
435fi
436choices[$((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"
437
438rm -R -f "${1}"
439fi
440}
441
442makedistribution ()
443{
444rm -f "${1%/*}/${packagename// /}"*.pkg
445
446find "${1}" -type f -name '*.pkg' -depth 1 | while read component
447do
448mkdir -p "${1}/${packagename}/${component##*/}"
449pushd "${1}/${packagename}/${component##*/}" >/dev/null
450xar -x -f "${1%}/${component##*/}"
451popd >/dev/null
452done
453
454ditto --noextattr --noqtn "${pkgroot}/Distribution" "${1}/${packagename}/Distribution"
455ditto --noextattr --noqtn "${pkgroot}/Resources" "${1}/${packagename}/Resources"
456
457find "${1}/${packagename}/Resources" -type d -name '.svn' -exec rm -R -f {} \; 2>/dev/null
458
459for (( i=0; i < ${#outline[*]} ; i++));
460do
461echo -e "${outline[$i]}" >> "${1}/${packagename}/Distribution"
462done
463
464for (( i=0; i < ${#choices[*]} ; i++));
465do
466echo -e "${choices[$i]}" >> "${1}/${packagename}/Distribution"
467done
468
469echo "</installer-gui-script>" >> "${1}/${packagename}/Distribution"
470
471perl -i -p -e "s/%CHAMELEONVERSION%/${version%%-*}/g" `find "${1}/${packagename}/Resources" -type f`
472perl -i -p -e "s/%CHAMELEONREVISION%/${revision}/g" `find "${1}/${packagename}/Resources" -type f`
473
474# Adding Developer and credits
475perl -i -p -e "s/%DEVELOP%/${develop}/g" `find "${1}/${packagename}/Resources" -type f`
476perl -i -p -e "s/%CREDITS%/${credits}/g" `find "${1}/${packagename}/Resources" -type f`
477perl -i -p -e "s/%PKGDEV%/${pkgdev}/g" `find "${1}/${packagename}/Resources" -type f`
478
479stage=${stage/RC/Release Candidate }
480stage=${stage/FINAL/2.0 Final}
481perl -i -p -e "s/%CHAMELEONSTAGE%/${stage}/g" `find "${1}/${packagename}/Resources" -type f`
482
483find "${1}/${packagename}" -name '.DS_Store' -delete
484pushd "${1}/${packagename}" >/dev/null
485xar -c -f "${1%/*}/${packagename// /}-${version}-r${revision}.pkg" --compression none .
486popd >/dev/null
487
488# Here is the place for assign a Icon to the pkg
489# command use to generate the file:
490# ditto -c -k --sequesterRsrc --keepParent Icon.icns Icon.zip
491# ----
492# ditto -xk "${pkgroot}/Icons/pkg.zip" "${pkgroot}/Icons/"
493# DeRez -only icns "${pkgroot}/Icons/Icons/pkg.icns" > tempicns.rsrc
494# Rez -append tempicns.rsrc -o "${1%/*}/${packagename// /}-${version}-r${revision}.pkg"
495# SetFile -a C "${1%/*}/${packagename// /}-${version}-r${revision}.pkg"
496# rm -f tempicns.rsrc
497# rm -rf "${pkgroot}/Icons/Icons"
498# End
499
500md5=$( md5 "${1%/*}/${packagename// /}-${version}-r${revision}.pkg" | awk {'print $4'} )
501echo "MD5 (${packagename// /}-${version}-r${revision}.pkg) = ${md5}" > "${1%/*}/${packagename// /}-${version}-r${revision}.pkg.md5"
502echo ""
503
504echo -e $COL_BLACK"--------------------------"$COL_RESET
505echo -e $COL_BLACK"Building process complete!"$COL_RESET
506echo -e $COL_BLACK"--------------------------"$COL_RESET
507echo ""
508echo -e $COL_BLACK"Build info."
509echo -e $COL_BLACK"==========="
510echo -e $COL_BLUE"Package name:"$COL_BLACK"$packagename-${version}-r$revision.pkg"$COL_RESET
511echo -e $COL_BLUE"MD5:"$COL_BLACK"$md5"$COL_RESET
512echo -e $COL_BLUE"Version:"$COL_BLACK"$version"$COL_RESET
513echo -e $COL_BLUE"Stage:"$COL_BLACK"$stage"$COL_RESET
514echo -e $COL_BLUE"Date/Time:"$COL_BLACK"$builddate"$COL_RESET
515echo ""
516
517}
518
519main "${1}" "${2}" "${3}" "${4}" "${5}"
520
521

Archive Download this file

Revision: 1360