Chameleon Applications

Chameleon Applications Svn Source Tree

Root/branches/iFabio/Chameleon/package/buildpkg.sh

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

Archive Download this file

Revision: 333