Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Trunk/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
11chamTemp="usr/local/chamTemp"
12
13COL_BLACK="\x1b[30;01m"
14COL_RED="\x1b[31;01m"
15COL_GREEN="\x1b[32;01m"
16COL_YELLOW="\x1b[33;01m"
17COL_MAGENTA="\x1b[35;01m"
18COL_CYAN="\x1b[36;01m"
19COL_WHITE="\x1b[37;01m"
20COL_BLUE="\x1b[34;01m"
21COL_RESET="\x1b[39;49;00m"
22
23#version=$( grep I386BOOT_CHAMELEONVERSION vers.h | awk '{ print $3 }' | tr -d '\"' )
24version=$( cat version )
25stage=${version##*-}
26revision=$( grep I386BOOT_CHAMELEONREVISION vers.h | awk '{ print $3 }' | tr -d '\"' )
27builddate=$( grep I386BOOT_BUILDDATE vers.h | awk '{ print $3,$4 }' | tr -d '\"' )
28timestamp=$( date -j -f "%Y-%m-%d %H:%M:%S" "${builddate}" "+%s" )
29
30# =================
31
32develop=$(awk "NR==6{print;exit}" ${pkgroot}/../CREDITS)
33credits=$(awk "NR==10{print;exit}" ${pkgroot}/../CREDITS)
34pkgdev=$(awk "NR==14{print;exit}" ${pkgroot}/../CREDITS)
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_CYAN"----------------------------------"$COL_RESET
54echo -e $COL_CYAN"Building $packagename Install Package"$COL_RESET
55echo -e $COL_CYAN"----------------------------------"$COL_RESET
56echo ""
57
58outline[$((outlinecount++))]="${indent[$xmlindent]}<choices-outline>"
59
60# build pre install package
61# This is run before any other package - so this could
62# be a good place to initialise the install log???
63echo "================= Preinstall ================="
64((xmlindent++))
65packagesidentity="org.chameleon"
66mkdir -p ${1}/Pre/Root
67mkdir -p ${1}/Pre/Scripts
68cp -f ${pkgroot}/Scripts/Main/preinstall ${1}/Pre/Scripts
69echo "[BUILD] Pre "
70buildpackage "${1}/Pre" "/" "" "start_visible=\"false\" start_selected=\"true\"" >/dev/null 2>&1
71# End build pre install package
72
73# build core package
74echo "================= Core ================="
75packagesidentity="org.chameleon"
76mkdir -p ${1}/Core/Root/usr/local/bin
77mkdir -p ${1}/Core/Root/usr/standalone/i386
78ditto --noextattr --noqtn ${1%/*}/i386/boot ${1}/Core/Root/usr/standalone/i386
79ditto --noextattr --noqtn ${1%/*}/i386/boot0 ${1}/Core/Root/usr/standalone/i386
80ditto --noextattr --noqtn ${1%/*}/i386/boot0md ${1}/Core/Root/usr/standalone/i386
81ditto --noextattr --noqtn ${1%/*}/i386/boot1f32 ${1}/Core/Root/usr/standalone/i386
82ditto --noextattr --noqtn ${1%/*}/i386/boot1h ${1}/Core/Root/usr/standalone/i386
83ditto --noextattr --noqtn ${1%/*}/i386/boot1he ${1}/Core/Root/usr/standalone/i386
84ditto --noextattr --noqtn ${1%/*}/i386/boot1hp ${1}/Core/Root/usr/standalone/i386
85ditto --noextattr --noqtn ${1%/*}/i386/cdboot ${1}/Core/Root/usr/standalone/i386
86ditto --noextattr --noqtn ${1%/*}/i386/chain0 ${1}/Core/Root/usr/standalone/i386
87ditto --noextattr --noqtn ${1%/*}/i386/fdisk440 ${1}/Core/Root/usr/local/bin
88ditto --noextattr --noqtn ${1%/*}/i386/bdmesg ${1}/Core/Root/usr/local/bin
89local coresize=$( du -hkc "${1}/Core/Root" | tail -n1 | awk {'print $1'} )
90echo "[BUILD] i386 "
91buildpackage "${1}/Core" "/" "0" "start_visible=\"false\" start_selected=\"true\"" >/dev/null 2>&1
92# End build core package
93
94# build Chameleon package
95echo "================= Chameleon ================="
96outline[$((outlinecount++))]="${indent[$xmlindent]}<line choice=\"Chameleon\">"
97choices[$((choicescount++))]="\t<choice\n\t\tid=\"Chameleon\"\n\t\ttitle=\"Chameleon_title\"\n\t\tdescription=\"Chameleon_description\">\n\t</choice>\n"
98((xmlindent++))
99
100# build standard package
101mkdir -p ${1}/Standard/Root
102mkdir -p ${1}/Standard/Scripts/Resources
103cp -f ${pkgroot}/Scripts/Main/Standard/* ${1}/Standard/Scripts
104cp -f ${pkgroot}/Scripts/Sub/* ${1}/Standard/Scripts
105ditto --arch i386 `which SetFile` ${1}/Standard/Scripts/Resources/SetFile
106ditto --noextattr --noqtn ${1%/*/*}/revision ${1}/Standard/Scripts/Resources/revision
107ditto --noextattr --noqtn ${1%/*/*}/version ${1}/Standard/Scripts/Resources/version
108echo "[BUILD] Standard "
109 buildpackage "${1}/Standard" "/" "${coresize}" "start_enabled=\"true\" start_selected=\"upgrade_allowed()\" selected=\"exclusive(choices['EFI']) &amp;&amp; exclusive(choices['noboot'])\"" >/dev/null 2>&1
110# End build standard package
111
112# build efi package
113mkdir -p ${1}/EFI/Root
114mkdir -p ${1}/EFI/Scripts/Resources
115cp -f ${pkgroot}/Scripts/Main/EFI/* ${1}/EFI/Scripts
116cp -f ${pkgroot}/Scripts/Sub/* ${1}/EFI/Scripts
117ditto --arch i386 `which SetFile` ${1}/EFI/Scripts/Resources/SetFile
118ditto --noextattr --noqtn ${1%/*/*}/revision ${1}/EFI/Scripts/Resources/revision
119ditto --noextattr --noqtn ${1%/*/*}/version ${1}/EFI/Scripts/Resources/version
120echo "[BUILD] EFI "
121buildpackage "${1}/EFI" "/" "${coresize}" "start_visible=\"systemHasGPT()\" start_selected=\"false\" selected=\"exclusive(choices['Standard']) &amp;&amp; exclusive(choices['noboot'])\"" >/dev/null 2>&1
122# End build efi package
123
124# build reset choice package
125mkdir -p ${1}/noboot/Root
126echo "[BUILD] Reset choice "
127buildpackage "${1}/noboot" "/$chamTemp" "" "start_visible=\"true\" start_selected=\"false\" selected=\"exclusive(choices['Standard']) &amp;&amp; exclusive(choices['EFI'])\"" >/dev/null 2>&1
128# End build reset choice package
129
130 ((xmlindent--))
131 outline[$((outlinecount++))]="${indent[$xmlindent]}</line>"
132# End build Chameleon package
133
134# build Modules package
135echo "================= Modules ================="
136###############################
137# Supported Modules #
138###############################
139# klibc.dylib #
140# Resolution.dylib #
141# uClibcxx.dylib #
142# Keylayout.dylib #
143###############################
144if [ "$(ls -A "${1%/*}/i386/modules")" ]; then
145{
146outline[$((outlinecount++))]="${indent[$xmlindent]}<line choice=\"Module\">"
147choices[$((choicescount++))]="\t<choice\n\t\tid=\"Module\"\n\t\ttitle=\"Module_title\"\n\t\tdescription=\"Module_description\">\n\t</choice>\n"
148((xmlindent++))
149packagesidentity="org.chameleon.modules"
150# -
151if [ -e ${1%/*}/i386/modules/klibc.dylib ]; then
152{
153mkdir -p ${1}/klibc/Root
154ditto --noextattr --noqtn ${1%/*}/i386/modules/klibc.dylib ${1}/klibc/Root
155echo "[BUILD] klibc "
156buildpackage "${1}/klibc" "/$chamTemp/Extra/modules" "" "start_selected=\"false\"" >/dev/null 2>&1
157}
158fi
159# -
160if [ -e ${1%/*}/i386/modules/uClibcxx.dylib ]; then
161{
162mkdir -p ${1}/uClibc/Root
163ditto --noextattr --noqtn ${1%/*}/i386/modules/uClibcxx.dylib ${1}/uClibc/Root
164ditto --noextattr --noqtn ${1%/*}/i386/modules/klibc.dylib ${1}/uClibc/Root
165echo "[BUILD] uClibc++ "
166buildpackage "${1}/uClibc" "/$chamTemp/Extra/modules" "" "start_selected=\"false\"" >/dev/null 2>&1
167}
168fi
169# -
170if [ -e ${1%/*}/i386/modules/Resolution.dylib ]; then
171{
172mkdir -p ${1}/AutoReso/Root
173ditto --noextattr --noqtn ${1%/*}/i386/modules/Resolution.dylib ${1}/AutoReso/Root
174echo "[BUILD] Resolution "
175buildpackage "${1}/AutoReso" "/$chamTemp/Extra/modules" "" "start_selected=\"false\"" >/dev/null 2>&1
176}
177fi
178# -
179if [ -e ${1%/*}/i386/modules/Keylayout.dylib ]; then
180{
181mkdir -p ${1}/Keylayout/Root
182ditto --noextattr --noqtn ${1%/*}/i386/modules/Keylayout.dylib ${1}/Keylayout/Root
183echo "[BUILD] Keylayout "
184buildpackage "${1}/Keylayout" "/$chamTemp/Extra/modules" "" "start_selected=\"false\"" >/dev/null 2>&1
185}
186fi
187
188((xmlindent--))
189outline[$((outlinecount++))]="${indent[$xmlindent]}</line>"
190}
191else
192{
193echo " -= no modules to include =-"
194}
195fi
196# End build Modules packages
197
198# build Extras package
199# build options packages
200
201outline[$((outlinecount++))]="${indent[$xmlindent]}<line choice=\"Options\">"
202choices[$((choicescount++))]="\t<choice\n\t\tid=\"Options\"\n\t\ttitle=\"Options_title\"\n\t\tdescription=\"Options_description\">\n\t</choice>\n"
203((xmlindent++))
204
205# ------------------------------------------------------
206# parse OptionalSettings folder to find files of boot options.
207# ------------------------------------------------------
208OptionalSettingsFolder="${pkgroot}/OptionalSettings"
209OptionalSettingsFiles=($( find "${OptionalSettingsFolder}" -depth 1 ! -name '.svn' ! -name '.DS_Store' ))
210
211for (( i = 0 ; i < ${#OptionalSettingsFiles[@]} ; i++ ))
212do
213
214# Take filename and Strip .txt from end and path from front
215builtOptionsList=$( echo ${OptionalSettingsFiles[$i]%.txt} )
216builtOptionsList=$( echo ${builtOptionsList##*/} )
217echo "================= $builtOptionsList ================="
218outline[$((outlinecount++))]="${indent[$xmlindent]}<line choice=\"${builtOptionsList}\">"
219choices[$((choicescount++))]="\t<choice\n\t\tid=\"${builtOptionsList}\"\n\t\ttitle=\"${builtOptionsList}_title\"\n\t\tdescription=\"${builtOptionsList}_description\">\n\t</choice>\n"
220((xmlindent++))
221packagesidentity="org.chameleon.options.$builtOptionsList"
222
223# ------------------------------------------------------
224# Read boot option file in to an array.
225# ------------------------------------------------------
226availableOptions=() # array to hold the list of boot options, per 'section'.
227exclusiveFlag=0 # used to indicate list has exclusive options.
228exclusiveName="" # will be appended to exclusive 'none' option name.
229count=0 # used as index for stepping through array.
230while read textLine
231do
232# ignore lines in the file beginning with a # and Exclusive=False
233if [[ ${textLine} != \#* ]] && [[ ${textLine} != "Exclusive=False" ]];then
234# check for 'Exclusive=True' option in file
235if [[ ${textLine} == "Exclusive=True" ]];then
236exclusiveFlag=1
237exclusiveName=$builtOptionsList
238else
239availableOptions[count]=$textLine
240((count++))
241fi
242fi
243done < ${OptionalSettingsFiles[$i]}
244buildoptionalsettings "$1" "${exclusiveFlag}" "${exclusiveName}"
245
246((xmlindent--))
247outline[$((outlinecount++))]="${indent[$xmlindent]}</line>"
248done
249
250# build KeyLayout options packages
251echo "================= Keymaps Options ================="
252outline[$((outlinecount++))]="${indent[$xmlindent]}<line choice=\"KeyLayout\">"
253choices[$((choicescount++))]="\t<choice\n\t\tid=\"KeyLayout\"\n\t\ttitle=\"KeyLayout_title\"\n\t\tdescription=\"KeyLayout_description\">\n\t</choice>\n"
254((xmlindent++))
255packagesidentity="org.chameleon.options.keylayout"
256
257# ------------------------------------------------------
258# Available Keylayout boot options are discovered by
259# reading contents of /Keymaps folder after compilation
260# ------------------------------------------------------
261availableOptions=()
262availableOptions=($( find "${1%/sym/*}/Keymaps" -type f -depth 1 -name '*.lyt' | sed 's|.*/||;s|\.lyt||' ))
263# Adjust array contents to match expected format
264# for boot options which is: name:key=value
265for (( i = 0 ; i < ${#availableOptions[@]} ; i++ ))
266do
267availableOptions[i]=${availableOptions[i]}":KeyLayout="${availableOptions[i]}
268done
269
270# to indicate exclusive option, call buildoptionalsettings with the 2nd parameter set to 1 .
271buildoptionalsettings "$1" "0" "keylayout"
272
273((xmlindent--))
274outline[$((outlinecount++))]="${indent[$xmlindent]}</line>"
275
276# End build KeyLayout options packages
277
278((xmlindent--))
279outline[$((outlinecount++))]="${indent[$xmlindent]}</line>"
280
281# End build options packages
282
283# build theme packages
284echo "================= Themes ================="
285outline[$((outlinecount++))]="${indent[$xmlindent]}<line choice=\"Themes\">"
286choices[$((choicescount++))]="\t<choice\n\t\tid=\"Themes\"\n\t\ttitle=\"Themes_title\"\n\t\tdescription=\"Themes_description\">\n\t</choice>\n"
287((xmlindent++))
288
289# Using themes section from Azi's/package branch.
290packagesidentity="org.chameleon.themes"
291artwork="${1%/sym/package}/artwork/themes"
292themes=($( find "${artwork}" -type d -depth 1 -not -name '.svn' ))
293for (( i = 0 ; i < ${#themes[@]} ; i++ ))
294do
295theme=$( echo ${themes[$i]##*/} | awk 'BEGIN{OFS=FS=""}{$1=toupper($1);print}' )
296mkdir -p "${1}/${theme}/Root/"
297rsync -r --exclude=.svn "${themes[$i]}/" "${1}/${theme}/Root/${theme}"
298echo "[BUILD] ${theme}"
299buildpackage "${1}/${theme}" "/$chamTemp/Extra/Themes" "" "start_selected=\"false\"" >/dev/null 2>&1
300done
301
302((xmlindent--))
303outline[$((outlinecount++))]="${indent[$xmlindent]}</line>"
304# End build theme packages
305# End build Extras package
306
307# build post install package
308echo "================= Post ================="
309packagesidentity="org.chameleon"
310mkdir -p ${1}/Post/Root
311mkdir -p ${1}/Post/Scripts
312cp -f ${pkgroot}/Scripts/Main/Post/* ${1}/Post/Scripts
313cp -f ${pkgroot}/Scripts/Sub/InstallLog.sh ${1}/Post/Scripts
314ditto --noextattr --noqtn ${1%/*/*}/revision ${1}/Post/Scripts/Resources/revision
315ditto --noextattr --noqtn ${1%/*/*}/version ${1}/Post/Scripts/Resources/version
316echo "[BUILD] Post "
317buildpackage "${1}/Post" "/" "" "start_visible=\"false\" start_selected=\"true\"" >/dev/null 2>&1
318# End build post install package
319
320((xmlindent--))
321outline[$((outlinecount++))]="${indent[$xmlindent]}</choices-outline>"
322
323# build meta package
324
325makedistribution "${1}" "${2}" "${3}" "${4}" #"${5}"
326
327# clean up
328
329rm -R -f "${1}"
330
331}
332
333fixperms ()
334{
335# $1 path
336find "${1}" -type f -exec chmod 644 {} \;
337find "${1}" -type d -exec chmod 755 {} \;
338chown -R 0:0 "${1}"
339}
340
341buildoptionalsettings()
342{
343# $1 Path to package to build containing Root and or Scripts
344# $2 = exclusiveFlag
345# S3 = exclusiveName
346
347# ------------------------------------------------------
348# if exclusiveFlag=1 then re-build array
349# adding extra boot option at beginning to give
350
351# ------------------------------------------------------
352if [ ${2} = "1" ]; then
353tempArray=("${availableOptions[@]}")
354availableOptions=()
355availableOptions[0]="ChooseNone-"$3":DONT=ADD"
356position=0
357totalItems="${#tempArray[@]}"
358for (( position = 0 ; position < $totalItems ; position++ ))
359do
360availableOptions[$position+1]=${tempArray[${position}]}
361done
362fi
363
364# ------------------------------------------------------
365# Loop through options in array and process each in turn
366# ------------------------------------------------------
367for (( c = 0 ; c < ${#availableOptions[@]} ; c++ ))
368do
369textLine=${availableOptions[c]}
370# split line - taking all before ':' as option name
371# and all after ':' as key/value
372optionName=${textLine%:*}
373keyValue=${textLine##*:}
374
375# create folders required for each boot option
376mkdir -p "${1}/$optionName/Root/"
377
378# create dummy file with name of key/value
379echo "" > "${1}/$optionName/Root/${keyValue}"
380
381echo "[BUILD] ${optionName} "
382
383# ------------------------------------------------------
384# Before calling buildpackage, add exclusive options
385# to buildpackage call if requested.
386# ------------------------------------------------------
387if [ $2 = "1" ]; then
388
389# Prepare individual string parts
390stringStart="selected=\""
391stringBefore="exclusive(choices['"
392stringAfter="']) &amp;&amp; "
393stringEnd="'])\""
394x=${stringStart}${stringBefore}
395
396# build string for sending to buildpackage
397totalItems="${#availableOptions[@]}"
398lastItem=$((totalItems-1))
399
400for (( r = 0 ; r < ${totalItems} ; r++ ))
401do
402textLineTemp=${availableOptions[r]}
403optionNameTemp=${textLineTemp%:*}
404if [ "${optionNameTemp}" != "${optionName}" ]; then
405 x="${x}${optionNameTemp}"
406 # Only add these to end of string up to the one before the last item
407if [ $r -lt $lastItem ]; then
408x="${x}${stringAfter}${stringBefore}"
409fi
410fi
411done
412x="${x}${stringEnd}"
413buildpackage "${1}/${optionName}" "/$chamTemp/options" "" "start_selected=\"false\" ${x}" >/dev/null 2>&1
414else
415buildpackage "${1}/${optionName}" "/$chamTemp/options" "" "start_selected=\"false\"" >/dev/null 2>&1
416fi
417done
418}
419
420buildpackage ()
421{
422# $1 Path to package to build containing Root and or Scripts
423# $2 Install Location
424# $3 Size
425# $4 Options
426
427if [ -d "${1}/Root" ] && [ "${1}/Scripts" ]; then
428
429local packagename="${1##*/}"
430local identifier=$( echo ${packagesidentity}.${packagename//_/.} | tr [:upper:] [:lower:] )
431find "${1}" -name '.DS_Store' -delete
432local filecount=$( find "${1}/Root" | wc -l )
433if [ "${3}" ]; then
434local installedsize="${3}"
435else
436local installedsize=$( du -hkc "${1}/Root" | tail -n1 | awk {'print $1'} )
437fi
438local header="<?xml version=\"1.0\"?>\n<pkg-info format-version=\"2\" "
439
440#[ "${3}" == "relocatable" ] && header+="relocatable=\"true\" "
441
442header+="identifier=\"${identifier}\" "
443header+="version=\"${version}\" "
444
445[ "${2}" != "relocatable" ] && header+="install-location=\"${2}\" "
446
447header+="auth=\"root\">\n"
448header+="\t<payload installKBytes=\"${installedsize##* }\" numberOfFiles=\"${filecount##* }\"/>\n"
449rm -R -f "${1}/Temp"
450
451[ -d "${1}/Temp" ] || mkdir -m 777 "${1}/Temp"
452[ -d "${1}/Root" ] && mkbom "${1}/Root" "${1}/Temp/Bom"
453
454if [ -d "${1}/Scripts" ]; then
455header+="\t<scripts>\n"
456for script in $( find "${1}/Scripts" -type f \( -name 'pre*' -or -name 'post*' \) )
457do
458header+="\t\t<${script##*/} file=\"./${script##*/}\"/>\n"
459done
460header+="\t</scripts>\n"
461chown -R 0:0 "${1}/Scripts"
462pushd "${1}/Scripts" >/dev/null
463find . -print | cpio -o -z -H cpio > "../Temp/Scripts"
464popd >/dev/null
465fi
466
467header+="</pkg-info>"
468echo -e "${header}" > "${1}/Temp/PackageInfo"
469pushd "${1}/Root" >/dev/null
470find . -print | cpio -o -z -H cpio > "../Temp/Payload"
471popd >/dev/null
472pushd "${1}/Temp" >/dev/null
473
474xar -c -f "${1%/*}/${packagename// /}.pkg" --compression none .
475
476popd >/dev/null
477
478outline[$((outlinecount++))]="${indent[$xmlindent]}<line choice=\"${packagename// /}\"/>"
479
480if [ "${4}" ]; then
481local choiceoptions="\t\t${4}"
482fi
483#choices[$((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"
484
485choices[$((choicescount++))]="\t<choice\n\t\tid=\"${packagename// /}\"\n\t\ttitle=\"${packagename}_title\"\n\t\tdescription=\"${packagename}_description\"\n${choiceoptions}>\n\t\t<pkg-ref id=\"${identifier}\" installKBytes='${installedsize}' version='${version}.0.0.${timestamp}' >#${packagename// /}.pkg</pkg-ref>\n\t</choice>\n"
486rm -R -f "${1}"
487fi
488}
489
490makedistribution ()
491{
492rm -f "${1%/*}/${packagename// /}"*.pkg
493
494find "${1}" -type f -name '*.pkg' -depth 1 | while read component
495do
496mkdir -p "${1}/${packagename}/${component##*/}"
497pushd "${1}/${packagename}/${component##*/}" >/dev/null
498xar -x -f "${1%}/${component##*/}"
499popd >/dev/null
500done
501
502ditto --noextattr --noqtn "${pkgroot}/Distribution" "${1}/${packagename}/Distribution"
503ditto --noextattr --noqtn "${pkgroot}/Resources" "${1}/${packagename}/Resources"
504
505find "${1}/${packagename}/Resources" -type d -name '.svn' -exec rm -R -f {} \; 2>/dev/null
506
507for (( i=0; i < ${#outline[*]} ; i++));
508do
509echo -e "${outline[$i]}" >> "${1}/${packagename}/Distribution"
510done
511
512for (( i=0; i < ${#choices[*]} ; i++));
513do
514echo -e "${choices[$i]}" >> "${1}/${packagename}/Distribution"
515done
516
517echo "</installer-gui-script>" >> "${1}/${packagename}/Distribution"
518
519perl -i -p -e "s/%CHAMELEONVERSION%/${version%%-*}/g" `find "${1}/${packagename}/Resources" -type f`
520perl -i -p -e "s/%CHAMELEONREVISION%/${revision}/g" `find "${1}/${packagename}/Resources" -type f`
521
522# Adding Developer and credits
523perl -i -p -e "s/%DEVELOP%/${develop}/g" `find "${1}/${packagename}/Resources" -type f`
524perl -i -p -e "s/%CREDITS%/${credits}/g" `find "${1}/${packagename}/Resources" -type f`
525perl -i -p -e "s/%PKGDEV%/${pkgdev}/g" `find "${1}/${packagename}/Resources" -type f`
526
527stage=${stage/RC/Release Candidate }
528stage=${stage/FINAL/2.0 Final}
529perl -i -p -e "s/%CHAMELEONSTAGE%/${stage}/g" `find "${1}/${packagename}/Resources" -type f`
530
531find "${1}/${packagename}" -name '.DS_Store' -delete
532pushd "${1}/${packagename}" >/dev/null
533xar -c -f "${1%/*}/${packagename// /}-${version}-r${revision}.pkg" --compression none .
534popd >/dev/null
535
536# Here is the place for assign a Icon to the pkg
537# command use to generate the file:
538# ditto -c -k --sequesterRsrc --keepParent Icon.icns Icon.zip
539# ----
540 ditto -xk "${pkgroot}/Icons/pkg.zip" "${pkgroot}/Icons/"
541 DeRez -only icns "${pkgroot}/Icons/Icons/pkg.icns" > tempicns.rsrc
542 Rez -append tempicns.rsrc -o "${1%/*}/$packagename-${version}-r$revision.pkg"
543 SetFile -a C "${1%/*}/$packagename-${version}-r$revision.pkg"
544 rm -f tempicns.rsrc
545 rm -rf "${pkgroot}/Icons/Icons"
546# End
547
548md5=$( md5 "${1%/*}/${packagename// /}-${version}-r${revision}.pkg" | awk {'print $4'} )
549echo "MD5 (${packagename// /}-${version}-r${revision}.pkg) = ${md5}" > "${1%/*}/${packagename// /}-${version}-r${revision}.pkg.md5"
550echo ""
551
552echo -e $COL_GREEN"--------------------------"$COL_RESET
553echo -e $COL_GREEN"Building process complete!"$COL_RESET
554echo -e $COL_GREEN"--------------------------"$COL_RESET
555echo ""
556echo -e $COL_GREEN"Build info."
557echo -e $COL_GREEN"==========="
558echo -e $COL_BLUE"Package name:"$COL_RESET"$packagename-${version}-r$revision.pkg"
559echo -e $COL_BLUE"MD5:"$COL_RESET"$md5"
560echo -e $COL_BLUE"Version:"$COL_RESET"$version"
561echo -e $COL_BLUE"Stage:"$COL_RESET"$stage"
562echo -e $COL_BLUE"Date/Time:"$COL_RESET"$builddate"
563echo ""
564
565}
566
567main "${1}" "${2}" "${3}" "${4}" "${5}"
568
569

Archive Download this file

Revision: 1628