Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Modules/package/buildpkg.sh

  • Property svn:executable set to *
1#!/bin/bash
2
3# $0 SRCROOT directory
4# $1 SYMROOT directory
5# $2 directory where pkgs will be created
6
7# Directory paths
8declare -r PKGROOT="${0%/*}"
9declare -r SRCROOT="$1"
10declare -r SYMROOT="$2"
11declare -r PKG_BUILD_DIR="$3"
12declare -r SCPT_TPL_DIR="${PKGROOT}/Scripts.templates"
13
14if [[ $# -lt 3 ]];then
15 echo "Too few arguments. Aborting..." >&2 && exit 1
16fi
17
18if [[ ! -d "$SYMROOT" ]];then
19 echo "Directory ${SYMROOT} doesn't exit. Aborting..." >&2 && exit 1
20fi
21
22# Prevent the script from doing bad things
23set -u # Abort with unset variables
24#set -e # Abort with any error can be suppressed locally using EITHER cmd||true OR set -e;cmd;set +e
25
26# ====== CONFIGURATION ======
27CONFIG_MODULES=""
28CONFIG_KLIBC_MODULE=""
29CONFIG_UCLIBCXX_MODULE=""
30CONFIG_RESOLUTION_MODULE=""
31CONFIG_AMDGRAPHICSENABLER_MODULE=""
32CONFIG_ATIGRAPHICSENABLER_MODULE=""
33CONFIG_INTELGRAPHICSENABLER_MODULE=""
34CONFIG_NVIDIAGRAPHICSENABLER_MODULE=""
35CONFIG_KEYLAYOUT_MODULE=""
36source "${SRCROOT}/auto.conf"
37
38# ====== COLORS ======
39
40declare -r COL_BLACK="\x1b[30;01m"
41declare -r COL_RED="\x1b[31;01m"
42declare -r COL_GREEN="\x1b[32;01m"
43declare -r COL_YELLOW="\x1b[33;01m"
44declare -r COL_MAGENTA="\x1b[35;01m"
45declare -r COL_CYAN="\x1b[36;01m"
46declare -r COL_WHITE="\x1b[37;01m"
47declare -r COL_BLUE="\x1b[34;01m"
48declare -r COL_RESET="\x1b[39;49;00m"
49
50# ====== REVISION/VERSION ======
51
52declare -r CHAMELEON_VERSION=$( cat version )
53
54# stage
55CHAMELEON_STAGE=${CHAMELEON_VERSION##*-}
56CHAMELEON_STAGE=${CHAMELEON_STAGE/RC/Release Candidate }
57CHAMELEON_STAGE=${CHAMELEON_STAGE/FINAL/2.1 Final}
58declare -r CHAMELEON_STAGE
59
60declare -r CHAMELEON_REVISION=$( grep I386BOOT_CHAMELEONREVISION vers.h | awk '{ print $3 }' | tr -d '\"' )
61declare -r CHAMELEON_BUILDDATE=$( grep I386BOOT_BUILDDATE vers.h | awk '{ print $3,$4 }' | tr -d '\"' )
62declare -r CHAMELEON_TIMESTAMP=$( date -j -f "%Y-%m-%d %H:%M:%S" "${CHAMELEON_BUILDDATE}" "+%s" )
63
64# ====== CREDITS ======
65
66declare -r CHAMELEON_DEVELOP=$(awk "NR==6{print;exit}" ${PKGROOT}/../CREDITS)
67declare -r CHAMELEON_CREDITS=$(awk "NR==10{print;exit}" ${PKGROOT}/../CREDITS)
68declare -r CHAMELEON_PKGDEV=$(awk "NR==14{print;exit}" ${PKGROOT}/../CREDITS)
69declare -r CHAMELEON_WHOBUILD=$(whoami | awk '{print $1}' | cut -d ":" -f3)
70
71# ====== GLOBAL VARIABLES ======
72declare -r LOG_FILENAME="Chameleon_Installer_Log.txt"
73
74declare -a pkgrefs
75declare -a choice_key
76declare -a choice_options
77declare -a choice_pkgrefs
78declare -a choice_parent_group_index
79declare -a choice_group_items
80declare -a choice_group_exclusive
81
82# Init Main Group
83choice_key[0]=""
84choice_options[0]=""
85choices_pkgrefs[0]=""
86choice_group_items[0]=""
87choice_group_exclusive[0]=""
88
89# Package name
90declare -r packagename="Chameleon"
91
92# Package identifiers
93declare -r chameleon_package_identity="org.chameleon"
94declare -r modules_packages_identity="${chameleon_package_identity}.modules"
95declare -r chamTemp="usr/local/chamTemp"
96
97# ====== FUNCTIONS ======
98
99trim () {
100 local result="${1#"${1%%[![:space:]]*}"}" # remove leading whitespace characters
101 echo "${result%"${result##*[![:space:]]}"}" # remove trailing whitespace characters
102}
103
104argument () {
105 local opt="$1"
106
107 if [[ $# -eq 0 ]];then
108 echo "$0: option requires an argument -- '$opt'" >&2; exit 1
109 fi
110 echo "$opt"
111}
112
113function makeSubstitutions () {
114 # Substition is like: Key=Value
115 #
116 # Optionnal arguments:
117 # --subst=<substition> : add a new substitution
118 # --subst <substition> : add a new substitution
119 #
120 # Last argument(s) is/are file(s) where substitutions must be made
121
122 local ownSubst=""
123
124 function addSubst () {
125 local mySubst="$1"
126 case "$mySubst" in
127*=*) keySubst=${mySubst%%=*}
128 valSubst=${mySubst#*=}
129 ownSubst=$(printf "%s\n%s" "$ownSubst" "s&@$keySubst@&$valSubst&g;t t")
130 ;;
131*) echo "Invalid substitution $mySubst" >&2
132 exit 1
133 ;;
134esac
135 }
136
137 # Check the arguments.
138 while [[ $# -gt 0 ]];do
139 local option="$1"
140 case "$option" in
141 --subst) shift; addSubst "$(argument $@)"; shift ;;
142 --subst=*) shift; addSubst "${option#*=}" ;;
143 -*)
144 echo "Unrecognized makeSubstitutions option '$option'" >&2
145 exit 1
146 ;;
147 *) break ;;
148 esac
149 done
150
151 if [[ $# -lt 1 ]];then
152 echo "makeSubstitutions invalid number of arguments: at least one file needed" >&2
153 exit 1
154 fi
155
156 local chameleonSubsts="
157s&%CHAMELEONVERSION%&${CHAMELEON_VERSION%%-*}&g
158s&%CHAMELEONREVISION%&${CHAMELEON_REVISION}&g
159s&%CHAMELEONSTAGE%&${CHAMELEON_STAGE}&g
160s&%DEVELOP%&${CHAMELEON_DEVELOP}&g
161s&%CREDITS%&${CHAMELEON_CREDITS}&g
162s&%PKGDEV%&${CHAMELEON_PKGDEV}&g
163s&%WHOBUILD%&${CHAMELEON_WHOBUILD}&g
164:t
165/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
166s&@LOG_FILENAME@&${LOG_FILENAME}&g;t t"
167
168 local allSubst="
169$chameleonSubsts
170$ownSubst"
171
172 for file in "$@";do
173 cp -pf "$file" "${file}.in"
174 sed "$allSubst" "${file}.in" > "${file}"
175 rm -f "${file}.in"
176 done
177}
178
179addTemplateScripts () {
180 # Arguments:
181 # --pkg-rootdir=<pkg_rootdir> : path of the pkg root dir
182 #
183 # Optionnal arguments:
184 # --subst=<substition> : add a new substitution
185 # --subst <substition> : add a new substitution
186 #
187 # Substition is like: Key=Value
188 #
189 # $n : Name of template(s) (templates are in package/Scripts.templates
190
191 local pkgRootDir=""
192 declare -a allSubst
193
194 # Check the arguments.
195 while [[ $# -gt 0 ]];do
196 local option="$1"
197 case "$option" in
198 --pkg-rootdir=*) shift; pkgRootDir="${option#*=}" ;;
199 --subst) shift; allSubst[${#allSubst[*]}]="$option"; allSubst[${#allSubst[*]}]="$1" ; shift ;;
200 --subst=*) shift; allSubst[${#allSubst[*]}]="${option}" ;;
201 -*)
202 echo "Unrecognized addTemplateScripts option '$option'" >&2
203 exit 1
204 ;;
205 *) break ;;
206 esac
207 done
208 if [[ $# -lt 1 ]];then
209 echo "addTemplateScripts invalid number of arguments: you must specify a template name" >&2
210 exit 1
211 fi
212 [[ -z "$pkgRootDir" ]] && { echo "Error addTemplateScripts: --pkg-rootdir option is needed" >&2 ; exit 1; }
213 [[ ! -d "$pkgRootDir" ]] && { echo "Error addTemplateScripts: directory '$pkgRootDir' doesn't exists" >&2 ; exit 1; }
214
215 for templateName in "$@";do
216 local templateRootDir="${SCPT_TPL_DIR}/${templateName}"
217 [[ ! -d "$templateRootDir" ]] && {
218 echo "Error addTemplateScripts: template '$templateName' doesn't exists" >&2; exit 1; }
219
220 # Copy files to destination
221 rsync -pr --exclude=.svn --exclude="*~" "$templateRootDir/" "$pkgRootDir/Scripts/"
222 done
223
224 files=$( find "$pkgRootDir/Scripts/" -type f )
225 if [[ ${#allSubst[*]} -gt 0 ]];then
226 makeSubstitutions "${allSubst[@]}" $files
227 else
228 makeSubstitutions $files
229 fi
230}
231
232getPackageRefId () {
233 echo ${1//_/.}.${2//_/.} | tr [:upper:] [:lower:]
234}
235
236# Return index of a choice
237getChoiceIndex () {
238 # $1 Choice Id
239 local found=0
240 for (( idx=0 ; idx < ${#choice_key[*]}; idx++ ));do
241 if [[ "${1}" == "${choice_key[$idx]}" ]];then
242 found=1
243 break
244 fi
245 done
246 echo "$idx"
247 return $found
248}
249
250# Add a new choice
251addChoice () {
252 # Optionnal arguments:
253 # --group=<group> : Group Choice Id
254 # --start-selected=<javascript code> : Specifies whether this choice is initially selected or unselected
255 # --start-enabled=<javascript code> : Specifies the initial enabled state of this choice
256 # --start-visible=<javascript code> : Specifies whether this choice is initially visible
257 # --pkg-refs=<pkgrefs> : List of package reference(s) id (separate by spaces)
258 #
259 # $1 Choice Id
260
261 local option
262 local groupChoice=""
263 local choiceOptions=""
264 local pkgrefs=""
265
266 # Check the arguments.
267 for option in "${@}";do
268 case "$option" in
269 --group=*)
270 shift; groupChoice=${option#*=} ;;
271 --start-selected=*)
272 shift; choiceOptions="$choiceOptions start_selected=\"${option#*=}\"" ;;
273 --start-enabled=*)
274 shift; choiceOptions="$choiceOptions start_enabled=\"${option#*=}\"" ;;
275 --start-visible=*)
276 shift; choiceOptions="$choiceOptions start_visible=\"${option#*=}\"" ;;
277 --pkg-refs=*)
278 shift; pkgrefs=${option#*=} ;;
279 -*)
280 echo "Unrecognized addChoice option '$option'" >&2
281 exit 1
282 ;;
283 *) break ;;
284 esac
285 done
286
287 if [[ $# -ne 1 ]];then
288 echo "addChoice invalid number of arguments: ${@}" >&2
289 exit 1
290 fi
291
292 local choiceId="${1}"
293
294 # Add choice in the group
295 idx_group=$(getChoiceIndex "$groupChoice")
296 found_group=$?
297 if [[ $found_group -ne 1 ]];then
298 # No group exist
299 echo "Error can't add choice '$choiceId' to group '$groupChoice': group choice '$groupChoice' doesn't exists." >&2
300 exit 1
301 else
302 set +u; oldItems=${choice_group_items[$idx_group]}; set -u
303 choice_group_items[$idx_group]="$oldItems $choiceId"
304 fi
305
306 # Check that the choice doesn't already exists
307 idx=$(getChoiceIndex "$choiceId")
308 found=$?
309 if [[ $found -ne 0 ]];then
310 # Choice already exists
311 echo "Error can't add choice '$choiceId': a choice with same name already exists." >&2
312 exit 1
313 fi
314
315 # Record new node
316 choice_key[$idx]="$choiceId"
317 choice_options[$idx]=$(trim "${choiceOptions}") # Removing leading and trailing whitespace(s)
318 choice_parent_group_index[$idx]=$idx_group
319 choice_pkgrefs[$idx]="$pkgrefs"
320
321 return $idx
322}
323
324# Add a group choice
325addGroupChoices() {
326 # Optionnal arguments:
327 # --parent=<parent> : parent group choice id
328 # --exclusive_zero_or_one_choice : only zero or one choice can be selected in the group
329 # --exclusive_one_choice : only one choice can be selected in the group
330 #
331 # $1 Choice Id
332
333 local option
334 local groupChoice=""
335 local exclusive_function=""
336
337 for option in "${@}";do
338 case "$option" in
339 --exclusive_zero_or_one_choice)
340 shift; exclusive_function="exclusive_zero_or_one_choice" ;;
341 --exclusive_one_choice)
342 shift; exclusive_function="exclusive_one_choice" ;;
343 --parent=*)
344 shift; groupChoice=${option#*=} ;;
345 -*)
346 echo "Unrecognized addGroupChoices option '$option'" >&2
347 exit 1
348 ;;
349 *) break ;;
350 esac
351 done
352
353 if [[ $# -ne 1 ]];then
354 echo "addGroupChoices invalid number of arguments: ${@}" >&2
355 exit 1
356 fi
357
358 addChoice --group="$groupChoice" "${1}"
359 local idx=$? # index of the new created choice
360
361 choice_group_exclusive[$idx]="$exclusive_function"
362}
363
364exclusive_one_choice () {
365 # $1 Current choice (ie: test1)
366 # $2..$n Others choice(s) (ie: "test2" "test3"). Current can or can't be in the others choices
367 local myChoice="${1}"
368 local result="";
369 local separator=' || ';
370 for choice in ${@:2};do
371 if [[ "$choice" != "$myChoice" ]];then
372 result="${result}choices['$choice'].selected${separator}";
373 fi
374 done
375 if [[ -n "$result" ]];then
376 echo "!(${result%$separator})"
377 fi
378}
379
380exclusive_zero_or_one_choice () {
381 # $1 Current choice (ie: test1)
382 # $2..$n Others choice(s) (ie: "test2" "test3"). Current can or can't be in the others choices
383 local myChoice="${1}"
384 local result;
385 echo "(my.choice.selected &amp;&amp; $(exclusive_one_choice ${@}))"
386}
387
388main ()
389{
390
391# clean up the destination path
392
393 rm -R -f "${PKG_BUILD_DIR}"
394 echo ""
395 echo -e $COL_CYAN" ----------------------------------"$COL_RESET
396 echo -e $COL_CYAN" Building $packagename Install Package"$COL_RESET
397 echo -e $COL_CYAN" ----------------------------------"$COL_RESET
398 echo ""
399
400# build pre install package
401 echo "================= Preinstall ================="
402 packagesidentity="${chameleon_package_identity}"
403 choiceId="Pre"
404 mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root
405 addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" ${choiceId}
406
407 packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")
408 buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/"
409 addChoice --start-visible="false" --start-selected="true" --pkg-refs="$packageRefId" "${choiceId}"
410# End build pre install package
411
412# build core package
413 echo "================= Core ================="
414 packagesidentity="${chameleon_package_identity}"
415 choiceId="Core"
416 mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root/usr/local/bin
417 mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
418 ditto --noextattr --noqtn ${SYMROOT}/i386/boot ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
419 ditto --noextattr --noqtn ${SYMROOT}/i386/boot0 ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
420 ditto --noextattr --noqtn ${SYMROOT}/i386/boot0md ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
421 ditto --noextattr --noqtn ${SYMROOT}/i386/boot1f32 ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
422 ditto --noextattr --noqtn ${SYMROOT}/i386/boot1h ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
423 ditto --noextattr --noqtn ${SYMROOT}/i386/boot1he ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
424 ditto --noextattr --noqtn ${SYMROOT}/i386/boot1hp ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
425 ditto --noextattr --noqtn ${SYMROOT}/i386/cdboot ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
426 ditto --noextattr --noqtn ${SYMROOT}/i386/chain0 ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
427 ditto --noextattr --noqtn ${SYMROOT}/i386/fdisk440 ${PKG_BUILD_DIR}/${choiceId}/Root/usr/local/bin
428 ditto --noextattr --noqtn ${SYMROOT}/i386/bdmesg ${PKG_BUILD_DIR}/${choiceId}/Root/usr/local/bin
429
430 packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")
431 buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/"
432 addChoice --start-visible="false" --start-selected="true" --pkg-refs="$packageRefId" "${choiceId}"
433# End build core package
434
435# build install type
436 echo "================= Chameleon ================="
437 addGroupChoices --exclusive_one_choice "InstallType"
438 packagesidentity="${chameleon_package_identity}.type"
439
440 # build new install package
441 choiceId="New"
442 mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root
443 echo "" > "${PKG_BUILD_DIR}/${choiceId}/Root/install_type_new"
444
445 packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")
446 buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/$chamTemp"
447 addChoice --group="InstallType" --start-selected="!choices['Upgrade'].selected" --pkg-refs="$packageRefId" "${choiceId}"
448 # End build new install package
449
450 # build upgrade package
451 choiceId="Upgrade"
452 mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root
453 echo "" > "${PKG_BUILD_DIR}/${choiceId}/Root/install_type_upgrade"
454
455 packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")
456 buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/$chamTemp"
457 addChoice --group="InstallType" --start-selected="chameleon_boot_plist_exists()" --pkg-refs="$packageRefId" "${choiceId}"
458 # End build upgrade package
459
460# End build install type
461
462# build Chameleon package
463 echo "================= Chameleon ================="
464 addGroupChoices --exclusive_one_choice "Chameleon"
465
466 # build standard package
467 choiceId="Standard"
468 mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root
469 mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources
470 addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" InstallerLog
471 cp -f ${PKGROOT}/Scripts/Main/${choiceId}postinstall ${PKG_BUILD_DIR}/${choiceId}/Scripts/postinstall
472 cp -f ${PKGROOT}/Scripts/Sub/* ${PKG_BUILD_DIR}/${choiceId}/Scripts
473 ditto --arch i386 `which SetFile` ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources/SetFile
474
475 packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")
476 buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/"
477 addChoice --group="Chameleon" --start-selected="true" --pkg-refs="$packageRefId" "${choiceId}"
478 # End build standard package
479
480 # build efi package
481 choiceId="EFI"
482 mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root
483 mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources
484 addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" InstallerLog
485 cp -f ${PKGROOT}/Scripts/Main/ESPpostinstall ${PKG_BUILD_DIR}/${choiceId}/Scripts/postinstall
486 cp -f ${PKGROOT}/Scripts/Sub/* ${PKG_BUILD_DIR}/${choiceId}/Scripts
487 ditto --arch i386 `which SetFile` ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources/SetFile
488
489 packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")
490 buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/"
491 addChoice --group="Chameleon" --start-visible="systemHasGPT()" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"
492 # End build efi package
493
494 # build no bootloader choice package
495 choiceId="noboot"
496 mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root
497
498 packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")
499 buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/"
500 addChoice --group="Chameleon" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"
501 # End build no bootloader choice package
502
503# End build Chameleon package
504
505if [[ "${CONFIG_MODULES}" == 'y' ]];then
506# build Modules package
507 echo "================= Modules ================="
508 ###############################
509 # Supported Modules #
510 ###############################
511 # AMDGraphicsEnabler.dylib #
512 # ATiGraphicsEnabler.dylib #
513 # IntelGraphicsEnabler.dylib #
514 # klibc.dylib #
515 # NVIDIAGraphicsEnabler.dylib #
516 # Resolution.dylib #
517 # uClibcxx.dylib #
518 # Keylayout.dylib #
519 ###############################
520 if [ "$(ls -A "${SYMROOT}/i386/modules")" ]; then
521 {
522 addGroupChoices "Module"
523
524# -
525 if [[ "${CONFIG_KLIBC_MODULE}" == 'm' && -f "${SYMROOT}/i386/modules/klibc.dylib" ]]; then
526 {
527 # Start build klibc package module
528 choiceId="klibc"
529 mkdir -p "${PKG_BUILD_DIR}/${choiceId}/Root"
530 ditto --noextattr --noqtn "${SYMROOT}/i386/modules/${choiceId}.dylib" ${PKG_BUILD_DIR}/${choiceId}/Root
531
532 packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")
533 buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/$chamTemp/Extra/modules"
534 addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"
535 # End build klibc package module
536 }
537 fi
538
539# -
540 if [[ "${CONFIG_UCLIBCXX_MODULE}" = 'm' && -n "${CONFIG_KLIBC_MODULE}" && \
541 -f "${SYMROOT}/i386/modules/uClibcxx.dylib" ]]; then
542 {
543 klibcPackageRefId=""
544 if [[ "${CONFIG_KLIBC_MODULE}" == 'm' ]];then
545 klibcPackageRefId=$(getPackageRefId "${modules_packages_identity}" "klibc")
546 fi
547 # Start build uClibc package module
548 choiceId="uClibc"
549 mkdir -p "${PKG_BUILD_DIR}/${choiceId}/Root"
550 ditto --noextattr --noqtn "${SYMROOT}/i386/modules/uClibcxx.dylib" "${PKG_BUILD_DIR}/${choiceId}/Root"
551
552 packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")
553 buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/$chamTemp/Extra/modules"
554 # Add the klibc package because the uClibc module is dependent of klibc module
555 addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId $klibcPackageRefId" "${choiceId}"
556 # End build uClibc package module
557 }
558 fi
559
560# -
561 if [[ "${CONFIG_RESOLUTION_MODULE}" == 'm' && -f "${SYMROOT}/i386/modules/Resolution.dylib" ]]; then
562 {
563 # Start build Resolution package module
564 choiceId="AutoReso"
565 mkdir -p "${PKG_BUILD_DIR}/${choiceId}/Root"
566 ditto --noextattr --noqtn "${SYMROOT}/i386/modules/Resolution.dylib" "${PKG_BUILD_DIR}/${choiceId}/Root"
567
568 packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")
569 buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/$chamTemp/Extra/modules"
570 addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"
571 # End build Resolution package module
572 }
573 fi
574
575# -
576 # Warning Keylayout module need additional files
577 if [[ "${CONFIG_KEYLAYOUT_MODULE}" = 'm' && -f "${SYMROOT}/i386/modules/Keylayout.dylib" ]]; then
578 {
579 # Start build Keylayout package module
580 choiceId="Keylayout"
581 mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root/Extra/{modules,Keymaps}
582 mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root/usr/local/bin
583 layout_src_dir="${SRCROOT}/i386/modules/Keylayout/layouts/layouts-src"
584 if [ -d "$layout_src_dir" ];then
585 # Create a tar.gz from layout sources
586 (cd "$layout_src_dir"; \
587 tar czf "${PKG_BUILD_DIR}/${choiceId}/Root/Extra/Keymaps/layouts-src.tar.gz" README *.slt)
588 fi
589 # Adding module
590 ditto --noextattr --noqtn ${SYMROOT}/i386/modules/${choiceId}.dylib ${PKG_BUILD_DIR}/${choiceId}/Root/Extra/modules
591 # Adding Keymaps
592 ditto --noextattr --noqtn ${SRCROOT}/Keymaps ${PKG_BUILD_DIR}/${choiceId}/Root/Extra/Keymaps
593 # Adding tools
594 ditto --noextattr --noqtn ${SYMROOT}/i386/cham-mklayout ${PKG_BUILD_DIR}/${choiceId}/Root/usr/local/bin
595
596 packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")
597 buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/$chamTemp"
598
599 # Don't add a choice for Keylayout module
600 # addChoice "${choiceId}" "Module" --start-selected="false" "$packageRefId"
601 # End build Keylayout package module
602 }
603 fi
604
605# -
606
607 if [[ "${CONFIG_AMDGRAPHICSENABLER_MODULE}" == 'm' && -f "${SYMROOT}/i386/modules/AMDGraphicsEnabler.dylib" ]]; then
608 {
609 # Start build AMDGraphicsEnabler package module
610 choiceId="AMDGraphicsEnabler"
611 mkdir -p "${PKG_BUILD_DIR}/${choiceId}/Root"
612 ditto --noextattr --noqtn "${SYMROOT}/i386/modules/AMDGraphicsEnabler.dylib" "${PKG_BUILD_DIR}/${choiceId}/Root"
613
614 packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")
615 buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/$chamTemp/Extra/modules"
616 addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"
617 # End build AMDGraphicsEnabler package module
618 }
619 fi
620
621# -
622
623 if [[ "${CONFIG_ATIGRAPHICSENABLER_MODULE}" == 'm' && -f "${SYMROOT}/i386/modules/ATiGraphicsEnabler.dylib" ]]; then
624 {
625 # Start build ATiGraphicsEnabler package module
626 choiceId="ATiGraphicsEnabler"
627 mkdir -p "${PKG_BUILD_DIR}/${choiceId}/Root"
628 ditto --noextattr --noqtn "${SYMROOT}/i386/modules/ATiGraphicsEnabler.dylib" "${PKG_BUILD_DIR}/${choiceId}/Root"
629 echo -e "\t[BUILD] ${choiceId} "
630 packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")
631 buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/$chamTemp/Extra/modules"
632 addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"
633 # End build ATiGraphicsEnabler package module
634 }
635 fi
636
637# -
638
639 if [[ "${CONFIG_INTELGRAPHICSENABLER_MODULE}" == 'm' && -f "${SYMROOT}/i386/modules/IntelGraphicsEnabler.dylib" ]]; then
640 {
641 # Start build IntelGraphicsEnabler package module
642 choiceId="IntelGraphicsEnabler"
643 mkdir -p "${PKG_BUILD_DIR}/${choiceId}/Root"
644 ditto --noextattr --noqtn "${SYMROOT}/i386/modules/IntelGraphicsEnabler.dylib" "${PKG_BUILD_DIR}/${choiceId}/Root"
645 echo -e "\t[BUILD] ${choiceId} "
646 packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")
647 buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/$chamTemp/Extra/modules"
648 addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"
649 # End build IntelGraphicsEnabler package module
650 }
651 fi
652
653# -
654
655 if [[ "${CONFIG_NVIDIAGRAPHICSENABLER_MODULE}" == 'm' && -f "${SYMROOT}/i386/modules/NVIDIAGraphicsEnabler.dylib" ]]; then
656 {
657 # Start build NVIDIAGraphicsEnabler package module
658 choiceId="NVIDIAGraphicsEnabler"
659 mkdir -p "${PKG_BUILD_DIR}/${choiceId}/Root"
660 ditto --noextattr --noqtn "${SYMROOT}/i386/modules/NVIDIAGraphicsEnabler.dylib" "${PKG_BUILD_DIR}/${choiceId}/Root"
661 echo -e "\t[BUILD] ${choiceId} "
662 packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")
663 buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/$chamTemp/Extra/modules"
664 addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"
665 # End build NVIDIAGraphicsEnabler package module
666 }
667 fi
668
669 }
670 else
671 {
672 echo " -= no modules to include =-"
673 }
674 fi
675# End build Modules packages
676fi
677
678# build Options packages
679
680 addGroupChoices "Options"
681
682 # ------------------------------------------------------
683 # parse OptionalSettings folder to find files of boot options.
684 # ------------------------------------------------------
685 OptionalSettingsFolder="${PKGROOT}/OptionalSettings"
686
687 while IFS= read -r -d '' OptionsFile; do
688
689 # Take filename and Strip .txt from end and path from front
690 builtOptionsList=${OptionsFile%.txt}
691 builtOptionsList=${builtOptionsList##*/}
692 packagesidentity="${chameleon_package_identity}.options.$builtOptionsList"
693
694 echo "================= $builtOptionsList ================="
695
696 # ------------------------------------------------------
697 # Read boot option file into an array.
698 # ------------------------------------------------------
699 availableOptions=() # array to hold the list of boot options, per 'section'.
700 exclusiveFlag="" # used to indicate list has exclusive options
701 while read textLine; do
702 # ignore lines in the file beginning with a #
703 [[ $textLine = \#* ]] && continue
704 local optionName="" key="" value=""
705 case "$textLine" in
706 Exclusive=[Tt][Rr][Uu][Ee]) exclusiveFlag="--exclusive_zero_or_one_choice" ;;
707 Exclusive=*) continue ;;
708 *@*:*=*)
709 availableOptions[${#availableOptions[*]}]="$textLine" ;;
710 *) echo "Error: invalid line '$textLine' in file '$OptionsFile'" >&2
711 exit 1
712 ;;
713 esac
714 done < "$OptionsFile"
715
716 addGroupChoices --parent="Options" $exclusiveFlag "${builtOptionsList}"
717
718 # ------------------------------------------------------
719 # Loop through options in array and process each in turn
720 # ------------------------------------------------------
721 for textLine in "${availableOptions[@]}"; do
722 # split line - taking all before ':' as option name
723 # and all after ':' as key/value
724 type=$( echo "${textLine%%@*}" | tr '[:upper:]' '[:lower:]' )
725 tmp=${textLine#*@}
726 optionName=${tmp%%:*}
727 keyValue=${tmp##*:}
728 key=${keyValue%%=*}
729 value=${keyValue#*=}
730
731 # create folders required for each boot option
732 mkdir -p "${PKG_BUILD_DIR}/$optionName/Root/"
733
734 # create dummy file with name of key/value
735 echo "" > "${PKG_BUILD_DIR}/$optionName/Root/${keyValue}"
736
737 case "$type" in
738 bool) startSelected="check_chameleon_bool_option('$key','$value')" ;;
739 text) startSelected="check_chameleon_text_option('$key','$value')" ;;
740 list) startSelected="check_chameleon_list_option('$key','$value')" ;;
741 *) echo "Error: invalid type '$type' in line '$textLine' in '$OptionsFile'" >&2
742 exit 1
743 ;;
744 esac
745 packageRefId=$(getPackageRefId "${packagesidentity}" "${optionName}")
746 buildpackage "$packageRefId" "${optionName}" "${PKG_BUILD_DIR}/${optionName}" "/$chamTemp/options"
747 addChoice --group="${builtOptionsList}" \
748 --start-selected="$startSelected" \
749 --pkg-refs="$packageRefId" "${optionName}"
750 done
751
752 done < <( find "${OptionalSettingsFolder}" -depth 1 -type f -name '*.txt' -print0 )
753
754# End build options packages
755
756if [[ -n "${CONFIG_KEYLAYOUT_MODULE}" ]];then
757# build Keymaps options packages
758 echo "================= Keymaps Options ================="
759 addGroupChoices --exclusive_zero_or_one_choice "Keymaps"
760 packagesidentity="${chameleon_package_identity}.options.keymaps"
761 keylayoutPackageRefId=""
762 if [[ "${CONFIG_MODULES}" == 'y' && "${CONFIG_KEYLAYOUT_MODULE}" = 'm' ]];then
763 keylayoutPackageRefId=$(getPackageRefId "${modules_packages_identity}" "Keylayout")
764 fi
765
766 chameleon_keylayout_key="KeyLayout"
767 # ------------------------------------------------------
768 # Available Keylayout boot options are discovered by
769 # reading contents of /Keymaps folder after compilation
770 # ------------------------------------------------------
771 availableOptions=($( find "${SRCROOT}/Keymaps" -type f -depth 1 -name '*.lyt' | sed 's|.*/||;s|\.lyt||' ))
772 # Adjust array contents to match expected format
773 # for boot options which is: name:key=value
774 for (( i = 0 ; i < ${#availableOptions[@]} ; i++ )); do
775 # Start build of a keymap package module
776 choiceId="${availableOptions[i]}"
777 mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root
778
779 # create dummy file with name of key/value
780 echo "" > "${PKG_BUILD_DIR}/${choiceId}/Root/${chameleon_keylayout_key}=${availableOptions[i]}"
781
782 packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")
783 buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/$chamTemp/options"
784 # Add the Keylayout package because the Keylayout module is needed
785 addChoice --group="Keymaps" \
786 --start-selected="check_chameleon_text_option('${chameleon_keylayout_key}','${choiceId}')" \
787 --pkg-refs="$packageRefId $keylayoutPackageRefId" "${choiceId}"
788 done
789
790# End build Keymaps options packages
791fi
792
793# build theme packages
794 echo "================= Themes ================="
795 addGroupChoices "Themes"
796
797 # Using themes section from Azi's/package branch.
798 packagesidentity="${chameleon_package_identity}.themes"
799 artwork="${SRCROOT}/artwork/themes"
800 themes=($( find "${artwork}" -type d -depth 1 -not -name '.svn' ))
801 for (( i = 0 ; i < ${#themes[@]} ; i++ )); do
802 theme=$( echo ${themes[$i]##*/} | awk 'BEGIN{OFS=FS=""}{$1=toupper($1);print}' )
803 mkdir -p "${PKG_BUILD_DIR}/${theme}/Root/"
804 rsync -r --exclude=.svn --exclude="*~" "${themes[$i]}/" "${PKG_BUILD_DIR}/${theme}/Root/${theme}"
805
806 packageRefId=$(getPackageRefId "${packagesidentity}" "${theme}")
807 buildpackage "$packageRefId" "${theme}" "${PKG_BUILD_DIR}/${theme}" "/$chamTemp/Extra/Themes"
808 addChoice --group="Themes" --start-selected="false" --pkg-refs="$packageRefId" "${theme}"
809 done
810# End build theme packages# End build Extras package
811
812# build post install package
813 echo "================= Post ================="
814 packagesidentity="${chameleon_package_identity}"
815 choiceId="Post"
816 mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root
817 addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" ${choiceId} InstallerLog
818 cp -f ${PKGROOT}/Scripts/Sub/UnMountEFIvolumes.sh ${PKG_BUILD_DIR}/${choiceId}/Scripts
819
820 packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")
821 buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/"
822 addChoice --start-visible="false" --start-selected="true" --pkg-refs="$packageRefId" "${choiceId}"
823# End build post install package
824
825}
826
827buildpackage ()
828{
829 # $1 Package Reference Id (ie: org.chameleon.themes.default)
830 # $2 Package Name (ie: Default)
831 # $3 Path to package to build containing Root and/or Scripts
832 # $4 Target install location
833 # $5 Size (optional)
834 if [[ -d "${3}/Root" ]]; then
835 local packageRefId="$1"
836 local packageName="$2"
837 local packagePath="$3"
838 local targetPath="$4"
839 set +u # packageSize is optional
840 local packageSize="$5"
841 set -u
842
843 echo -e "\t[BUILD] ${packageName}"
844
845 find "${packagePath}" -name '.DS_Store' -delete
846 local filecount=$( find "${packagePath}/Root" | wc -l )
847 if [ "${packageSize}" ]; then
848 local installedsize="${packageSize}"
849 else
850 local installedsize=$( du -hkc "${packagePath}/Root" | tail -n1 | awk {'print $1'} )
851 fi
852 local header="<?xml version=\"1.0\"?>\n<pkg-info format-version=\"2\" "
853
854 #[ "${3}" == "relocatable" ] && header+="relocatable=\"true\" "
855
856 header+="identifier=\"${packageRefId}\" "
857 header+="version=\"${CHAMELEON_VERSION}\" "
858
859 [ "${targetPath}" != "relocatable" ] && header+="install-location=\"${targetPath}\" "
860
861 header+="auth=\"root\">\n"
862 header+="\t<payload installKBytes=\"${installedsize##* }\" numberOfFiles=\"${filecount##* }\"/>\n"
863 rm -R -f "${packagePath}/Temp"
864
865 [ -d "${packagePath}/Temp" ] || mkdir -m 777 "${packagePath}/Temp"
866 [ -d "${packagePath}/Root" ] && mkbom "${packagePath}/Root" "${packagePath}/Temp/Bom"
867
868 if [ -d "${packagePath}/Scripts" ]; then
869 header+="\t<scripts>\n"
870 for script in $( find "${packagePath}/Scripts" -type f \( -name 'pre*' -or -name 'post*' \) ); do
871 header+="\t\t<${script##*/} file=\"./${script##*/}\"/>\n"
872 done
873 header+="\t</scripts>\n"
874 # Create the Script archive file (cpio format)
875 (cd "${packagePath}/Scripts" && find . -print | cpio -o -z -R 0:0 --format cpio > "${packagePath}/Temp/Scripts") 2>&1 | \
876 grep -vE '^[0-9]+\s+blocks?$' # to remove cpio stderr messages
877 fi
878
879 header+="</pkg-info>"
880 echo -e "${header}" > "${packagePath}/Temp/PackageInfo"
881
882 # Create the Payload file (cpio format)
883 (cd "${packagePath}/Root" && find . -print | cpio -o -z -R 0:0 --format cpio > "${packagePath}/Temp/Payload") 2>&1 | \
884 grep -vE '^[0-9]+\s+blocks?$' # to remove cpio stderr messages
885
886 # Create the package
887 (cd "${packagePath}/Temp" && xar -c -f "${packagePath}/../${packageName}.pkg" --compression none .)
888
889 # Add the package to the list of build packages
890 pkgrefs[${#pkgrefs[*]}]="\t<pkg-ref id=\"${packageRefId}\" installKBytes='${installedsize}' version='${CHAMELEON_VERSION}.0.0.${CHAMELEON_TIMESTAMP}'>#${packageName}.pkg</pkg-ref>"
891
892 rm -rf "${packagePath}"
893 fi
894}
895
896generateOutlineChoices() {
897 # $1 Main Choice
898 # $2 indent level
899 local idx=$(getChoiceIndex "$1")
900 local indentLevel="$2"
901 local indentString=""
902 for ((level=1; level <= $indentLevel ; level++)); do
903 indentString="\t$indentString"
904 done
905 set +u; subChoices="${choice_group_items[$idx]}"; set -u
906 if [[ -n "${subChoices}" ]]; then
907 # Sub choices exists
908 echo -e "$indentString<line choice=\"$1\">"
909 for subChoice in $subChoices;do
910 generateOutlineChoices $subChoice $(($indentLevel+1))
911 done
912 echo -e "$indentString</line>"
913 else
914 echo -e "$indentString<line choice=\"$1\"/>"
915 fi
916}
917
918generateChoices() {
919 for (( idx=1; idx < ${#choice_key[*]} ; idx++)); do
920 local choiceId=${choice_key[$idx]}
921 local choiceOptions=${choice_options[$idx]}
922 local choiceParentGroupIndex=${choice_parent_group_index[$idx]}
923 set +u; local group_exclusive=${choice_group_exclusive[$choiceParentGroupIndex]}; set -u
924
925 # Create the node and standard attributes
926 local choiceNode="\t<choice\n\t\tid=\"${choiceId}\"\n\t\ttitle=\"${choiceId}_title\"\n\t\tdescription=\"${choiceId}_description\""
927
928 # Add options like start_selected, etc...
929 [[ -n "${choiceOptions}" ]] && choiceNode="${choiceNode}\n\t\t${choiceOptions}"
930
931 # Add the selected attribute if options are mutually exclusive
932 if [[ -n "$group_exclusive" ]];then
933 local group_items="${choice_group_items[$choiceParentGroupIndex]}"
934 case $group_exclusive in
935 exclusive_one_choice)
936 local selected_option=$(exclusive_one_choice "$choiceId" "$group_items") ;;
937 exclusive_zero_or_one_choice)
938 local selected_option=$(exclusive_zero_or_one_choice "$choiceId" "$group_items") ;;
939 *) echo "Error: unknown function to generate exclusive mode '$group_exclusive' for group '${choice_key[$choiceParentGroupIndex]}'" >&2
940 exit 1
941 ;;
942 esac
943 choiceNode="${choiceNode}\n\t\tselected=\"$selected_option\""
944 fi
945
946 choiceNode="${choiceNode}>"
947
948 # Add the package references
949 for pkgRefId in ${choice_pkgrefs[$idx]};do
950 choiceNode="${choiceNode}\n\t\t<pkg-ref id=\"${pkgRefId}\"/>"
951 done
952
953 # Close the node
954 choiceNode="${choiceNode}\n\t</choice>\n"
955
956 echo -e "$choiceNode"
957 done
958}
959
960makedistribution ()
961{
962 declare -r distributionDestDir="${SYMROOT}"
963 declare -r distributionFilename="${packagename// /}-${CHAMELEON_VERSION}-r${CHAMELEON_REVISION}.pkg"
964 declare -r distributionFilePath="${distributionDestDir}/${distributionFilename}"
965
966 rm -f "${distributionDestDir}/${packagename// /}"*.pkg
967
968 mkdir -p "${PKG_BUILD_DIR}/${packagename}"
969
970 find "${PKG_BUILD_DIR}" -type f -name '*.pkg' -depth 1 | while read component
971 do
972 pkg="${component##*/}" # ie: EFI.pkg
973 pkgdir="${PKG_BUILD_DIR}/${packagename}/${pkg}"
974 # expand individual packages
975 pkgutil --expand "${PKG_BUILD_DIR}/${pkg}" "$pkgdir"
976 rm -f "${PKG_BUILD_DIR}/${pkg}"
977 done
978
979# Create the Distribution file
980 ditto --noextattr --noqtn "${PKGROOT}/Distribution" "${PKG_BUILD_DIR}/${packagename}/Distribution"
981
982 local start_indent_level=2
983 echo -e "\n\t<choices-outline>" >> "${PKG_BUILD_DIR}/${packagename}/Distribution"
984 for main_choice in ${choice_group_items[0]};do
985 generateOutlineChoices $main_choice $start_indent_level >> "${PKG_BUILD_DIR}/${packagename}/Distribution"
986 done
987 echo -e "\t</choices-outline>\n" >> "${PKG_BUILD_DIR}/${packagename}/Distribution"
988
989 generateChoices >> "${PKG_BUILD_DIR}/${packagename}/Distribution"
990
991 for (( i=0; i < ${#pkgrefs[*]} ; i++)); do
992 echo -e "${pkgrefs[$i]}" >> "${PKG_BUILD_DIR}/${packagename}/Distribution"
993 done
994
995 echo -e "\n</installer-gui-script>" >> "${PKG_BUILD_DIR}/${packagename}/Distribution"
996
997# Create the Resources directory
998 ditto --noextattr --noqtn "${PKGROOT}/Resources" "${PKG_BUILD_DIR}/${packagename}/Resources"
999
1000# CleanUp the directory
1001 find "${PKG_BUILD_DIR}/${packagename}" \( -type d -name '.svn' \) -o -name '.DS_Store' -exec rm -rf {} \;
1002
1003 # Make substitutions like version, revision, stage, developers, credits, etc..
1004 makeSubstitutions $( find "${PKG_BUILD_DIR}/${packagename}/Resources" -type f )
1005
1006# Create the final package
1007 pkgutil --flatten "${PKG_BUILD_DIR}/${packagename}" "${distributionFilePath}"
1008
1009##################################################################
1010# Here is the place for assign a Icon to the pkg #
1011# command use to generate the file: #
1012# ditto -c -k --sequesterRsrc --keepParent Icon.icns Icon.zip #
1013##################################################################
1014 ditto -xk "${PKGROOT}/Icons/pkg.zip" "${PKG_BUILD_DIR}/Icons/"
1015 DeRez -only icns "${PKG_BUILD_DIR}/Icons/Icons/pkg.icns" > "${PKG_BUILD_DIR}/Icons/tempicns.rsrc"
1016 Rez -append "${PKG_BUILD_DIR}/Icons/tempicns.rsrc" -o "${distributionFilePath}"
1017 SetFile -a C "${distributionFilePath}"
1018 rm -rf "${PKG_BUILD_DIR}/Icons"
1019
1020# End
1021
1022 md5=$( md5 "${distributionFilePath}" | awk {'print $4'} )
1023 echo "MD5 (${distributionFilePath}) = ${md5}" > "${distributionFilePath}.md5"
1024 echo ""
1025
1026 echo -e $COL_GREEN" --------------------------"$COL_RESET
1027 echo -e $COL_GREEN" Building process complete!"$COL_RESET
1028 echo -e $COL_GREEN" --------------------------"$COL_RESET
1029 echo ""
1030 echo -e $COL_GREEN" Build info."
1031 echo -e $COL_GREEN" ==========="
1032 echo -e $COL_BLUE" Package name: "$COL_RESET"${distributionFilename}"
1033 echo -e $COL_BLUE" MD5: "$COL_RESET"$md5"
1034 echo -e $COL_BLUE" Version: "$COL_RESET"$CHAMELEON_VERSION"
1035 echo -e $COL_BLUE" Stage: "$COL_RESET"$CHAMELEON_STAGE"
1036 echo -e $COL_BLUE" Date/Time: "$COL_RESET"$CHAMELEON_BUILDDATE"
1037 echo -e $COL_BLUE" Builded by: "$COL_RESET"$CHAMELEON_WHOBUILD"
1038 echo ""
1039
1040}
1041
1042# build packages
1043main
1044
1045# build meta package
1046makedistribution
1047

Archive Download this file

Revision: 1798