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

Archive Download this file

Revision: 1651