Chameleon

Chameleon Svn Source Tree

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

Archive Download this file

Revision: 1541