Chameleon

Chameleon Commit Details

Date:2011-12-28 21:33:48 (8 years 5 months ago)
Author:JrCs
Commit:1757
Parents: 1756
Message:Improved buildpkg script - Declare some variables read-only
Changes:
M/trunk/package/buildpkg.sh

File differences

trunk/package/buildpkg.sh
55
66
77
8
9
10
11
8
9
10
11
1212
1313
1414
......
2424
2525
2626
27
28
29
30
31
32
33
34
35
27
28
29
30
31
32
33
34
35
3636
3737
3838
39
39
40
41
4042
41
42
43
43
44
45
4446
47
48
49
50
4551
4652
47
48
49
53
54
55
5056
5157
5258
......
6268
6369
6470
71
72
73
6574
66
67
68
69
75
76
77
7078
7179
7280
......
135143
136144
137145
138
146
139147
140148
141149
......
151159
152160
153161
154
162
155163
156164
157165
......
177185
178186
179187
180
188
181189
182190
183191
......
382390
383391
384392
385
393
386394
387395
388396
......
438446
439447
440448
441
449
442450
443451
444452
......
484492
485493
486494
487
495
488496
489497
490498
......
503511
504512
505513
506
514
507515
508516
509517
......
592600
593601
594602
595
596
597
603
604
605
598606
599607
600608
......
637645
638646
639647
640
641
642648
643649
644650
# $2 directory where pkgs will be created
# Directory paths
PKGROOT="${0%/*}"
SRCROOT="$1"
SYMROOT="$2"
PKG_BUILD_DIR="$3"
declare -r PKGROOT="${0%/*}"
declare -r SRCROOT="$1"
declare -r SYMROOT="$2"
declare -r PKG_BUILD_DIR="$3"
if [[ $# -lt 3 ]];then
echo "Too few arguments. Aborting..." >&2 && exit 1
# ====== COLORS ======
COL_BLACK="\x1b[30;01m"
COL_RED="\x1b[31;01m"
COL_GREEN="\x1b[32;01m"
COL_YELLOW="\x1b[33;01m"
COL_MAGENTA="\x1b[35;01m"
COL_CYAN="\x1b[36;01m"
COL_WHITE="\x1b[37;01m"
COL_BLUE="\x1b[34;01m"
COL_RESET="\x1b[39;49;00m"
declare -r COL_BLACK="\x1b[30;01m"
declare -r COL_RED="\x1b[31;01m"
declare -r COL_GREEN="\x1b[32;01m"
declare -r COL_YELLOW="\x1b[33;01m"
declare -r COL_MAGENTA="\x1b[35;01m"
declare -r COL_CYAN="\x1b[36;01m"
declare -r COL_WHITE="\x1b[37;01m"
declare -r COL_BLUE="\x1b[34;01m"
declare -r COL_RESET="\x1b[39;49;00m"
# ====== REVISION/VERSION ======
version=$( cat version )
declare -r version=$( cat version )
# stage
stage=${version##*-}
revision=$( grep I386BOOT_CHAMELEONREVISION vers.h | awk '{ print $3 }' | tr -d '\"' )
builddate=$( grep I386BOOT_BUILDDATE vers.h | awk '{ print $3,$4 }' | tr -d '\"' )
timestamp=$( date -j -f "%Y-%m-%d %H:%M:%S" "${builddate}" "+%s" )
stage=${stage/RC/Release Candidate }
stage=${stage/FINAL/2.1 Final}
declare -r stage
declare -r revision=$( grep I386BOOT_CHAMELEONREVISION vers.h | awk '{ print $3 }' | tr -d '\"' )
declare -r builddate=$( grep I386BOOT_BUILDDATE vers.h | awk '{ print $3,$4 }' | tr -d '\"' )
declare -r timestamp=$( date -j -f "%Y-%m-%d %H:%M:%S" "${builddate}" "+%s" )
# ====== CREDITS ======
develop=$(awk "NR==6{print;exit}" ${PKGROOT}/../CREDITS)
credits=$(awk "NR==10{print;exit}" ${PKGROOT}/../CREDITS)
pkgdev=$(awk "NR==14{print;exit}" ${PKGROOT}/../CREDITS)
declare -r develop=$(awk "NR==6{print;exit}" ${PKGROOT}/../CREDITS)
declare -r credits=$(awk "NR==10{print;exit}" ${PKGROOT}/../CREDITS)
declare -r pkgdev=$(awk "NR==14{print;exit}" ${PKGROOT}/../CREDITS)
# =================
declare -a outline
declare -a choices
# Package name
declare -r packagename="Chameleon"
# Package identifiers
packagesidentity="org.chameleon"
modules_packages_identity="${packagesidentity}.modules"
packagename="Chameleon"
chamTemp="usr/local/chamTemp"
declare -r chameleon_package_identity="org.chameleon"
declare -r modules_packages_identity="${chameleon_package_identity}.modules"
declare -r chamTemp="usr/local/chamTemp"
# ====== FUNCTIONS ======
# build pre install package
echo "================= Preinstall ================="
((xmlindent++))
packagesidentity="org.chameleon"
packagesidentity="${chameleon_package_identity}"
choiceId="Pre"
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Scripts
# build core package
echo "================= Core ================="
packagesidentity="org.chameleon"
packagesidentity="${chameleon_package_identity}"
choiceId="Core"
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root/usr/local/bin
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root/usr/standalone/i386
outline[${#outline[*]}]="${indent[$xmlindent]}<line choice=\"InstallType\">"
choices[${#choices[*]}]="\t<choice\n\t\tid=\"InstallType\"\n\t\ttitle=\"InstallType_title\"\n\t\tdescription=\"InstallType_description\">\n\t</choice>\n"
((xmlindent++))
packagesidentity="org.chameleon.type"
packagesidentity="${chameleon_package_identity}.type"
allChoices="New Upgrade"
# build new install package
outline[${#outline[*]}]="${indent[$xmlindent]}<line choice=\"${builtOptionsList}\">"
choices[${#choices[*]}]="\t<choice\n\t\tid=\"${builtOptionsList}\"\n\t\ttitle=\"${builtOptionsList}_title\"\n\t\tdescription=\"${builtOptionsList}_description\">\n\t</choice>\n"
((xmlindent++))
packagesidentity="org.chameleon.options.$builtOptionsList"
packagesidentity="${chameleon_package_identity}.options.$builtOptionsList"
# ------------------------------------------------------
# Read boot option file into an array.
outline[${#outline[*]}]="${indent[$xmlindent]}<line choice=\"KeyLayout\">"
choices[${#choices[*]}]="\t<choice\n\t\tid=\"KeyLayout\"\n\t\ttitle=\"KeyLayout_title\"\n\t\tdescription=\"KeyLayout_description\">\n\t</choice>\n"
((xmlindent++))
packagesidentity="org.chameleon.options.keylayout"
packagesidentity="${chameleon_package_identity}.options.keylayout"
keylayoutPackageRefId=$(getPackageRefId "${modules_packages_identity}" "Keylayout")
# ------------------------------------------------------
((xmlindent++))
# Using themes section from Azi's/package branch.
packagesidentity="org.chameleon.themes"
packagesidentity="${chameleon_package_identity}.themes"
artwork="${SRCROOT}/artwork/themes"
themes=($( find "${artwork}" -type d -depth 1 -not -name '.svn' ))
for (( i = 0 ; i < ${#themes[@]} ; i++ )); do
# build post install package
echo "================= Post ================="
packagesidentity="org.chameleon"
packagesidentity="${chameleon_package_identity}"
choiceId="Post"
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root
mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Scripts
makedistribution ()
{
distributionDestDir="${SYMROOT}"
distributionFilename="${packagename// /}-${version}-r${revision}.pkg"
distributionFilePath="${distributionDestDir}/${distributionFilename}"
declare -r distributionDestDir="${SYMROOT}"
declare -r distributionFilename="${packagename// /}-${version}-r${revision}.pkg"
declare -r distributionFilePath="${distributionDestDir}/${distributionFilename}"
rm -f "${distributionDestDir}/${packagename// /}"*.pkg
perl -i -p -e "s/%CHAMELEONREVISION%/${revision}/g" $( find "${PKG_BUILD_DIR}/${packagename}/Resources" -type f )
# Add Chameleon Stage
stage=${stage/RC/Release Candidate }
stage=${stage/FINAL/2.0 Final}
perl -i -p -e "s/%CHAMELEONSTAGE%/${stage}/g" $( find "${PKG_BUILD_DIR}/${packagename}/Resources" -type f )
# Adding Developer and credits

Archive Download the corresponding diff file

Revision: 1757