1 | #!/bin/bash␊ |
2 | ␊ |
3 | # $0 SRCROOT directory␊ |
4 | # $1 SYMROOT directory␊ |
5 | # $2 directory where pkgs will be created␊ |
6 | ␊ |
7 | # Directory paths␊ |
8 | declare -r PKGROOT="${0%/*}"␊ |
9 | declare -r SRCROOT="$1"␊ |
10 | declare -r SYMROOT="$2"␊ |
11 | declare -r PKG_BUILD_DIR="$3"␊ |
12 | declare -r SCPT_TPL_DIR="${PKGROOT}/Scripts.templates"␊ |
13 | ␊ |
14 | if [[ $# -lt 3 ]];then␊ |
15 | echo "Too few arguments. Aborting..." >&2 && exit 1␊ |
16 | fi␊ |
17 | ␊ |
18 | if [[ ! -d "$SYMROOT" ]];then␊ |
19 | echo "Directory ${SYMROOT} doesn't exit. Aborting..." >&2 && exit 1␊ |
20 | fi␊ |
21 | ␊ |
22 | # Prevent the script from doing bad things␊ |
23 | set -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 | # ====== LANGUAGE SETUP ======␊ |
27 | export LANG='en_US.UTF-8'␊ |
28 | export LC_COLLATE='C'␊ |
29 | export LC_CTYPE='C'␊ |
30 | ␊ |
31 | # ====== CONFIGURATION ======␊ |
32 | CONFIG_MODULES=""␊ |
33 | CONFIG_ACPICODEC_MODULE=""␊ |
34 | CONFIG_AMDGE_MODULE=""␊ |
35 | CONFIG_GMAGE_MODULE=""␊ |
36 | CONFIG_NVIDIAGE_MODULE=""␊ |
37 | CONFIG_KERNELPATCHER_MODULE=""␊ |
38 | CONFIG_KEXTPATCHER_MODULE=""␊ |
39 | CONFIG_KEYLAYOUT_MODULE=""␊ |
40 | CONFIG_KLIBC_MODULE=""␊ |
41 | CONFIG_RESOLUTION_MODULE=""␊ |
42 | CONFIG_HDAENABLER_MODULE=""␊ |
43 | CONFIG_FILENVRAM_MODULE=""␊ |
44 | CONFIG_SATA_MODULE=""␊ |
45 | CONFIG_UCLIBCXX_MODULE=""␊ |
46 | source "${SRCROOT}/auto.conf"␊ |
47 | ␊ |
48 | # ====== COLORS ======␊ |
49 | declare -r COL_BLACK="\x1b[30;01m"␊ |
50 | declare -r COL_RED="\x1b[31;01m"␊ |
51 | declare -r COL_GREEN="\x1b[32;01m"␊ |
52 | declare -r COL_YELLOW="\x1b[33;01m"␊ |
53 | declare -r COL_MAGENTA="\x1b[35;01m"␊ |
54 | declare -r COL_CYAN="\x1b[36;01m"␊ |
55 | declare -r COL_WHITE="\x1b[37;01m"␊ |
56 | declare -r COL_BLUE="\x1b[34;01m"␊ |
57 | declare -r COL_RESET="\x1b[39;49;00m"␊ |
58 | ␊ |
59 | # ====== REVISION/VERSION ======␊ |
60 | declare -r CHAMELEON_VERSION=$( cat version )␊ |
61 | ␊ |
62 | # stage␊ |
63 | CHAMELEON_STAGE=${CHAMELEON_VERSION##*-}␊ |
64 | CHAMELEON_STAGE=${CHAMELEON_STAGE/RC/Release Candidate }␊ |
65 | CHAMELEON_STAGE=${CHAMELEON_STAGE/FINAL/2.1 Final}␊ |
66 | declare -r CHAMELEON_STAGE␊ |
67 | ␊ |
68 | declare -r CHAMELEON_REVISION=$( grep I386BOOT_CHAMELEONREVISION vers.h | awk '{ print $3 }' | tr -d '\"' )␊ |
69 | declare -r CHAMELEON_BUILDDATE=$( grep I386BOOT_BUILDDATE vers.h | awk '{ print $3,$4 }' | tr -d '\"' )␊ |
70 | declare -r CHAMELEON_TIMESTAMP=$( date -j -f "%Y-%m-%d %H:%M:%S" "${CHAMELEON_BUILDDATE}" "+%s" )␊ |
71 | ␊ |
72 | # ====== CREDITS ======␊ |
73 | declare -r CHAMELEON_DEVELOP=$(awk "NR==6{print;exit}" ${PKGROOT}/../CREDITS)␊ |
74 | declare -r CHAMELEON_CREDITS=$(awk "NR==10{print;exit}" ${PKGROOT}/../CREDITS)␊ |
75 | declare -r CHAMELEON_PKGDEV=$(awk "NR==14{print;exit}" ${PKGROOT}/../CREDITS)␊ |
76 | declare -r CHAMELEON_CPRYEAR=$(awk "NR==18{print;exit}" ${PKGROOT}/../CREDITS)␊ |
77 | if [[ $(whoami | awk '{print $1}' | cut -d ":" -f3) == "admin" ]];then␊ |
78 | declare -r CHAMELEON_WHOBUILD="VoodooLabs BuildBot"␊ |
79 | else␊ |
80 | declare -r CHAMELEON_WHOBUILD=$(whoami | awk '{print $1}' | cut -d ":" -f3)␊ |
81 | fi␊ |
82 | ␊ |
83 | # ====== GLOBAL VARIABLES ======␊ |
84 | declare -r LOG_FILENAME="Chameleon_Installer_Log.txt"␊ |
85 | ␊ |
86 | declare -a chameleonOptionType␊ |
87 | declare -a chameleonOptionKey␊ |
88 | declare -a chameleonOptionValues␊ |
89 | ␊ |
90 | declare -a pkgrefs␊ |
91 | declare -a choice_key␊ |
92 | declare -a choice_options␊ |
93 | declare -a choice_pkgrefs␊ |
94 | declare -a choice_parent_group_index␊ |
95 | declare -a choice_group_items␊ |
96 | declare -a choice_group_exclusive␊ |
97 | ␊ |
98 | # Init Main Group␊ |
99 | choice_key[0]=""␊ |
100 | choice_options[0]=""␊ |
101 | choices_pkgrefs[0]=""␊ |
102 | choice_group_items[0]=""␊ |
103 | choice_group_exclusive[0]=""␊ |
104 | ␊ |
105 | # Package name␊ |
106 | declare -r packagename="Chameleon"␊ |
107 | ␊ |
108 | # Package identifiers␊ |
109 | declare -r chameleon_package_identity="org.chameleon"␊ |
110 | declare -r modules_packages_identity="${chameleon_package_identity}.modules"␊ |
111 | ␊ |
112 | # ====== FUNCTIONS ======␊ |
113 | trim () {␊ |
114 | local result="${1#"${1%%[![:space:]]*}"}" # remove leading whitespace characters␊ |
115 | echo "${result%"${result##*[![:space:]]}"}" # remove trailing whitespace characters␊ |
116 | }␊ |
117 | ␊ |
118 | function makeSubstitutions () {␊ |
119 | # Substition is like: Key=Value␊ |
120 | #␊ |
121 | # Optional arguments:␊ |
122 | # --subst=<substition> : add a new substitution␊ |
123 | #␊ |
124 | # Last argument(s) is/are file(s) where substitutions must be made␊ |
125 | ␊ |
126 | local ownSubst=""␊ |
127 | ␊ |
128 | function addSubst () {␊ |
129 | local mySubst="$1"␊ |
130 | case "$mySubst" in␊ |
131 | ␉␉␉*=*) keySubst=${mySubst%%=*}␊ |
132 | ␉␉␉␉ valSubst=${mySubst#*=}␊ |
133 | ␉␉␉␉ ownSubst=$(printf "%s\n%s" "$ownSubst" "s&@$keySubst@&$valSubst&g;t t")␊ |
134 | ␉␉␉␉ ;;␊ |
135 | ␉␉␉*) echo "Invalid substitution $mySubst" >&2␊ |
136 | exit 1␊ |
137 | ;;␊ |
138 | ␉␉esac␊ |
139 | }␊ |
140 | ␊ |
141 | # Check the arguments.␊ |
142 | while [[ $# -gt 0 ]];do␊ |
143 | local option="$1"␊ |
144 | case "$option" in␊ |
145 | --subst=*) shift; addSubst "${option#*=}" ;;␊ |
146 | -*)␊ |
147 | echo "Unrecognized makeSubstitutions option '$option'" >&2␊ |
148 | exit 1␊ |
149 | ;;␊ |
150 | *) break ;;␊ |
151 | esac␊ |
152 | done␊ |
153 | ␊ |
154 | if [[ $# -lt 1 ]];then␊ |
155 | echo "makeSubstitutions invalid number of arguments: at least one file needed" >&2␊ |
156 | exit 1␊ |
157 | fi␊ |
158 | ␊ |
159 | local chameleonSubsts="␊ |
160 | s&%CHAMELEONVERSION%&${CHAMELEON_VERSION%%-*}&g␊ |
161 | s&%CHAMELEONREVISION%&${CHAMELEON_REVISION}&g␊ |
162 | s&%CHAMELEONSTAGE%&${CHAMELEON_STAGE}&g␊ |
163 | s&%DEVELOP%&${CHAMELEON_DEVELOP}&g␊ |
164 | s&%CREDITS%&${CHAMELEON_CREDITS}&g␊ |
165 | s&%PKGDEV%&${CHAMELEON_PKGDEV}&g␊ |
166 | s&%CPRYEAR%&${CHAMELEON_CPRYEAR}&g␊ |
167 | s&%WHOBUILD%&${CHAMELEON_WHOBUILD}&g␊ |
168 | :t␊ |
169 | /@[a-zA-Z_][a-zA-Z_0-9]*@/!b␊ |
170 | s&@LOG_FILENAME@&${LOG_FILENAME}&g;t t"␊ |
171 | ␊ |
172 | local allSubst="␊ |
173 | $chameleonSubsts␊ |
174 | $ownSubst"␊ |
175 | ␊ |
176 | for file in "$@";do␊ |
177 | cp -pf "$file" "${file}.in"␊ |
178 | sed "$allSubst" "${file}.in" > "${file}"␊ |
179 | rm -f "${file}.in"␊ |
180 | done␊ |
181 | }␊ |
182 | ␊ |
183 | addTemplateScripts () {␊ |
184 | # Arguments:␊ |
185 | # --pkg-rootdir=<pkg_rootdir> : path of the pkg root dir␊ |
186 | #␊ |
187 | # Optional arguments:␊ |
188 | # --subst=<substition> : add a new substitution␊ |
189 | #␊ |
190 | # Substition is like: Key=Value␊ |
191 | #␊ |
192 | # $n : Name of template(s) (templates are in package/Scripts.templates␊ |
193 | ␊ |
194 | local pkgRootDir=""␊ |
195 | declare -a allSubst␊ |
196 | ␊ |
197 | # Check the arguments.␊ |
198 | while [[ $# -gt 0 ]];do␊ |
199 | local option="$1"␊ |
200 | case "$option" in␊ |
201 | --pkg-rootdir=*) shift; pkgRootDir="${option#*=}" ;;␊ |
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 | ␊ |
234 | getPackageRefId () {␊ |
235 | echo ${1//_/.}.${2//_/.} | tr [:upper:] [:lower:]␊ |
236 | }␊ |
237 | ␊ |
238 | # Return index of a choice␊ |
239 | getChoiceIndex () {␊ |
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␊ |
253 | addChoice () {␊ |
254 | # Optional 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␊ |
327 | addGroupChoices() {␊ |
328 | # Optional 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 | ␊ |
366 | exclusive_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 | ␊ |
382 | exclusive_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 && $(exclusive_one_choice ${@}))"␊ |
388 | }␊ |
389 | ␊ |
390 | recordChameleonOption () {␊ |
391 | local type="$1"␊ |
392 | local key="$2"␊ |
393 | local value="$3"␊ |
394 | ␊ |
395 | # Search for an existing key␊ |
396 | local found=0␊ |
397 | for (( idx=0 ; idx < ${#chameleonOptionKey[@]}; idx++ ));do␊ |
398 | if [[ "$key" == "${chameleonOptionKey[$idx]}" ]];then␊ |
399 | found=1␊ |
400 | break␊ |
401 | fi␊ |
402 | done␊ |
403 | ␊ |
404 | # idx contain the index of a new key or an existing one␊ |
405 | if [[ $found -eq 0 ]]; then␊ |
406 | # Create a new one␊ |
407 | chameleonOptionKey[$idx]="$key"␊ |
408 | chameleonOptionType[$idx]="$type"␊ |
409 | chameleonOptionValues[$idx]=""␊ |
410 | fi␊ |
411 | ␊ |
412 | case "$type" in␊ |
413 | bool) ;;␊ |
414 | text|list) chameleonOptionValues[$idx]="${chameleonOptionValues[$idx]} $value" ;;␊ |
415 | *) echo "Error unknown type '$type' for '$key'" >&2␊ |
416 | exit 1␊ |
417 | ;;␊ |
418 | esac␊ |
419 | }␊ |
420 | ␊ |
421 | generate_options_yaml_file () {␊ |
422 | local yamlFile="$1"␊ |
423 | echo "---" > $yamlFile␊ |
424 | for (( idx=0; idx < ${#chameleonOptionKey[@]}; idx++ ));do␊ |
425 | printf "%s:\n type: %s\n" "${chameleonOptionKey[$idx]}" "${chameleonOptionType[$idx]}" >> $yamlFile␊ |
426 | case ${chameleonOptionType[$idx]} in␊ |
427 | text|list)␊ |
428 | printf " values:\n" >> $yamlFile␊ |
429 | for value in ${chameleonOptionValues[$idx]};do␊ |
430 | printf " - %s\n" "$value" >> $yamlFile␊ |
431 | done␊ |
432 | ;;␊ |
433 | esac␊ |
434 | done␊ |
435 | }␊ |
436 | ␊ |
437 | main ()␊ |
438 | {␊ |
439 | ␊ |
440 | # clean up the destination path␊ |
441 | ␊ |
442 | rm -R -f "${PKG_BUILD_DIR}"␊ |
443 | echo ""␊ |
444 | echo -e $COL_CYAN" ----------------------------------"$COL_RESET␊ |
445 | echo -e $COL_CYAN" Building $packagename Install Package"$COL_RESET␊ |
446 | echo -e $COL_CYAN" ----------------------------------"$COL_RESET␊ |
447 | echo ""␊ |
448 | ␊ |
449 | # Add pre install choice␊ |
450 | echo "================= Preinstall ================="␊ |
451 | packagesidentity="${chameleon_package_identity}"␊ |
452 | choiceId="Pre"␊ |
453 | ␊ |
454 | packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")␊ |
455 | addChoice --start-visible="false" --start-selected="true" --pkg-refs="$packageRefId" "${choiceId}"␊ |
456 | ␊ |
457 | # Package will be built at the end␊ |
458 | # End pre install choice␊ |
459 | ␊ |
460 | # build core package␊ |
461 | echo "================= Core ================="␊ |
462 | packagesidentity="${chameleon_package_identity}"␊ |
463 | choiceId="Core"␊ |
464 | mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root/usr/local/bin␊ |
465 | mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386␊ |
466 | ditto --noextattr --noqtn ${SYMROOT}/i386/boot ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386␊ |
467 | ditto --noextattr --noqtn ${SYMROOT}/i386/boot0 ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386␊ |
468 | ditto --noextattr --noqtn ${SYMROOT}/i386/boot0md ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386␊ |
469 | ditto --noextattr --noqtn ${SYMROOT}/i386/boot1f32 ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386␊ |
470 | ditto --noextattr --noqtn ${SYMROOT}/i386/boot1h ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386␊ |
471 | ditto --noextattr --noqtn ${SYMROOT}/i386/boot1he ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386␊ |
472 | ditto --noextattr --noqtn ${SYMROOT}/i386/boot1hp ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386␊ |
473 | ditto --noextattr --noqtn ${SYMROOT}/i386/cdboot ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386␊ |
474 | ditto --noextattr --noqtn ${SYMROOT}/i386/chain0 ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386␊ |
475 | ditto --noextattr --noqtn ${SYMROOT}/i386/fdisk440 ${PKG_BUILD_DIR}/${choiceId}/Root/usr/local/bin␊ |
476 | ditto --noextattr --noqtn ${SYMROOT}/i386/bdmesg ${PKG_BUILD_DIR}/${choiceId}/Root/usr/local/bin␊ |
477 | ␊ |
478 | packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")␊ |
479 | buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/"␊ |
480 | addChoice --start-visible="false" --start-selected="true" --pkg-refs="$packageRefId" "${choiceId}"␊ |
481 | # End build core package␊ |
482 | ␊ |
483 | # build Chameleon package␊ |
484 | echo "================= Chameleon ================="␊ |
485 | addGroupChoices --exclusive_one_choice "Chameleon"␊ |
486 | ␊ |
487 | # build standard package␊ |
488 | choiceId="Standard"␊ |
489 | mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root␊ |
490 | mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources␊ |
491 | addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" InstallerLog␊ |
492 | cp -f ${PKGROOT}/Scripts/Main/${choiceId}postinstall ${PKG_BUILD_DIR}/${choiceId}/Scripts/postinstall␊ |
493 | cp -f ${PKGROOT}/Scripts/Sub/* ${PKG_BUILD_DIR}/${choiceId}/Scripts␊ |
494 | ditto --arch i386 `which SetFile` ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources/SetFile␊ |
495 | ␊ |
496 | packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")␊ |
497 | buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/"␊ |
498 | addChoice --group="Chameleon" --start-selected="true" --pkg-refs="$packageRefId" "${choiceId}"␊ |
499 | # End build standard package␊ |
500 | ␊ |
501 | # build efi package␊ |
502 | if [[ 1 -eq 0 ]];then␊ |
503 | # Only standard installation is currently supported␊ |
504 | # We need to update the script to be able to install␊ |
505 | # Chameleon on EFI partition␊ |
506 | choiceId="EFI"␊ |
507 | mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root␊ |
508 | mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources␊ |
509 | addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" InstallerLog␊ |
510 | cp -f ${PKGROOT}/Scripts/Main/ESPpostinstall ${PKG_BUILD_DIR}/${choiceId}/Scripts/postinstall␊ |
511 | cp -f ${PKGROOT}/Scripts/Sub/* ${PKG_BUILD_DIR}/${choiceId}/Scripts␊ |
512 | ditto --arch i386 `which SetFile` ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources/SetFile␊ |
513 | ␊ |
514 | packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")␊ |
515 | buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/"␊ |
516 | addChoice --group="Chameleon" --start-visible="systemHasGPT()" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"␊ |
517 | # End build efi package␊ |
518 | fi␊ |
519 | # build no bootloader choice package␊ |
520 | choiceId="noboot"␊ |
521 | mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root␊ |
522 | ␊ |
523 | packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")␊ |
524 | buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/"␊ |
525 | addChoice --group="Chameleon" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"␊ |
526 | # End build no bootloader choice package␊ |
527 | ␊ |
528 | # End build Chameleon package␊ |
529 | ␊ |
530 | if [[ "${CONFIG_MODULES}" == 'y' ]];then␊ |
531 | # build Modules package␊ |
532 | echo "================= Modules ================="␊ |
533 | ###############################␊ |
534 | # Supported Modules #␊ |
535 | ###############################␊ |
536 | # ACPICodec.dylib #␊ |
537 | # AMDGraphicsEnabler.dylib #␊ |
538 | # ATiGraphicsEnabler.dylib #␊ |
539 | # FileNVRAM.dylib #␊ |
540 | # HDAEnabler.dylib #␊ |
541 | # HelloWorld.dylib #␊ |
542 | # IntelGraphicsEnabler.dylib #␊ |
543 | # KernelPatcher.dylib #␊ |
544 | # KextPatcher.dylib #␊ |
545 | # Keylayout.dylib #␊ |
546 | # klibc.dylib #␊ |
547 | # NVDIAGraphicEnabler.dylib #␊ |
548 | # Resolution.dylib #␊ |
549 | # Sata.dylib #␊ |
550 | # uClibcxx.dylib #␊ |
551 | ###############################␊ |
552 | if [ "$(ls -A "${SYMROOT}/i386/modules")" ]; then␊ |
553 | {␊ |
554 | addGroupChoices "Module"␊ |
555 | ␊ |
556 | # -␊ |
557 | if [[ "${CONFIG_ACPICODEC_MODULE}" == 'm' && -f "${SYMROOT}/i386/modules/ACPICodec.dylib" ]]; then␊ |
558 | {␊ |
559 | # Start build ACPICodec package module␊ |
560 | choiceId="ACPICodec"␊ |
561 | moduleFile="ACPICodec.dylib"␊ |
562 | mkdir -p "${PKG_BUILD_DIR}/${choiceId}/Root"␊ |
563 | ditto --noextattr --noqtn "${SYMROOT}/i386/modules/$moduleFile" "${PKG_BUILD_DIR}/${choiceId}/Root"␊ |
564 | addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" \␊ |
565 | --subst="moduleName=$choiceId" \␊ |
566 | --subst="moduleFile=$moduleFile" \␊ |
567 | InstallModule␊ |
568 | ␊ |
569 | packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")␊ |
570 | buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/Extra/modules"␊ |
571 | addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"␊ |
572 | # End build ACPICodec package module␊ |
573 | }␊ |
574 | fi␊ |
575 | # -␊ |
576 | if [[ "${CONFIG_NVIDIAGE_MODULE}" == 'y' && -f "${SYMROOT}/i386/modules/NVIDIAGraphicEnabler.dylib" ]]; then␊ |
577 | {␊ |
578 | # Start build NvidiaGraphicsEnabler package module␊ |
579 | choiceId="NVIDIAGraphicsEnabler"␊ |
580 | moduleFile="NVIDIAGraphicEnabler.dylib"␊ |
581 | mkdir -p "${PKG_BUILD_DIR}/${choiceId}/Root"␊ |
582 | ditto --noextattr --noqtn "${SYMROOT}/i386/modules/$moduleFile" "${PKG_BUILD_DIR}/${choiceId}/Root"␊ |
583 | addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" \␊ |
584 | --subst="moduleName=$choiceId" \␊ |
585 | --subst="moduleFile=$moduleFile" \␊ |
586 | InstallModule␊ |
587 | ␊ |
588 | packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")␊ |
589 | buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/Extra/modules"␊ |
590 | addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"␊ |
591 | # End build NvidiaGraphicsEnabler package module␊ |
592 | }␊ |
593 | fi␊ |
594 | # -␊ |
595 | if [[ "${CONFIG_AMDGE_MODULE}" == 'y' && -f "${SYMROOT}/i386/modules/AMDGraphicsEnabler.dylib" ]]; then␊ |
596 | {␊ |
597 | # Start build AMDGraphicsEnabler package module␊ |
598 | choiceId="AMDGraphicsEnabler"␊ |
599 | moduleFile="AMDGraphicsEnabler_title.dylib"␊ |
600 | mkdir -p "${PKG_BUILD_DIR}/${choiceId}/Root"␊ |
601 | ditto --noextattr --noqtn "${SYMROOT}/i386/modules/$moduleFile" "${PKG_BUILD_DIR}/${choiceId}/Root"␊ |
602 | addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" \␊ |
603 | --subst="moduleName=$choiceId" \␊ |
604 | --subst="moduleFile=$moduleFile" \␊ |
605 | InstallModule␊ |
606 | ␊ |
607 | packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")␊ |
608 | buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/Extra/modules"␊ |
609 | addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"␊ |
610 | # End build AMDGraphicsEnabler package module␊ |
611 | }␊ |
612 | fi␊ |
613 | # -␊ |
614 | if [[ "${CONFIG_GMAGE_MODULE}" == 'y' && -f "${SYMROOT}/i386/modules/IntelGraphicsEnabler.dylib" ]]; then␊ |
615 | {␊ |
616 | # Start build IntelGraphicsEnabler package module␊ |
617 | choiceId="IntelGraphicsEnabler"␊ |
618 | moduleFile="IntelGraphicsEnabler_title.dylib"␊ |
619 | mkdir -p "${PKG_BUILD_DIR}/${choiceId}/Root"␊ |
620 | ditto --noextattr --noqtn "${SYMROOT}/i386/modules/$moduleFile" "${PKG_BUILD_DIR}/${choiceId}/Root"␊ |
621 | addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" \␊ |
622 | --subst="moduleName=$choiceId" \␊ |
623 | --subst="moduleFile=$moduleFile" \␊ |
624 | InstallModule␊ |
625 | ␊ |
626 | packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")␊ |
627 | buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/Extra/modules"␊ |
628 | addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"␊ |
629 | # End build IntelGraphicsEnabler package module␊ |
630 | }␊ |
631 | fi␊ |
632 | # -␊ |
633 | if [[ "${CONFIG_KERNELPATCHER_MODULE}" == 'y' && -f "${SYMROOT}/i386/modules/KernelPatcher.dylib" ]]; then␊ |
634 | {␊ |
635 | # Start build KernelPatcher package module␊ |
636 | choiceId="KernelPatcher"␊ |
637 | moduleFile="KernelPatcher.dylib"␊ |
638 | mkdir -p "${PKG_BUILD_DIR}/${choiceId}/Root"␊ |
639 | ditto --noextattr --noqtn "${SYMROOT}/i386/modules/$moduleFile" "${PKG_BUILD_DIR}/${choiceId}/Root"␊ |
640 | addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" \␊ |
641 | --subst="moduleName=$choiceId" \␊ |
642 | --subst="moduleFile=$moduleFile" \␊ |
643 | InstallModule␊ |
644 | ␊ |
645 | packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")␊ |
646 | buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/Extra/modules"␊ |
647 | addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"␊ |
648 | # End build KernelPatcher package module␊ |
649 | }␊ |
650 | fi␊ |
651 | # -␊ |
652 | if [[ "${CONFIG_KEXTPATCHER_MODULE}" == 'y' && -f "${SYMROOT}/i386/modules/KextPatcher.dylib" ]]; then␊ |
653 | {␊ |
654 | # Start build KextPatcher package module␊ |
655 | choiceId="KextPatcher"␊ |
656 | moduleFile="KextPatcher.dylib"␊ |
657 | mkdir -p "${PKG_BUILD_DIR}/${choiceId}/Root"␊ |
658 | ditto --noextattr --noqtn "${SYMROOT}/i386/modules/$moduleFile" "${PKG_BUILD_DIR}/${choiceId}/Root"␊ |
659 | addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" \␊ |
660 | --subst="moduleName=$choiceId" \␊ |
661 | --subst="moduleFile=$moduleFile" \␊ |
662 | InstallModule␊ |
663 | ␊ |
664 | packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")␊ |
665 | buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/Extra/modules"␊ |
666 | addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"␊ |
667 | # End build KextPatcher package module␊ |
668 | }␊ |
669 | fi␊ |
670 | # -␊ |
671 | # Warning Keylayout module need additional files␊ |
672 | if [[ "${CONFIG_KEYLAYOUT_MODULE}" = 'm' && -f "${SYMROOT}/i386/modules/Keylayout.dylib" ]]; then␊ |
673 | {␊ |
674 | # Start build Keylayout package module␊ |
675 | choiceId="Keylayout"␊ |
676 | moduleFile="${choiceId}.dylib"␊ |
677 | mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root/Extra/{modules,Keymaps}␊ |
678 | mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root/usr/local/bin␊ |
679 | layout_src_dir="${SRCROOT}/i386/modules/Keylayout/layouts/layouts-src"␊ |
680 | if [ -d "$layout_src_dir" ];then␊ |
681 | # Create a tar.gz from layout sources␊ |
682 | (cd "$layout_src_dir"; \␊ |
683 | tar czf "${PKG_BUILD_DIR}/${choiceId}/Root/Extra/Keymaps/layouts-src.tar.gz" README *.slt)␊ |
684 | fi␊ |
685 | # Adding module␊ |
686 | ditto --noextattr --noqtn ${SYMROOT}/i386/modules/$moduleFile ${PKG_BUILD_DIR}/${choiceId}/Root/Extra/modules␊ |
687 | # Adding Keymaps␊ |
688 | ditto --noextattr --noqtn ${SRCROOT}/Keymaps ${PKG_BUILD_DIR}/${choiceId}/Root/Extra/Keymaps␊ |
689 | # Adding tools␊ |
690 | ditto --noextattr --noqtn ${SYMROOT}/i386/cham-mklayout ${PKG_BUILD_DIR}/${choiceId}/Root/usr/local/bin␊ |
691 | # Adding scripts␊ |
692 | addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" \␊ |
693 | --subst="moduleName=$choiceId" \␊ |
694 | --subst="moduleFile=$moduleFile" \␊ |
695 | InstallModule␊ |
696 | ␊ |
697 | packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")␊ |
698 | buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/"␊ |
699 | ␊ |
700 | # Don't add a choice for Keylayout module␊ |
701 | # addChoice "${choiceId}" "Module" --start-selected="false" "$packageRefId"␊ |
702 | # End build Keylayout package module␊ |
703 | }␊ |
704 | fi␊ |
705 | # -␊ |
706 | if [[ "${CONFIG_KLIBC_MODULE}" == 'm' && -f "${SYMROOT}/i386/modules/klibc.dylib" ]]; then␊ |
707 | {␊ |
708 | # Start build klibc package module␊ |
709 | choiceId="klibc"␊ |
710 | moduleFile="${choiceId}.dylib"␊ |
711 | mkdir -p "${PKG_BUILD_DIR}/${choiceId}/Root"␊ |
712 | ditto --noextattr --noqtn "${SYMROOT}/i386/modules/$moduleFile" ${PKG_BUILD_DIR}/${choiceId}/Root␊ |
713 | addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" \␊ |
714 | --subst="moduleName=$choiceId" \␊ |
715 | --subst="moduleFile=$moduleFile" \␊ |
716 | InstallModule␊ |
717 | ␊ |
718 | packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")␊ |
719 | buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/Extra/modules"␊ |
720 | addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"␊ |
721 | # End build klibc package module␊ |
722 | }␊ |
723 | fi␊ |
724 | # -␊ |
725 | if [[ "${CONFIG_RESOLUTION_MODULE}" == 'm' && -f "${SYMROOT}/i386/modules/Resolution.dylib" ]]; then␊ |
726 | {␊ |
727 | # Start build Resolution package module␊ |
728 | choiceId="AutoReso"␊ |
729 | moduleFile="Resolution.dylib"␊ |
730 | mkdir -p "${PKG_BUILD_DIR}/${choiceId}/Root"␊ |
731 | ditto --noextattr --noqtn "${SYMROOT}/i386/modules/$moduleFile" "${PKG_BUILD_DIR}/${choiceId}/Root"␊ |
732 | addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" \␊ |
733 | --subst="moduleName=$choiceId" \␊ |
734 | --subst="moduleFile=$moduleFile" \␊ |
735 | InstallModule␊ |
736 | ␊ |
737 | packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")␊ |
738 | buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/Extra/modules"␊ |
739 | addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"␊ |
740 | # End build Resolution package module␊ |
741 | }␊ |
742 | fi␊ |
743 | # -␊ |
744 | if [[ "${CONFIG_HDAENABLER_MODULE}" == 'y' && -f "${SYMROOT}/i386/modules/HDAEnabler.dylib" ]]; then␊ |
745 | {␊ |
746 | # Start build HDAEnabler package module␊ |
747 | choiceId="HDAEnabler"␊ |
748 | moduleFile="HDAEnabler.dylib"␊ |
749 | mkdir -p "${PKG_BUILD_DIR}/${choiceId}/Root"␊ |
750 | ditto --noextattr --noqtn "${SYMROOT}/i386/modules/$moduleFile" "${PKG_BUILD_DIR}/${choiceId}/Root"␊ |
751 | addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" \␊ |
752 | --subst="moduleName=$choiceId" \␊ |
753 | --subst="moduleFile=$moduleFile" \␊ |
754 | InstallModule␊ |
755 | ␊ |
756 | packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")␊ |
757 | buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/Extra/modules"␊ |
758 | addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"␊ |
759 | # End build HDAEnabler package module␊ |
760 | }␊ |
761 | fi␊ |
762 | # -␊ |
763 | if [[ "${CONFIG_FILENVRAM_MODULE}" == 'y' && -f "${SYMROOT}/i386/modules/FileNVRAM.dylib" ]]; then␊ |
764 | {␊ |
765 | # Start build FileNVRAM package module␊ |
766 | choiceId="FileNVRAM"␊ |
767 | moduleFile="FileNVRAM.dylib"␊ |
768 | mkdir -p "${PKG_BUILD_DIR}/${choiceId}/Root"␊ |
769 | ditto --noextattr --noqtn "${SYMROOT}/i386/modules/$moduleFile" "${PKG_BUILD_DIR}/${choiceId}/Root"␊ |
770 | addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" \␊ |
771 | --subst="moduleName=$choiceId" \␊ |
772 | --subst="moduleFile=$moduleFile" \␊ |
773 | InstallModule␊ |
774 | ␊ |
775 | packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")␊ |
776 | buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/Extra/modules"␊ |
777 | addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"␊ |
778 | # End build FileNVRAM package module␊ |
779 | }␊ |
780 | fi␊ |
781 | # -␊ |
782 | if [[ "${CONFIG_SATA_MODULE}" == 'm' && -f "${SYMROOT}/i386/modules/Sata.dylib" ]]; then␊ |
783 | {␊ |
784 | # Start build Sata package module␊ |
785 | choiceId="Sata"␊ |
786 | moduleFile="Sata.dylib"␊ |
787 | mkdir -p "${PKG_BUILD_DIR}/${choiceId}/Root"␊ |
788 | ditto --noextattr --noqtn "${SYMROOT}/i386/modules/$moduleFile" "${PKG_BUILD_DIR}/${choiceId}/Root"␊ |
789 | addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" \␊ |
790 | --subst="moduleName=$choiceId" \␊ |
791 | --subst="moduleFile=$moduleFile" \␊ |
792 | InstallModule␊ |
793 | ␊ |
794 | packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")␊ |
795 | buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/Extra/modules"␊ |
796 | addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}"␊ |
797 | # End build Sata package module␊ |
798 | }␊ |
799 | fi␊ |
800 | # -␊ |
801 | if [[ "${CONFIG_UCLIBCXX_MODULE}" = 'm' && -n "${CONFIG_KLIBC_MODULE}" && \␊ |
802 | -f "${SYMROOT}/i386/modules/uClibcxx.dylib" ]]; then␊ |
803 | {␊ |
804 | klibcPackageRefId=""␊ |
805 | if [[ "${CONFIG_KLIBC_MODULE}" == 'm' ]];then␊ |
806 | klibcPackageRefId=$(getPackageRefId "${modules_packages_identity}" "klibc")␊ |
807 | fi␊ |
808 | # Start build uClibc package module␊ |
809 | choiceId="uClibc"␊ |
810 | moduleFile="uClibcxx.dylib"␊ |
811 | mkdir -p "${PKG_BUILD_DIR}/${choiceId}/Root"␊ |
812 | ditto --noextattr --noqtn "${SYMROOT}/i386/modules/$moduleFile" "${PKG_BUILD_DIR}/${choiceId}/Root"␊ |
813 | addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" \␊ |
814 | --subst="moduleName=$choiceId" \␊ |
815 | --subst="moduleFile=$moduleFile" \␊ |
816 | InstallModule␊ |
817 | ␊ |
818 | packageRefId=$(getPackageRefId "${modules_packages_identity}" "${choiceId}")␊ |
819 | buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/Extra/modules"␊ |
820 | # Add the klibc package because the uClibc module is dependent of klibc module␊ |
821 | addChoice --group="Module" --start-selected="false" --pkg-refs="$packageRefId $klibcPackageRefId" "${choiceId}"␊ |
822 | # End build uClibc package module␊ |
823 | }␊ |
824 | fi␊ |
825 | # -␊ |
826 | }␊ |
827 | else␊ |
828 | {␊ |
829 | echo " -= no modules to include =-"␊ |
830 | }␊ |
831 | fi␊ |
832 | # End build Modules packages␊ |
833 | fi␊ |
834 | ␊ |
835 | # build Options packages␊ |
836 | ␊ |
837 | addGroupChoices "Options"␊ |
838 | ␊ |
839 | # ------------------------------------------------------␊ |
840 | # parse OptionalSettings folder to find files of boot options.␊ |
841 | # ------------------------------------------------------␊ |
842 | OptionalSettingsFolder="${PKGROOT}/OptionalSettings"␊ |
843 | ␊ |
844 | while IFS= read -r -d '' OptionsFile; do␊ |
845 | ␊ |
846 | # Take filename and strip .txt from end and path from front␊ |
847 | builtOptionsList=${OptionsFile%.txt}␊ |
848 | builtOptionsList=${builtOptionsList##*/}␊ |
849 | packagesidentity="${chameleon_package_identity}.options.$builtOptionsList"␊ |
850 | ␊ |
851 | echo "================= $builtOptionsList ================="␊ |
852 | ␊ |
853 | # ------------------------------------------------------␊ |
854 | # Read boot option file into an array.␊ |
855 | # ------------------------------------------------------␊ |
856 | availableOptions=() # array to hold the list of boot options, per 'section'.␊ |
857 | exclusiveFlag="" # used to indicate list has exclusive options␊ |
858 | while read textLine; do␊ |
859 | # ignore lines in the file beginning with a #␊ |
860 | [[ $textLine = \#* ]] && continue␊ |
861 | local optionName="" key="" value=""␊ |
862 | case "$textLine" in␊ |
863 | Exclusive=[Tt][Rr][Uu][Ee]) exclusiveFlag="--exclusive_zero_or_one_choice" ;;␊ |
864 | Exclusive=*) continue ;;␊ |
865 | *@*:*=*)␊ |
866 | availableOptions[${#availableOptions[*]}]="$textLine" ;;␊ |
867 | *) echo "Error: invalid line '$textLine' in file '$OptionsFile'" >&2␊ |
868 | exit 1␊ |
869 | ;;␊ |
870 | esac␊ |
871 | done < "$OptionsFile"␊ |
872 | ␊ |
873 | addGroupChoices --parent="Options" $exclusiveFlag "${builtOptionsList}"␊ |
874 | ␊ |
875 | # ------------------------------------------------------␊ |
876 | # Loop through options in array and process each in turn␊ |
877 | # ------------------------------------------------------␊ |
878 | for textLine in "${availableOptions[@]}"; do␊ |
879 | # split line - taking all before ':' as option name␊ |
880 | # and all after ':' as key/value␊ |
881 | type=$( echo "${textLine%%@*}" | tr '[:upper:]' '[:lower:]' )␊ |
882 | tmp=${textLine#*@}␊ |
883 | optionName=${tmp%%:*}␊ |
884 | keyValue=${tmp##*:}␊ |
885 | key=${keyValue%%=*}␊ |
886 | value=${keyValue#*=}␊ |
887 | ␊ |
888 | # create folders required for each boot option␊ |
889 | mkdir -p "${PKG_BUILD_DIR}/$optionName/Root/"␊ |
890 | ␊ |
891 | case "$type" in␊ |
892 | bool) startSelected="check_chameleon_bool_option('$key','$value')" ;;␊ |
893 | text) startSelected="check_chameleon_text_option('$key','$value')" ;;␊ |
894 | list) startSelected="check_chameleon_list_option('$key','$value')" ;;␊ |
895 | *) echo "Error: invalid type '$type' in line '$textLine' in '$OptionsFile'" >&2␊ |
896 | exit 1␊ |
897 | ;;␊ |
898 | esac␊ |
899 | recordChameleonOption "$type" "$key" "$value"␊ |
900 | addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/$optionName" \␊ |
901 | --subst="optionType=$type" \␊ |
902 | --subst="optionKey=$key" \␊ |
903 | --subst="optionValue=$value" \␊ |
904 | AddOption␊ |
905 | packageRefId=$(getPackageRefId "${packagesidentity}" "${optionName}")␊ |
906 | buildpackage "$packageRefId" "${optionName}" "${PKG_BUILD_DIR}/${optionName}" "/"␊ |
907 | addChoice --group="${builtOptionsList}" \␊ |
908 | --start-selected="$startSelected" \␊ |
909 | --pkg-refs="$packageRefId" "${optionName}"␊ |
910 | done␊ |
911 | ␊ |
912 | done < <( find "${OptionalSettingsFolder}" -depth 1 -type f -name '*.txt' -print0 )␊ |
913 | ␊ |
914 | # End build options packages␊ |
915 | ␊ |
916 | if [[ -n "${CONFIG_KEYLAYOUT_MODULE}" ]];then␊ |
917 | # build Keymaps options packages␊ |
918 | echo "================= Keymaps Options ================="␊ |
919 | addGroupChoices --exclusive_zero_or_one_choice "Keymaps"␊ |
920 | packagesidentity="${chameleon_package_identity}.options.keymaps"␊ |
921 | keylayoutPackageRefId=""␊ |
922 | if [[ "${CONFIG_MODULES}" == 'y' && "${CONFIG_KEYLAYOUT_MODULE}" = 'm' ]];then␊ |
923 | keylayoutPackageRefId=$(getPackageRefId "${modules_packages_identity}" "Keylayout")␊ |
924 | fi␊ |
925 | ␊ |
926 | chameleon_keylayout_key="KeyLayout"␊ |
927 | # ------------------------------------------------------␊ |
928 | # Available Keylayout boot options are discovered by␊ |
929 | # reading contents of /Keymaps folder after compilation␊ |
930 | # ------------------------------------------------------␊ |
931 | availableOptions=($( find "${SRCROOT}/Keymaps" -type f -depth 1 -name '*.lyt' | sed 's|.*/||;s|\.lyt||' ))␊ |
932 | # Adjust array contents to match expected format␊ |
933 | # for boot options which is: name:key=value␊ |
934 | for (( i = 0 ; i < ${#availableOptions[@]} ; i++ )); do␊ |
935 | # Start build of a keymap package module␊ |
936 | choiceId="${availableOptions[i]}"␊ |
937 | mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root␊ |
938 | ␊ |
939 | recordChameleonOption "text" "$chameleon_keylayout_key" "$choiceId"␊ |
940 | addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" \␊ |
941 | --subst="optionType=text" \␊ |
942 | --subst="optionKey=$chameleon_keylayout_key" \␊ |
943 | --subst="optionValue=$choiceId" \␊ |
944 | AddOption␊ |
945 | packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")␊ |
946 | buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/"␊ |
947 | # Add the Keylayout package because the Keylayout module is needed␊ |
948 | addChoice --group="Keymaps" \␊ |
949 | --start-selected="check_chameleon_text_option('${chameleon_keylayout_key}','${choiceId}')" \␊ |
950 | --pkg-refs="$packageRefId $keylayoutPackageRefId" "${choiceId}"␊ |
951 | done␊ |
952 | ␊ |
953 | # End build Keymaps options packages␊ |
954 | fi␊ |
955 | ␊ |
956 | # build theme packages␊ |
957 | echo "================= Themes ================="␊ |
958 | addGroupChoices "Themes"␊ |
959 | ␊ |
960 | # Using themes section from Azi's/package branch.␊ |
961 | packagesidentity="${chameleon_package_identity}.themes"␊ |
962 | artwork="${SRCROOT}/artwork/themes"␊ |
963 | themes=($( find "${artwork}" -type d -depth 1 -not -name '.svn' ))␊ |
964 | for (( i = 0 ; i < ${#themes[@]} ; i++ )); do␊ |
965 | themeName=$( echo ${themes[$i]##*/} | awk 'BEGIN{OFS=FS=""}{$1=toupper($1);print}' )␊ |
966 | themeDir="$themeName"␊ |
967 | mkdir -p "${PKG_BUILD_DIR}/${themeName}/Root/"␊ |
968 | rsync -r --exclude=.svn --exclude="*~" "${themes[$i]}/" "${PKG_BUILD_DIR}/${themeName}/Root/${themeName}"␊ |
969 | addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${themeName}" \␊ |
970 | --subst="themeName=$themeName" \␊ |
971 | --subst="themeDir=$themeDir" \␊ |
972 | InstallTheme␊ |
973 | ␊ |
974 | packageRefId=$(getPackageRefId "${packagesidentity}" "${themeName}")␊ |
975 | buildpackage "$packageRefId" "${themeName}" "${PKG_BUILD_DIR}/${themeName}" "/Extra/Themes"␊ |
976 | addChoice --group="Themes" --start-selected="false" --pkg-refs="$packageRefId" "${themeName}"␊ |
977 | done␊ |
978 | # End build theme packages# End build Extras package␊ |
979 | ␊ |
980 | # build pre install package␊ |
981 | echo "================= Pre ================="␊ |
982 | packagesidentity="${chameleon_package_identity}"␊ |
983 | choiceId="Pre"␊ |
984 | ␊ |
985 | packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")␊ |
986 | mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root␊ |
987 | mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources␊ |
988 | local yamlFile="Resources/chameleon_options.yaml"␊ |
989 | addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" \␊ |
990 | --subst="YAML_FILE=${yamlFile}" ${choiceId}␊ |
991 | generate_options_yaml_file "${PKG_BUILD_DIR}/${choiceId}/Scripts/$yamlFile"␊ |
992 | buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/"␊ |
993 | # End build pre install package␊ |
994 | ␊ |
995 | # build post install package␊ |
996 | echo "================= Post ================="␊ |
997 | packagesidentity="${chameleon_package_identity}"␊ |
998 | choiceId="Post"␊ |
999 | mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root␊ |
1000 | addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" ${choiceId}␊ |
1001 | cp -f ${PKGROOT}/Scripts/Sub/UnMountEFIvolumes.sh ${PKG_BUILD_DIR}/${choiceId}/Scripts␊ |
1002 | ␊ |
1003 | packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")␊ |
1004 | buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/"␊ |
1005 | addChoice --start-visible="false" --start-selected="true" --pkg-refs="$packageRefId" "${choiceId}"␊ |
1006 | # End build post install package␊ |
1007 | ␊ |
1008 | }␊ |
1009 | ␊ |
1010 | buildpackage ()␊ |
1011 | {␊ |
1012 | # $1 Package Reference Id (ie: org.chameleon.themes.default)␊ |
1013 | # $2 Package Name (ie: Default)␊ |
1014 | # $3 Path to package to build containing Root and/or Scripts␊ |
1015 | # $4 Target install location␊ |
1016 | # $5 Size (optional)␊ |
1017 | if [[ -d "${3}/Root" ]]; then␊ |
1018 | local packageRefId="$1"␊ |
1019 | local packageName="$2"␊ |
1020 | local packagePath="$3"␊ |
1021 | local targetPath="$4"␊ |
1022 | set +u # packageSize is optional␊ |
1023 | local packageSize="$5"␊ |
1024 | set -u␊ |
1025 | ␊ |
1026 | echo -e "\t[BUILD] ${packageName}"␊ |
1027 | ␊ |
1028 | find "${packagePath}" -name '.DS_Store' -delete␊ |
1029 | local filecount=$( find "${packagePath}/Root" | wc -l )␊ |
1030 | if [ "${packageSize}" ]; then␊ |
1031 | local installedsize="${packageSize}"␊ |
1032 | else␊ |
1033 | local installedsize=$( du -hkc "${packagePath}/Root" | tail -n1 | awk {'print $1'} )␊ |
1034 | fi␊ |
1035 | local header="<?xml version=\"1.0\"?>\n<pkg-info format-version=\"2\" "␊ |
1036 | ␊ |
1037 | #[ "${3}" == "relocatable" ] && header+="relocatable=\"true\" "␊ |
1038 | ␊ |
1039 | header+="identifier=\"${packageRefId}\" "␊ |
1040 | header+="version=\"${CHAMELEON_VERSION}\" "␊ |
1041 | ␊ |
1042 | [ "${targetPath}" != "relocatable" ] && header+="install-location=\"${targetPath}\" "␊ |
1043 | ␊ |
1044 | header+="auth=\"root\">\n"␊ |
1045 | header+="\t<payload installKBytes=\"${installedsize##* }\" numberOfFiles=\"${filecount##* }\"/>\n"␊ |
1046 | rm -R -f "${packagePath}/Temp"␊ |
1047 | ␊ |
1048 | [ -d "${packagePath}/Temp" ] || mkdir -m 777 "${packagePath}/Temp"␊ |
1049 | [ -d "${packagePath}/Root" ] && mkbom "${packagePath}/Root" "${packagePath}/Temp/Bom"␊ |
1050 | ␊ |
1051 | if [ -d "${packagePath}/Scripts" ]; then␊ |
1052 | header+="\t<scripts>\n"␊ |
1053 | for script in $( find "${packagePath}/Scripts" -type f \( -name 'pre*' -or -name 'post*' \) ); do␊ |
1054 | header+="\t\t<${script##*/} file=\"./${script##*/}\"/>\n"␊ |
1055 | done␊ |
1056 | header+="\t</scripts>\n"␊ |
1057 | # Create the Script archive file (cpio format)␊ |
1058 | (cd "${packagePath}/Scripts" && find . -print | \␊ |
1059 | cpio -o -z -R root:wheel --format cpio > "${packagePath}/Temp/Scripts") 2>&1 | \␊ |
1060 | grep -vE '^[0-9]+\s+blocks?$' # to remove cpio stderr messages␊ |
1061 | fi␊ |
1062 | ␊ |
1063 | header+="</pkg-info>"␊ |
1064 | echo -e "${header}" > "${packagePath}/Temp/PackageInfo"␊ |
1065 | ␊ |
1066 | # Create the Payload file (cpio format)␊ |
1067 | (cd "${packagePath}/Root" && find . -print | \␊ |
1068 | cpio -o -z -R root:wheel --format cpio > "${packagePath}/Temp/Payload") 2>&1 | \␊ |
1069 | grep -vE '^[0-9]+\s+blocks?$' # to remove cpio stderr messages␊ |
1070 | ␊ |
1071 | # Create the package␊ |
1072 | (cd "${packagePath}/Temp" && xar -c -f "${packagePath}/../${packageName}.pkg" --compression none .)␊ |
1073 | ␊ |
1074 | # Add the package to the list of build packages␊ |
1075 | pkgrefs[${#pkgrefs[*]}]="\t<pkg-ref id=\"${packageRefId}\" installKBytes='${installedsize}' version='${CHAMELEON_VERSION}.0.0.${CHAMELEON_TIMESTAMP}'>#${packageName}.pkg</pkg-ref>"␊ |
1076 | ␊ |
1077 | rm -rf "${packagePath}"␊ |
1078 | fi␊ |
1079 | }␊ |
1080 | ␊ |
1081 | generateOutlineChoices() {␊ |
1082 | # $1 Main Choice␊ |
1083 | # $2 indent level␊ |
1084 | local idx=$(getChoiceIndex "$1")␊ |
1085 | local indentLevel="$2"␊ |
1086 | local indentString=""␊ |
1087 | for ((level=1; level <= $indentLevel ; level++)); do␊ |
1088 | indentString="\t$indentString"␊ |
1089 | done␊ |
1090 | set +u; subChoices="${choice_group_items[$idx]}"; set -u␊ |
1091 | if [[ -n "${subChoices}" ]]; then␊ |
1092 | # Sub choices exists␊ |
1093 | echo -e "$indentString<line choice=\"$1\">"␊ |
1094 | for subChoice in $subChoices;do␊ |
1095 | generateOutlineChoices $subChoice $(($indentLevel+1))␊ |
1096 | done␊ |
1097 | echo -e "$indentString</line>"␊ |
1098 | else␊ |
1099 | echo -e "$indentString<line choice=\"$1\"/>"␊ |
1100 | fi␊ |
1101 | }␊ |
1102 | ␊ |
1103 | generateChoices() {␊ |
1104 | for (( idx=1; idx < ${#choice_key[*]} ; idx++)); do␊ |
1105 | local choiceId=${choice_key[$idx]}␊ |
1106 | local choiceOptions=${choice_options[$idx]}␊ |
1107 | local choiceParentGroupIndex=${choice_parent_group_index[$idx]}␊ |
1108 | set +u; local group_exclusive=${choice_group_exclusive[$choiceParentGroupIndex]}; set -u␊ |
1109 | ␊ |
1110 | # Create the node and standard attributes␊ |
1111 | local choiceNode="\t<choice\n\t\tid=\"${choiceId}\"\n\t\ttitle=\"${choiceId}_title\"\n\t\tdescription=\"${choiceId}_description\""␊ |
1112 | ␊ |
1113 | # Add options like start_selected, etc...␊ |
1114 | [[ -n "${choiceOptions}" ]] && choiceNode="${choiceNode}\n\t\t${choiceOptions}"␊ |
1115 | ␊ |
1116 | # Add the selected attribute if options are mutually exclusive␊ |
1117 | if [[ -n "$group_exclusive" ]];then␊ |
1118 | local group_items="${choice_group_items[$choiceParentGroupIndex]}"␊ |
1119 | case $group_exclusive in␊ |
1120 | exclusive_one_choice)␊ |
1121 | local selected_option=$(exclusive_one_choice "$choiceId" "$group_items") ;;␊ |
1122 | exclusive_zero_or_one_choice)␊ |
1123 | local selected_option=$(exclusive_zero_or_one_choice "$choiceId" "$group_items") ;;␊ |
1124 | *) echo "Error: unknown function to generate exclusive mode '$group_exclusive' for group '${choice_key[$choiceParentGroupIndex]}'" >&2␊ |
1125 | exit 1␊ |
1126 | ;;␊ |
1127 | esac␊ |
1128 | choiceNode="${choiceNode}\n\t\tselected=\"$selected_option\""␊ |
1129 | fi␊ |
1130 | ␊ |
1131 | choiceNode="${choiceNode}>"␊ |
1132 | ␊ |
1133 | # Add the package references␊ |
1134 | for pkgRefId in ${choice_pkgrefs[$idx]};do␊ |
1135 | choiceNode="${choiceNode}\n\t\t<pkg-ref id=\"${pkgRefId}\"/>"␊ |
1136 | done␊ |
1137 | ␊ |
1138 | # Close the node␊ |
1139 | choiceNode="${choiceNode}\n\t</choice>\n"␊ |
1140 | ␊ |
1141 | echo -e "$choiceNode"␊ |
1142 | done␊ |
1143 | }␊ |
1144 | ␊ |
1145 | makedistribution ()␊ |
1146 | {␊ |
1147 | declare -r distributionDestDir="${SYMROOT}"␊ |
1148 | declare -r distributionFilename="${packagename// /}-${CHAMELEON_VERSION}-r${CHAMELEON_REVISION}.pkg"␊ |
1149 | declare -r distributionFilePath="${distributionDestDir}/${distributionFilename}"␊ |
1150 | ␊ |
1151 | rm -f "${distributionDestDir}/${packagename// /}"*.pkg␊ |
1152 | ␊ |
1153 | mkdir -p "${PKG_BUILD_DIR}/${packagename}"␊ |
1154 | ␊ |
1155 | find "${PKG_BUILD_DIR}" -type f -name '*.pkg' -depth 1 | while read component␊ |
1156 | do␊ |
1157 | pkg="${component##*/}" # ie: EFI.pkg␊ |
1158 | pkgdir="${PKG_BUILD_DIR}/${packagename}/${pkg}"␊ |
1159 | # expand individual packages␊ |
1160 | pkgutil --expand "${PKG_BUILD_DIR}/${pkg}" "$pkgdir"␊ |
1161 | rm -f "${PKG_BUILD_DIR}/${pkg}"␊ |
1162 | done␊ |
1163 | ␊ |
1164 | # Create the Distribution file␊ |
1165 | ditto --noextattr --noqtn "${PKGROOT}/Distribution" "${PKG_BUILD_DIR}/${packagename}/Distribution"␊ |
1166 | ␊ |
1167 | local start_indent_level=2␊ |
1168 | echo -e "\n\t<choices-outline>" >> "${PKG_BUILD_DIR}/${packagename}/Distribution"␊ |
1169 | for main_choice in ${choice_group_items[0]};do␊ |
1170 | generateOutlineChoices $main_choice $start_indent_level >> "${PKG_BUILD_DIR}/${packagename}/Distribution"␊ |
1171 | done␊ |
1172 | echo -e "\t</choices-outline>\n" >> "${PKG_BUILD_DIR}/${packagename}/Distribution"␊ |
1173 | ␊ |
1174 | generateChoices >> "${PKG_BUILD_DIR}/${packagename}/Distribution"␊ |
1175 | ␊ |
1176 | for (( i=0; i < ${#pkgrefs[*]} ; i++)); do␊ |
1177 | echo -e "${pkgrefs[$i]}" >> "${PKG_BUILD_DIR}/${packagename}/Distribution"␊ |
1178 | done␊ |
1179 | ␊ |
1180 | echo -e "\n</installer-gui-script>" >> "${PKG_BUILD_DIR}/${packagename}/Distribution"␊ |
1181 | ␊ |
1182 | # Create the Resources directory␊ |
1183 | ditto --noextattr --noqtn "${PKGROOT}/Resources/distribution" "${PKG_BUILD_DIR}/${packagename}/Resources"␊ |
1184 | ␊ |
1185 | # Make the translation␊ |
1186 | echo ""␊ |
1187 | echo "========= Translating Resources ========"␊ |
1188 | (cd "${PKGROOT}" && PERLLIB=${PKGROOT}/bin/po4a/lib \␊ |
1189 | bin/po4a/po4a \␊ |
1190 | --package-name 'Chameleon' \␊ |
1191 | --package-version "${CHAMELEON_VERSION}-r${CHAMELEON_REVISION}" \␊ |
1192 | --msgmerge-opt '--lang=$lang' \␊ |
1193 | --variable PODIR="po" \␊ |
1194 | --variable TEMPLATES_DIR="Resources/templates" \␊ |
1195 | --variable OUTPUT_DIR="${PKG_BUILD_DIR}/${packagename}/Resources" \␊ |
1196 | ${PKGROOT}/po4a-chameleon.cfg)␊ |
1197 | ␊ |
1198 | # Copy common files in english localisation directory␊ |
1199 | ditto --noextattr --noqtn "${PKGROOT}/Resources/common" "${PKG_BUILD_DIR}/${packagename}/Resources/en.lproj"␊ |
1200 | ␊ |
1201 | # CleanUp the directory␊ |
1202 | find "${PKG_BUILD_DIR}/${packagename}" \( -type d -name '.svn' \) -o -name '.DS_Store' -depth -exec rm -rf {} \;␊ |
1203 | find "${PKG_BUILD_DIR}/${packagename}" -type d -depth -empty -exec rmdir {} \; # Remove empty directories␊ |
1204 | ␊ |
1205 | # Make substitutions for version, revision, stage, developers, credits, etc..␊ |
1206 | makeSubstitutions $( find "${PKG_BUILD_DIR}/${packagename}/Resources" -type f )␊ |
1207 | ␊ |
1208 | # Create the final package␊ |
1209 | pkgutil --flatten "${PKG_BUILD_DIR}/${packagename}" "${distributionFilePath}"␊ |
1210 | ␊ |
1211 | ##################################################################␊ |
1212 | # Here is the place to assign an icon to the pkg #␊ |
1213 | # command used to generate the file: #␊ |
1214 | # ditto -c -k --sequesterRsrc --keepParent Icon.icns Icon.zip #␊ |
1215 | ##################################################################␊ |
1216 | ditto -xk "${PKGROOT}/Icons/pkg.zip" "${PKG_BUILD_DIR}/Icons/"␊ |
1217 | DeRez -only icns "${PKG_BUILD_DIR}/Icons/Icons/pkg.icns" > "${PKG_BUILD_DIR}/Icons/tempicns.rsrc"␊ |
1218 | Rez -append "${PKG_BUILD_DIR}/Icons/tempicns.rsrc" -o "${distributionFilePath}"␊ |
1219 | SetFile -a C "${distributionFilePath}"␊ |
1220 | rm -rf "${PKG_BUILD_DIR}/Icons"␊ |
1221 | ␊ |
1222 | # End␊ |
1223 | ␊ |
1224 | md5=$( md5 "${distributionFilePath}" | awk {'print $4'} )␊ |
1225 | echo "MD5 (${distributionFilePath}) = ${md5}" > "${distributionFilePath}.md5"␊ |
1226 | echo ""␊ |
1227 | ␊ |
1228 | echo -e $COL_GREEN" --------------------------"$COL_RESET␊ |
1229 | echo -e $COL_GREEN" Building process complete!"$COL_RESET␊ |
1230 | echo -e $COL_GREEN" --------------------------"$COL_RESET␊ |
1231 | echo ""␊ |
1232 | echo -e $COL_GREEN" Build info."␊ |
1233 | echo -e $COL_GREEN" ==========="␊ |
1234 | echo -e $COL_BLUE" Package name: "$COL_RESET"${distributionFilename}"␊ |
1235 | echo -e $COL_BLUE" MD5: "$COL_RESET"$md5"␊ |
1236 | echo -e $COL_BLUE" Version: "$COL_RESET"$CHAMELEON_VERSION"␊ |
1237 | echo -e $COL_BLUE" Stage: "$COL_RESET"$CHAMELEON_STAGE"␊ |
1238 | echo -e $COL_BLUE" Date/Time: "$COL_RESET"$CHAMELEON_BUILDDATE"␊ |
1239 | echo -e $COL_BLUE" Built by: "$COL_RESET"$CHAMELEON_WHOBUILD"␊ |
1240 | echo -e $COL_BLUE" Copyright $CHAMELEON_CPRYEAR ""$COL_RESET"␊ |
1241 | echo ""␊ |
1242 | ␊ |
1243 | }␊ |
1244 | ␊ |
1245 | # build packages␊ |
1246 | main␊ |
1247 | ␊ |
1248 | # build meta package␊ |
1249 | makedistribution␊ |
1250 | |