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

Archive Download this file

Revision: 1452