source "${SRCROOT}/auto.conf"␊ |
␊ |
# ====== COLORS ======␊ |
␊ |
declare -r COL_BLACK="\x1b[30;01m"␊ |
declare -r COL_RED="\x1b[31;01m"␊ |
declare -r COL_GREEN="\x1b[32;01m"␊ |
|
declare -r COL_RESET="\x1b[39;49;00m"␊ |
␊ |
# ====== REVISION/VERSION ======␊ |
␊ |
declare -r CHAMELEON_VERSION=$( cat version )␊ |
␊ |
# stage␊ |
|
declare -r CHAMELEON_TIMESTAMP=$( date -j -f "%Y-%m-%d %H:%M:%S" "${CHAMELEON_BUILDDATE}" "+%s" )␊ |
␊ |
# ====== CREDITS ======␊ |
␊ |
declare -r CHAMELEON_DEVELOP=$(awk "NR==6{print;exit}" ${PKGROOT}/../CREDITS)␊ |
declare -r CHAMELEON_CREDITS=$(awk "NR==10{print;exit}" ${PKGROOT}/../CREDITS)␊ |
declare -r CHAMELEON_PKGDEV=$(awk "NR==14{print;exit}" ${PKGROOT}/../CREDITS)␊ |
declare -r CHAMELEON_CPRYEAR=$(awk "NR==18{print;exit}" ${PKGROOT}/../CREDITS)␊ |
if [[ $(whoami | awk '{print $1}' | cut -d ":" -f3) == "cmorton" ]];then␊ |
declare -r CHAMELEON_WHOBUILD="VoodooLabs BuildBot"␊ |
else␊ |
|
declare -r modules_packages_identity="${chameleon_package_identity}.modules"␊ |
␊ |
# ====== FUNCTIONS ======␊ |
␊ |
trim () {␊ |
local result="${1#"${1%%[![:space:]]*}"}" # remove leading whitespace characters␊ |
echo "${result%"${result##*[![:space:]]}"}" # remove trailing whitespace characters␊ |
|
function makeSubstitutions () {␊ |
# Substition is like: Key=Value␊ |
#␊ |
# Optionnal arguments:␊ |
# Optional arguments:␊ |
# --subst=<substition> : add a new substitution␊ |
#␊ |
# Last argument(s) is/are file(s) where substitutions must be made␊ |
|
s&%DEVELOP%&${CHAMELEON_DEVELOP}&g␊ |
s&%CREDITS%&${CHAMELEON_CREDITS}&g␊ |
s&%PKGDEV%&${CHAMELEON_PKGDEV}&g␊ |
s&%CPRYEAR%&${CHAMELEON_CPRYEAR}&g␊ |
s&%WHOBUILD%&${CHAMELEON_WHOBUILD}&g␊ |
:t␊ |
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b␊ |
|
# Arguments:␊ |
# --pkg-rootdir=<pkg_rootdir> : path of the pkg root dir␊ |
#␊ |
# Optionnal arguments:␊ |
# Optional arguments:␊ |
# --subst=<substition> : add a new substitution␊ |
#␊ |
# Substition is like: Key=Value␊ |
|
␊ |
# Add a new choice␊ |
addChoice () {␊ |
# Optionnal arguments:␊ |
# Optional arguments:␊ |
# --group=<group> : Group Choice Id␊ |
# --start-selected=<javascript code> : Specifies whether this choice is initially selected or unselected␊ |
# --start-enabled=<javascript code> : Specifies the initial enabled state of this choice␊ |
|
␊ |
# Add a group choice␊ |
addGroupChoices() {␊ |
# Optionnal arguments:␊ |
# Optional arguments:␊ |
# --parent=<parent> : parent group choice id␊ |
# --exclusive_zero_or_one_choice : only zero or one choice can be selected in the group␊ |
# --exclusive_one_choice : only one choice can be selected in the group␊ |
|
packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}")␊ |
addChoice --start-visible="false" --start-selected="true" --pkg-refs="$packageRefId" "${choiceId}"␊ |
␊ |
# Package will be build at the end␊ |
# Package will be built at the end␊ |
# End pre install choice␊ |
␊ |
# build core package␊ |
|
␊ |
while IFS= read -r -d '' OptionsFile; do␊ |
␊ |
# Take filename and Strip .txt from end and path from front␊ |
# Take filename and strip .txt from end and path from front␊ |
builtOptionsList=${OptionsFile%.txt}␊ |
builtOptionsList=${builtOptionsList##*/}␊ |
packagesidentity="${chameleon_package_identity}.options.$builtOptionsList"␊ |
|
# CleanUp the directory␊ |
find "${PKG_BUILD_DIR}/${packagename}" \( -type d -name '.svn' \) -o -name '.DS_Store' -exec rm -rf {} \;␊ |
␊ |
# Make substitutions like version, revision, stage, developers, credits, etc..␊ |
# Make substitutions for version, revision, stage, developers, credits, etc..␊ |
makeSubstitutions $( find "${PKG_BUILD_DIR}/${packagename}/Resources" -type f )␊ |
␊ |
# Create the final package␊ |
pkgutil --flatten "${PKG_BUILD_DIR}/${packagename}" "${distributionFilePath}"␊ |
␊ |
# Here is the place for assign a Icon to the pkg␊ |
# Here is the place to assign an icon to the pkg␊ |
ditto -xk "${PKGROOT}/Icons/pkg.zip" "${PKG_BUILD_DIR}/Icons/"␊ |
DeRez -only icns "${PKG_BUILD_DIR}/Icons/Icons/pkg.icns" > "${PKG_BUILD_DIR}/Icons/tempicns.rsrc"␊ |
Rez -append "${PKG_BUILD_DIR}/Icons/tempicns.rsrc" -o "${distributionFilePath}"␊ |
|
echo -e $COL_BLUE" Version: "$COL_RESET"$CHAMELEON_VERSION"␊ |
echo -e $COL_BLUE" Stage: "$COL_RESET"$CHAMELEON_STAGE"␊ |
echo -e $COL_BLUE" Date/Time: "$COL_RESET"$CHAMELEON_BUILDDATE"␊ |
echo -e $COL_BLUE" Builded by: "$COL_RESET"$CHAMELEON_WHOBUILD"␊ |
echo -e $COL_BLUE" Built by: "$COL_RESET"$CHAMELEON_WHOBUILD"␊ |
echo -e $COL_BLUE" Copyright $CHAMELEON_CPRYEAR ""$COL_RESET"␊ |
echo ""␊ |
␊ |
}␊ |