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

Archive Download this file

Revision: 1643