Chameleon

Chameleon Svn Source Tree

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

Archive Download this file

Revision: 2025