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

Archive Download this file

Revision: 1783