Chameleon

Chameleon Svn Source Tree

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

Archive Download this file

Revision: 1562