Index: branches/ErmaC/Trunk/package/Scripts.templates/InstallerLog/InstallLog.sh =================================================================== --- branches/ErmaC/Trunk/package/Scripts.templates/InstallerLog/InstallLog.sh (revision 0) +++ branches/ErmaC/Trunk/package/Scripts.templates/InstallerLog/InstallLog.sh (revision 1778) @@ -0,0 +1,50 @@ +#!/bin/bash + +#echo "===============================================" +#echo "InstallLog: Create/Append installation log" +#echo "**********************************************" + +# Writes to the @LOG_FILENAME@ file created +# by the preinstall script at the start of installation. + +# Receives two parameters +# $1 = selected volume for location of the install log +# $2 = text to write to the installer log + +if [ "$#" -eq 2 ]; then + logLocation="$1" + verboseText="$2" + #echo "DEBUG: passed argument = ${logLocation}" + #echo "DEBUG: passed argument = ${verboseText}" +else + echo "InstallLog: Error - wrong number of values passed" + exit 9 +fi + +logName="@LOG_FILENAME@" +logFile="${logLocation}"/$logName + +if [ -f "${logFile}" ]; then + + # Append messages to the log as passed by other scripts. + if [ "${verboseText}" = "Diskutil" ]; then + diskutil list >>"${logFile}" + echo "======================================================" >>"${logFile}" + fi + + if [ "${verboseText}" = "LineBreak" ]; then + echo "======================================================" >>"${logFile}" + fi + + if [[ "${verboseText}" == *fdisk* ]]; then + targetDiskRaw="${verboseText#fdisk *}" + fdisk $targetDiskRaw >>"${logFile}" + echo " " >>"${logFile}" + fi + + if [ "${verboseText}" != "LineBreak" ] && [[ "${verboseText}" != *fdisk* ]] && [[ "${verboseText}" != "Diskutil" ]]; then + echo "${verboseText}" >> "${logFile}" + fi +fi + +exit 0 Property changes on: branches/ErmaC/Trunk/package/Scripts.templates/InstallerLog/InstallLog.sh ___________________________________________________________________ Added: svn:executable + * Index: branches/ErmaC/Trunk/package/Scripts.templates/Post/postinstall =================================================================== --- branches/ErmaC/Trunk/package/Scripts.templates/Post/postinstall (revision 0) +++ branches/ErmaC/Trunk/package/Scripts.templates/Post/postinstall (revision 1778) @@ -0,0 +1,295 @@ +#!/bin/bash + +mergeString () { + local src="${1}" + local new="${2}" + local result="$src" + + for newItem in $new ;do + local found=0 + for srcItem in $src ;do + if [[ $newItem == $srcItem ]];then + found=1 + break + fi + done + [[ $found -eq 0 ]] && result="$result $newItem" + done + + echo "$result" +} + +echo "===============================================" +echo "Post Post-Install Script" +echo "*********************************" + +#echo "DEBUG: $ 1 = Full path to the installation package the installer app is processing: " $1 +#echo "DEBUG: $ 2 = Full path to the installation destination: " $2 +#echo "DEBUG: $ 3 = Installation volume (mountpoint) to receive the payload: " $3 +#echo "DEBUG: $ 4 = Root directory for the system: " $4 + +# Check target exists +if [ ! -e "$3" ] +then + echo "$3 volume does not exist!" + exit 1 +fi + +# If target volume root of current system then replace +# / with volume name. +if [ "$3" == "/" ] +then + dest_vol="/Volumes/"$( ls -1F /Volumes | sed -n 's:@$::p' ) +else + dest_vol="$3" +fi + +# Find script location so to find the Install Log script. +MYLOCATION="${PWD}/${BASH_ARGV[0]}" +export MYLOCATION="${MYLOCATION%/*}" +scriptDir=$MYLOCATION + +# Write some information to the Install Log +"$scriptDir"InstallLog.sh "${dest_vol}" "Running Post postinstall script" +"$scriptDir"InstallLog.sh "${dest_vol}" "Target volume = ${dest_vol}" + +# set temporary directory +chamTemp="$dest_vol/usr/local/chamTemp" + + +# --------------------------------------------- +# Build org.chameleon.Boot.plist +# --------------------------------------------- +# All options selected are now dummy files with +# the filename of the option and value residing +# in /usr/local/chamTemp/options/ +# for example. Boot Banner=Yes + +# Are there any options to build? +if [ "$(ls -A ${chamTemp}/options )" ]; then + + # Check for temporary directory/Extra folder. + if [ ! -d "$chamTemp"/Extra ]; then + mkdir "$chamTemp"/Extra + fi + + tempOCBP="$chamTemp"/Extra/org.chameleon.Boot.plist + + # Create template for org.chameleon.Boot.plist" + tempOCBP="$chamTemp"/Extra/org.chameleon.Boot.plist + cp "$4"/Library/Preferences/SystemConfiguration/com.apple.Boot.plist "$tempOCBP" + + # Read list of all boot options the user added. + while IFS= read -r -d '' FILE; do + option="${FILE##*/}" + key="${option%%=*}" + value="${option#*=}" + + # Check for 'Kernel Flags' key indicate that should be a kernel flag + if [[ "$key" = "Kernel Flags" ]];then + # plistbuddy only add's if the key doesn't already exist. + # So let's store any kernelflags and add them all at the + # same time once when we reach the end of the options list. + kernelflag[${#kernelflag[*]}]="$value" + "$scriptDir"InstallLog.sh "${dest_vol}" "Added kernel flag: $value" + else + # escape any spaces + keyToUse=$( echo "$key" | sed 's/ /\\ /g' ) + sudo /usr/libexec/plistbuddy -c "Add :${keyToUse} string ${value}" "$tempOCBP" + returnValue=$? + if [ ${returnValue} -ne 1 ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Added boot option: ${key}=${value}" + else + "$scriptDir"InstallLog.sh "${dest_vol}" "Can't add ${key}=${value} as an option already exists for: ${key}" + fi + fi + done < <( find "${chamTemp}/options" -type f -print0 ) + + # Add any kernel flags together in to one string. + kernelFlagString="${kernelflag[@]}" + # We add the final string in the next section. +fi + +# --------------------------------------------- +# Add any installed modules to the Install Log +# --------------------------------------------- +if [ -e "${chamTemp}"/Extra/modules ]; then + ls "${chamTemp}"/Extra/modules | while read FILE + do + "$scriptDir"InstallLog.sh "${dest_vol}" "Added module: $FILE" + if [ "$FILE" == "Keylayout.dylib" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Also adding required Keymaps." + fi + done +fi + +# --------------------------------------------- +# Add any installed themes to the Install Log +# --------------------------------------------- +if [ -e "${chamTemp}"/Extra/Themes ]; then + ls "${chamTemp}"/Extra/Themes | while read FILE + do + "$scriptDir"InstallLog.sh "${dest_vol}" "Added Theme: $FILE" + done +fi + +# Does a temporary /Extra folder exist? +if [ -d "$chamTemp"/Extra ]; then + + # --------------------------------------------- + # Merge /Extra folders? + # --------------------------------------------- + # Does the user want to upgrade an existing /Extra folder? + # If so, then merge their existing one in to the temp one. + if [ -e "$chamTemp/install_type_upgrade" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "User selected to do an upgrade install." + + # first move the new org.chameleon.Boot.plist out of tmp + # Extra folder so we can merge that separately. + mv "$tempOCBP" "$chamTemp/holding.plist" + + # Check for an existing /Extra folder + # and merge existing /Extra with temp one. + if [ -e "$dest_vol"/.ChameleonEFI ]; then + if [ -e "/Volumes/EFI/Extra" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Merging existing /Volumes/EFI/Extra folder." + ditto --noextattr --noqtn /Volumes/EFI/Extra "$chamTemp"/Extra + fi + else + if [ -e "$dest_vol/Extra" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Merging existing ${dest_vol}/Extra folder." + ditto --noextattr --noqtn "${dest_vol}"/Extra "$chamTemp"/Extra + fi + fi + + # Check existing plist name for old naming convention + # and change to new convention. + if [ -e "$chamTemp"/Extra/com.apple.Boot.plist ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Renaming existing com.apple.Boot.plist to org.chameleon.Boot.plist." + mv "$chamTemp"/Extra/com.apple.Boot.plist "$tempOCBP" + fi + + # Before merging org.chameleon.Boot.plist, copy any + # existing kernel flags, then delete the entry. + currentFlags=$( sudo /usr/libexec/plistbuddy -c "Print :Kernel\ Flags" "$tempOCBP" ) + sudo /usr/libexec/plistbuddy -c "Delete :Kernel\ Flags" "$tempOCBP" + + # Merge new org.chameleon.Boot.plist (holding.plist) + # with their currently existing one. + "$scriptDir"InstallLog.sh "${dest_vol}" "------ +Merging new options into org.chameleon.Boot.plist. +NOTE: Please check the new merged org.chameleon.Boot.plist as +NOTE: any existing keys will NOT have been updated. +NOTE: For example: If you already had Wait=No as a boot option +NOTE: and chose Wait=Yes from the list, this will NOT be changed. +------" + sudo /usr/libexec/plistbuddy -c "Merge $chamTemp/holding.plist" "$tempOCBP" + + if [[ -n "$currentFlags" ]];then + # Combine new kernel flags with old ones. + kernelFlagString=$( mergeString "$currentFlags" "${kernelFlagString}" ) + fi + + elif [ -e "$chamTemp/install_type_new" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "User selected to make a new install." + fi + + # Write kernel flags option + kernelFlagString=$(echo ${kernelFlagString}) # Remove leading and trailing spaces + if [[ -n "$kernelFlagString" ]];then + sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelFlagString" "$tempOCBP" + returnValue=$? + if [ ${returnValue} -ne 0 ]; then # key already exists. + sudo /usr/libexec/plistbuddy -c "Delete :Kernel\ Flags" "$tempOCBP" + sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelFlagString" "$tempOCBP" + fi + fi + + # --------------------------------------------- + # Copy temp Extra folder to target destination + # --------------------------------------------- + # Check for an existing /Extra folder. If found, back it up + # before copying the temporary Extra folder to destination. + # Extra folder now resides in /usr/local/chamTemp/ + # Copy /usr/local/chamTemp/Extra to correct location. + + if [ ! -f "$dest_vol"/.ChameleonEFI ]; then + # The Standard install option chosen + rm -rf "$dest_vol/Extra" # Remove old Extra directory + + "$scriptDir"InstallLog.sh "${dest_vol}" "Writing new Extra folder to: $dest_vol/" + echo "Copying $chamTemp/Extra TO $dest_vol" + cp -R "$chamTemp"/Extra "$dest_vol" + else + # The EFI system partition install option was chosen + rm -rf "/Volumes/EFI/Extra" # Remove old Extra directory + + "$scriptDir"InstallLog.sh "${dest_vol}" "Writing new Extra folder to: /Volumes/EFI/" + cp -R "$chamTemp"/Extra "/Volumes/EFI" + fi +else + if [ ! -f "$dest_vol"/.ChameleonEFI ]; then + if [ -e "$dest_vol"/Extra ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "No elements selected for adding to an Extra folder, +so leaving existing $dest_vol/Extra folder untouched." + fi + else + if [ -e "/Volumes/EFI/Extra" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "No elements selected for adding to an Extra folder, +so leaving existing /Volumes/EFI/Extra folder untouched." + fi + fi +fi + +# --------------------------------------------- +# Update Rights +# --------------------------------------------- +chmod 777 ${dest_vol}/Extra 2>/dev/null +chmod 666 ${dest_vol}/Extra/*.plist 2>/dev/null + +# --------------------------------------------- +# Cleanup +# --------------------------------------------- + +# Unmount ALL mounted volumes named EFI +"$scriptDir"UnMountEFIvolumes.sh "${dest_vol}" "${scriptDir}" + +# remove any temporary boot sector files if they exist +if [ -d /tmp/newbs ]; then + cleanUp="${cleanUp},1a" + rm /tmp/newbs +fi +if [ -d /tmp/origbs ]; then + cleanUp="${cleanUp},1b" + rm /tmp/origbs +fi +if [ -d /tmp/newBootSector ]; then + cleanUp="${cleanUp},1c" + rm /tmp/newbs +fi +if [ -d /tmp/originalBootSector ]; then + cleanUp="${cleanUp},1d" + rm /tmp/origbs +fi + +# delete the temporary Chameleon folder +if [ -e "$chamTemp" ]; then + cleanUp="${cleanUp},2" + rm -rf "$chamTemp" +fi + +# Remove /.ChameleonEFI file +if [ -f "$dest_vol"/.ChameleonEFI ]; then + cleanUp="${cleanUp},3" + rm "$dest_vol"/.ChameleonEFI +fi + +"$scriptDir"InstallLog.sh "${dest_vol}" "Cleanup: ${cleanUp}" +"$scriptDir"InstallLog.sh "${dest_vol}" "LineBreak" +"$scriptDir"InstallLog.sh "${dest_vol}" "Post script complete" + +echo "===============================================" +echo "END - Post Post-Install Script" +echo "*********************************" +echo "-----------------------------------------------" +echo "" Property changes on: branches/ErmaC/Trunk/package/Scripts.templates/Post/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/ErmaC/Trunk/package/Scripts.templates/Pre/preinstall =================================================================== --- branches/ErmaC/Trunk/package/Scripts.templates/Pre/preinstall (revision 0) +++ branches/ErmaC/Trunk/package/Scripts.templates/Pre/preinstall (revision 1778) @@ -0,0 +1,80 @@ +#!/bin/bash + +echo "===============================================" +echo "Pre-Install Script" +echo "*********************************" +echo "-----------------------------------------------" +echo "" + +# Creates text file named '@LOG_FILENAME@' +# at the root of the target volume. This is to help show the +# user why the installation process failed (even though the +# package installer ends reading 'Installation Successful'. + + + +# Find location of this script in the package installer +# so we know where all the other scripts are located. + +MYLOCATION="${PWD}/${BASH_ARGV[0]}" +export MYLOCATION="${MYLOCATION%/*}" +scriptDir=$MYLOCATION + + +# If target volume root of current system then replace +# / with volume name. +if [ "$3" == "/" ] +then + targetVolume="/Volumes/"$( ls -1F /Volumes | sed -n 's:@$::p' ) +else + targetVolume="$3" +fi + +logName="@LOG_FILENAME@" +logFile="${targetVolume}/$logName" + +# --------------------------------------------- +# Preparing Backing up Chameleon files +# --------------------------------------------- +backupDir="${targetVolume}/Chameleon.Backups/"$( date -j "+%F-%Hh%M" ) +mkdir -p "$backupDir" + +if [[ -f "$logFile" ]];then + # Backup old log file + mv "$logFile" "${backupDir}/${logName}" +fi + + +# Setup @LOG_FILENAME@ file +# by writing header and diskutil list + +echo "Chameleon installer log - $( date ) +Installer version: %CHAMELEONVERSION% %CHAMELEONREVISION% +======================================================" >"${logFile}" + +diskutil list >>"${logFile}" +echo "======================================================" >>"${logFile}" + +# --------------------------------------------- +# Backing up Chameleon files +# --------------------------------------------- +# Backup stage2 +if [[ -f "${targetVolume}/boot" ]];then + echo "Backing up stage2 file ${targetVolume}/boot to ${backupDir}/boot" >>"${logFile}" + cp -p "${targetVolume}/boot" "${backupDir}/boot" +fi +# Backup /Extra directory +if [[ -d "${targetVolume}/Extra" ]];then + echo "Moving ${targetVolume}/Extra folder to ${backupDir}/Extra" >>"${logFile}" + cp -pR "${targetVolume}/Extra" "${backupDir}/Extra" +fi +chflags -R nohidden "$backupDir" # Remove the invisible flag of files in the backups +echo "======================================================" >>"${logFile}" + +echo "===============================================" +echo "END - Pre-Install Script" +echo "*********************************" +echo "-----------------------------------------------" +echo "" + +exit 0 Property changes on: branches/ErmaC/Trunk/package/Scripts.templates/Pre/preinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/ErmaC/Trunk/package/Scripts/Main/postinstall =================================================================== --- branches/ErmaC/Trunk/package/Scripts/Main/postinstall (revision 1777) +++ branches/ErmaC/Trunk/package/Scripts/Main/postinstall (revision 1778) @@ -1,295 +0,0 @@ -#!/bin/bash - -mergeString () { - local src="${1}" - local new="${2}" - local result="$src" - - for newItem in $new ;do - local found=0 - for srcItem in $src ;do - if [[ $newItem == $srcItem ]];then - found=1 - break - fi - done - [[ $found -eq 0 ]] && result="$result $newItem" - done - - echo "$result" -} - -echo "===============================================" -echo "Post Post-Install Script" -echo "*********************************" - -#echo "DEBUG: $ 1 = Full path to the installation package the installer app is processing: " $1 -#echo "DEBUG: $ 2 = Full path to the installation destination: " $2 -#echo "DEBUG: $ 3 = Installation volume (mountpoint) to receive the payload: " $3 -#echo "DEBUG: $ 4 = Root directory for the system: " $4 - -# Check target exists -if [ ! -e "$3" ] -then - echo "$3 volume does not exist!" - exit 1 -fi - -# If target volume root of current system then replace -# / with volume name. -if [ "$3" == "/" ] -then - dest_vol="/Volumes/"$( ls -1F /Volumes | sed -n 's:@$::p' ) -else - dest_vol="$3" -fi - -# Find script location so to find the Install Log script. -MYLOCATION="${PWD}/${BASH_ARGV[0]}" -export MYLOCATION="${MYLOCATION%/*}" -scriptDir=$MYLOCATION - -# Write some information to the Install Log -"$scriptDir"InstallLog.sh "${dest_vol}" "Running Post postinstall script" -"$scriptDir"InstallLog.sh "${dest_vol}" "Target volume = ${dest_vol}" - -# set temporary directory -chamTemp="$dest_vol/usr/local/chamTemp" - - -# --------------------------------------------- -# Build org.chameleon.Boot.plist -# --------------------------------------------- -# All options selected are now dummy files with -# the filename of the option and value residing -# in /usr/local/chamTemp/options/ -# for example. Boot Banner=Yes - -# Are there any options to build? -if [ "$(ls -A ${chamTemp}/options )" ]; then - - # Check for temporary directory/Extra folder. - if [ ! -d "$chamTemp"/Extra ]; then - mkdir "$chamTemp"/Extra - fi - - tempOCBP="$chamTemp"/Extra/org.chameleon.Boot.plist - - # Create template for org.chameleon.Boot.plist" - tempOCBP="$chamTemp"/Extra/org.chameleon.Boot.plist - cp "$4"/Library/Preferences/SystemConfiguration/com.apple.Boot.plist "$tempOCBP" - - # Read list of all boot options the user added. - while IFS= read -r -d '' FILE; do - option="${FILE##*/}" - key="${option%%=*}" - value="${option#*=}" - - # Check for 'Kernel Flags' key indicate that should be a kernel flag - if [[ "$key" = "Kernel Flags" ]];then - # plistbuddy only add's if the key doesn't already exist. - # So let's store any kernelflags and add them all at the - # same time once when we reach the end of the options list. - kernelflag[${#kernelflag[*]}]="$value" - "$scriptDir"InstallLog.sh "${dest_vol}" "Added kernel flag: $value" - else - # escape any spaces - keyToUse=$( echo "$key" | sed 's/ /\\ /g' ) - sudo /usr/libexec/plistbuddy -c "Add :${keyToUse} string ${value}" "$tempOCBP" - returnValue=$? - if [ ${returnValue} -ne 1 ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "Added boot option: ${key}=${value}" - else - "$scriptDir"InstallLog.sh "${dest_vol}" "Can't add ${key}=${value} as an option already exists for: ${key}" - fi - fi - done < <( find "${chamTemp}/options" -type f -print0 ) - - # Add any kernel flags together in to one string. - kernelFlagString="${kernelflag[@]}" - # We add the final string in the next section. -fi - -# --------------------------------------------- -# Add any installed modules to the Install Log -# --------------------------------------------- -if [ -e "${chamTemp}"/Extra/modules ]; then - ls "${chamTemp}"/Extra/modules | while read FILE - do - "$scriptDir"InstallLog.sh "${dest_vol}" "Added module: $FILE" - if [ "$FILE" == "Keylayout.dylib" ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "Also adding required Keymaps." - fi - done -fi - -# --------------------------------------------- -# Add any installed themes to the Install Log -# --------------------------------------------- -if [ -e "${chamTemp}"/Extra/Themes ]; then - ls "${chamTemp}"/Extra/Themes | while read FILE - do - "$scriptDir"InstallLog.sh "${dest_vol}" "Added Theme: $FILE" - done -fi - -# Does a temporary /Extra folder exist? -if [ -d "$chamTemp"/Extra ]; then - - # --------------------------------------------- - # Merge /Extra folders? - # --------------------------------------------- - # Does the user want to upgrade an existing /Extra folder? - # If so, then merge their existing one in to the temp one. - if [ -e "$chamTemp/install_type_upgrade" ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "User selected to do an upgrade install." - - # first move the new org.chameleon.Boot.plist out of tmp - # Extra folder so we can merge that separately. - mv "$tempOCBP" "$chamTemp/holding.plist" - - # Check for an existing /Extra folder - # and merge existing /Extra with temp one. - if [ -e "$dest_vol"/.ChameleonEFI ]; then - if [ -e "/Volumes/EFI/Extra" ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "Merging existing /Volumes/EFI/Extra folder." - ditto --noextattr --noqtn /Volumes/EFI/Extra "$chamTemp"/Extra - fi - else - if [ -e "$dest_vol/Extra" ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "Merging existing ${dest_vol}/Extra folder." - ditto --noextattr --noqtn "${dest_vol}"/Extra "$chamTemp"/Extra - fi - fi - - # Check existing plist name for old naming convention - # and change to new convention. - if [ -e "$chamTemp"/Extra/com.apple.Boot.plist ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "Renaming existing com.apple.Boot.plist to org.chameleon.Boot.plist." - mv "$chamTemp"/Extra/com.apple.Boot.plist "$tempOCBP" - fi - - # Before merging org.chameleon.Boot.plist, copy any - # existing kernel flags, then delete the entry. - currentFlags=$( sudo /usr/libexec/plistbuddy -c "Print :Kernel\ Flags" "$tempOCBP" ) - sudo /usr/libexec/plistbuddy -c "Delete :Kernel\ Flags" "$tempOCBP" - - # Merge new org.chameleon.Boot.plist (holding.plist) - # with their currently existing one. - "$scriptDir"InstallLog.sh "${dest_vol}" "------ -Merging new options into org.chameleon.Boot.plist. -NOTE: Please check the new merged org.chameleon.Boot.plist as -NOTE: any existing keys will NOT have been updated. -NOTE: For example: If you already had Wait=No as a boot option -NOTE: and chose Wait=Yes from the list, this will NOT be changed. -------" - sudo /usr/libexec/plistbuddy -c "Merge $chamTemp/holding.plist" "$tempOCBP" - - if [[ -n "$currentFlags" ]];then - # Combine new kernel flags with old ones. - kernelFlagString=$( mergeString "$currentFlags" "${kernelFlagString}" ) - fi - - elif [ -e "$chamTemp/install_type_new" ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "User selected to make a new install." - fi - - # Write kernel flags option - kernelFlagString=$(echo ${kernelFlagString}) # Remove leading and trailing spaces - if [[ -n "$kernelFlagString" ]];then - sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelFlagString" "$tempOCBP" - returnValue=$? - if [ ${returnValue} -ne 0 ]; then # key already exists. - sudo /usr/libexec/plistbuddy -c "Delete :Kernel\ Flags" "$tempOCBP" - sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelFlagString" "$tempOCBP" - fi - fi - - # --------------------------------------------- - # Copy temp Extra folder to target destination - # --------------------------------------------- - # Check for an existing /Extra folder. If found, back it up - # before copying the temporary Extra folder to destination. - # Extra folder now resides in /usr/local/chamTemp/ - # Copy /usr/local/chamTemp/Extra to correct location. - - if [ ! -f "$dest_vol"/.ChameleonEFI ]; then - # The Standard install option chosen - rm -rf "$dest_vol/Extra" # Remove old Extra directory - - "$scriptDir"InstallLog.sh "${dest_vol}" "Writing new Extra folder to: $dest_vol/" - echo "Copying $chamTemp/Extra TO $dest_vol" - cp -R "$chamTemp"/Extra "$dest_vol" - else - # The EFI system partition install option was chosen - rm -rf "/Volumes/EFI/Extra" # Remove old Extra directory - - "$scriptDir"InstallLog.sh "${dest_vol}" "Writing new Extra folder to: /Volumes/EFI/" - cp -R "$chamTemp"/Extra "/Volumes/EFI" - fi -else - if [ ! -f "$dest_vol"/.ChameleonEFI ]; then - if [ -e "$dest_vol"/Extra ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "No elements selected for adding to an Extra folder, -so leaving existing $dest_vol/Extra folder untouched." - fi - else - if [ -e "/Volumes/EFI/Extra" ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "No elements selected for adding to an Extra folder, -so leaving existing /Volumes/EFI/Extra folder untouched." - fi - fi -fi - -# --------------------------------------------- -# Update Rights -# --------------------------------------------- -chmod 777 ${dest_vol}/Extra 2>/dev/null -chmod 666 ${dest_vol}/Extra/*.plist 2>/dev/null - -# --------------------------------------------- -# Cleanup -# --------------------------------------------- - -# Unmount ALL mounted volumes named EFI -"$scriptDir"UnMountEFIvolumes.sh "${dest_vol}" "${scriptDir}" - -# remove any temporary boot sector files if they exist -if [ -d /tmp/newbs ]; then - cleanUp="${cleanUp},1a" - rm /tmp/newbs -fi -if [ -d /tmp/origbs ]; then - cleanUp="${cleanUp},1b" - rm /tmp/origbs -fi -if [ -d /tmp/newBootSector ]; then - cleanUp="${cleanUp},1c" - rm /tmp/newbs -fi -if [ -d /tmp/originalBootSector ]; then - cleanUp="${cleanUp},1d" - rm /tmp/origbs -fi - -# delete the temporary Chameleon folder -if [ -e "$chamTemp" ]; then - cleanUp="${cleanUp},2" - rm -rf "$chamTemp" -fi - -# Remove /.ChameleonEFI file -if [ -f "$dest_vol"/.ChameleonEFI ]; then - cleanUp="${cleanUp},3" - rm "$dest_vol"/.ChameleonEFI -fi - -"$scriptDir"InstallLog.sh "${dest_vol}" "Cleanup: ${cleanUp}" -"$scriptDir"InstallLog.sh "${dest_vol}" "LineBreak" -"$scriptDir"InstallLog.sh "${dest_vol}" "Post script complete" - -echo "===============================================" -echo "END - Post Post-Install Script" -echo "*********************************" -echo "-----------------------------------------------" -echo "" Index: branches/ErmaC/Trunk/package/Scripts/Main/preinstall =================================================================== --- branches/ErmaC/Trunk/package/Scripts/Main/preinstall (revision 1777) +++ branches/ErmaC/Trunk/package/Scripts/Main/preinstall (revision 1778) @@ -1,84 +0,0 @@ -#!/bin/bash - -echo "===============================================" -echo "Pre-Install Script" -echo "*********************************" -echo "-----------------------------------------------" -echo "" - -# Creates text file named 'Chameleon_Installer_Log.txt' -# at the root of the target volume. This is to help show the -# user why the installation process failed (even though the -# package installer ends reading 'Installation Successful'. - - - -# Find location of this script in the package installer -# so we know where all the other scripts are located. - -MYLOCATION="${PWD}/${BASH_ARGV[0]}" -export MYLOCATION="${MYLOCATION%/*}" -scriptDir=$MYLOCATION - - -# If target volume root of current system then replace -# / with volume name. -if [ "$3" == "/" ] -then - targetVolume="/Volumes/"$( ls -1F /Volumes | sed -n 's:@$::p' ) -else - targetVolume="$3" -fi - -logName="Chameleon_Installer_Log.txt" -logFile="${targetVolume}/$logName" - -versionNumber=`cat "${scriptDir}"/Resources/version` -revisionNumber=`cat "${scriptDir}"/Resources/revision` - - -# --------------------------------------------- -# Preparing Backing up Chameleon files -# --------------------------------------------- -backupDir="${targetVolume}/Chameleon.Backups/"$( date -j "+%F-%Hh%M" ) -mkdir -p "$backupDir" - -if [[ -f "$logFile" ]];then - # Backup old log file - mv "$logFile" "${backupDir}/${logName}" -fi - - -# Setup Chameleon_Installer_Log.txt file -# by writing header and diskutil list - -echo "Chameleon installer log - $( date ) -Installer version: ${versionNumber} ${revisionNumber} -======================================================" >"${logFile}" - -diskutil list >>"${logFile}" -echo "======================================================" >>"${logFile}" - -# --------------------------------------------- -# Backing up Chameleon files -# --------------------------------------------- -# Backup stage2 -if [[ -f "${targetVolume}/boot" ]];then - echo "Backing up stage2 file ${targetVolume}/boot to ${backupDir}/boot" >>"${logFile}" - cp -p "${targetVolume}/boot" "${backupDir}/boot" -fi -# Backup /Extra directory -if [[ -d "${targetVolume}/Extra" ]];then - echo "Moving ${targetVolume}/Extra folder to ${backupDir}/Extra" >>"${logFile}" - cp -pR "${targetVolume}/Extra" "${backupDir}/Extra" -fi -chflags -R nohidden "$backupDir" # Remove the invisible flag of files in the backups -echo "======================================================" >>"${logFile}" - -echo "===============================================" -echo "END - Pre-Install Script" -echo "*********************************" -echo "-----------------------------------------------" -echo "" - -exit 0 Index: branches/ErmaC/Trunk/package/Scripts/Sub/InstallLog.sh =================================================================== --- branches/ErmaC/Trunk/package/Scripts/Sub/InstallLog.sh (revision 1777) +++ branches/ErmaC/Trunk/package/Scripts/Sub/InstallLog.sh (revision 1778) @@ -1,53 +0,0 @@ -#!/bin/bash - -#echo "===============================================" -#echo "InstallLog: Create/Append installation log" -#echo "**********************************************" - -# Writes to the Chameleon_Installer_Log.txt file created -# by the preinstall script at the start of installation. - -# Receives two parameters -# $1 = selected volume for location of the install log -# $2 = text to write to the installer log - -if [ "$#" -eq 2 ]; then - logLocation="$1" - verboseText="$2" - #echo "DEBUG: passed argument = ${logLocation}" - #echo "DEBUG: passed argument = ${verboseText}" -else - echo "InstallLog: Error - wrong number of values passed" - exit 9 -fi - - - -logName="Chameleon_Installer_Log.txt" -logFile="${logLocation}"/$logName - - -if [ -f "${logFile}" ]; then - - # Append messages to the log as passed by other scripts. - if [ "${verboseText}" = "Diskutil" ]; then - diskutil list >>"${logFile}" - echo "======================================================" >>"${logFile}" - fi - - if [ "${verboseText}" = "LineBreak" ]; then - echo "======================================================" >>"${logFile}" - fi - - if [[ "${verboseText}" == *fdisk* ]]; then - targetDiskRaw="${verboseText#fdisk *}" - fdisk $targetDiskRaw >>"${logFile}" - echo " " >>"${logFile}" - fi - - if [ "${verboseText}" != "LineBreak" ] && [[ "${verboseText}" != *fdisk* ]] && [[ "${verboseText}" != "Diskutil" ]]; then - echo "${verboseText}" >> "${logFile}" - fi -fi - -exit 0 Index: branches/ErmaC/Trunk/package/Resources/ja.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/ja.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Trunk/package/Resources/ja.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ The scripts have completed and a file\ - named \cf2 Chameleon_Installer_Log.txt\cf3 has been\ + named \cf2 @LOG_FILENAME@\cf3 has been\ written to the root of your chosen partition.\ \ \cf0 Please \cf4 read it\cf0 to find out if the installation was\ Index: branches/ErmaC/Trunk/package/Resources/he.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/he.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Trunk/package/Resources/he.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ The scripts have completed and a file\ - named \cf2 Chameleon_Installer_Log.txt\cf3 has been\ + named \cf2 @LOG_FILENAME@\cf3 has been\ written to the root of your chosen partition.\ \ \cf0 Please \cf4 read it\cf0 to find out if the installation was\ Index: branches/ErmaC/Trunk/package/Resources/bs.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/bs.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Trunk/package/Resources/bs.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ Skripte su zavr\'9aile i datoteka pod\ - nazivom \cf2 Chameleon_Installer_Log.txt\cf3 je snimljena\ + nazivom \cf2 @LOG_FILENAME@\cf3 je snimljena\ na root particije diska koje ste odabrali.\ \ \cf0 Molimo \cf4 pro\uc0\u269 itajte ga\cf0 kako biste saznali da li je instalacija bila\ Index: branches/ErmaC/Trunk/package/Resources/fr.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/fr.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Trunk/package/Resources/fr.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ Les scripts sont termin\'e9s et un fichier\ - nomm\'e9 \cf2 Chameleon_Installer_Log.txt\cf3 a \cf0 \'e9\cf3 t\cf0 \'e9\cf3 \ + nomm\'e9 \cf2 @LOG_FILENAME@\cf3 a \cf0 \'e9\cf3 t\cf0 \'e9\cf3 \ \'e9\cf3 crit \'e0\'a0la racine de la partition choisie.\ \ \cf0 SVP \cf4 lisez le\cf0 pour savoir si l'installation est un\ Index: branches/ErmaC/Trunk/package/Resources/nl.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/nl.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Trunk/package/Resources/nl.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ De installatie is klaar en het bestand\ - \cf2 Chameleon_Installer_Log.txt\cf3 is geschreven\ + \cf2 @LOG_FILENAME@\cf3 is geschreven\ naar de root van de door u gekozen partitie.\ \ \cf0 Alstublieft \cf4 lees het\cf0 document om te zien of de installatie\ Index: branches/ErmaC/Trunk/package/Resources/hr.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/hr.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Trunk/package/Resources/hr.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ Skripte su zavr\'9aene i mapa pod\ - nazivom \cf2 Chameleon_Installer_Log.txt\cf3 je snimljena\ + nazivom \cf2 @LOG_FILENAME@\cf3 je snimljena\ u korijen particije diska koje ste odabrali.\ \ \cf0 Molimo \cf4 pro\uc0\u269 itajte\cf0 kako biste saznali da li je instalacija\ Index: branches/ErmaC/Trunk/package/Resources/pl.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/pl.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Trunk/package/Resources/pl.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -7,7 +7,7 @@ \f0\b\fs28 \cf0 \ \ -Zako\uc0\u324 czono wykonywanie skrypt\'f3w i plik logu \cf2 Chameleon_Installer_Log.txt\cf3 zosta\uc0\u322 zapisany \ +Zako\uc0\u324 czono wykonywanie skrypt\'f3w i plik logu \cf2 @LOG_FILENAME@\cf3 zosta\uc0\u322 zapisany \ na g\uc0\u322 \'f3wnym katalogu wybranej partycji.\ \ \cf0 Prosz\uc0\u281 \cf4 przeczytaj go\cf0 by dowiedzie\uc0\u263 si\u281 ,\ Index: branches/ErmaC/Trunk/package/Resources/pt-BR.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/pt-BR.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Trunk/package/Resources/pt-BR.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ Os scripts est\'e3o finalizados e foi gerado um\ - ficheiro \cf2 Chameleon_Installer_Log.txt\cf3 que se\ + ficheiro \cf2 @LOG_FILENAME@\cf3 que se\ encontra na raiz da parti\'e7\'e3o selecionada.\ \ \cf0 Por Favor \cf4 leia-o\cf0 para verificar se a instala\'e7\'e3o foi realizada\ Index: branches/ErmaC/Trunk/package/Resources/ru.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/ru.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Trunk/package/Resources/ru.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ The scripts have completed and a file\ - named \cf2 Chameleon_Installer_Log.txt\cf3 has been\ + named \cf2 @LOG_FILENAME@\cf3 has been\ written to the root of your chosen partition.\ \ \cf0 Please \cf4 read it\cf0 to find out if the installation was\ Index: branches/ErmaC/Trunk/package/Resources/zh_TW.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/zh_TW.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Trunk/package/Resources/zh_TW.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -13,7 +13,7 @@ \f1 \'81\'4b\'d4\'da\'df\'78\'93\'f1\'b0\'b2\'d1\'62\'b5\'c4\'b7\'d6\'b8\'ee\'85\'5e\'bd\'a8\'c1\'a2 \f0 \cf2 \ -\cf3 Chameleon_Installer_Log.txt +\cf3 @LOG_FILENAME@ \f1 \cf0 \'bc\'6f\'e4\'9b\'ce\'c4\'bc\'fe\'a1\'a3 \f0 \cf2 \ \ Index: branches/ErmaC/Trunk/package/Resources/id.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/id.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Trunk/package/Resources/id.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ Skrip ini telah selesai dan telah disematkan pada\ - berkas \cf2 Chameleon_Installer_Log.txt\cf3 yang ditaruh di\ + berkas \cf2 @LOG_FILENAME@\cf3 yang ditaruh di\ direktori utama dari partisi yang terinstall.\ \ \cf0 Silahkan \cf4 baca\cf0 berkas itu dan perhatikan apakah instalasi telah\ Index: branches/ErmaC/Trunk/package/Resources/el.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/el.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Trunk/package/Resources/el.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ The scripts have completed and a file\ - named \cf2 Chameleon_Installer_Log.txt\cf3 has been\ + named \cf2 @LOG_FILENAME@\cf3 has been\ written to the root of your chosen partition.\ \ \cf0 Please \cf4 read it\cf0 to find out if the installation was\ Index: branches/ErmaC/Trunk/package/Resources/zh_CN.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/zh_CN.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Trunk/package/Resources/zh_CN.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -13,7 +13,7 @@ \f1 \'b2\'a2\'d4\'da\'d1\'a1\'d4\'f1\'b0\'b2\'d7\'b0\'b5\'c4\'b7\'d6\'c7\'f8\'bd\'a8\'c1\'a2 \f0 \cf2 \ -\cf3 Chameleon_Installer_Log.txt +\cf3 @LOG_FILENAME@ \f1 \cf0 \'bc\'cd\'c2\'bc\'ce\'c4\'bc\'fe\'a1\'a3 \f0 \cf2 \ \ Index: branches/ErmaC/Trunk/package/Resources/en.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/en.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Trunk/package/Resources/en.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ The scripts have completed and a file\ - named \cf2 Chameleon_Installer_Log.txt\cf3 has been\ + named \cf2 @LOG_FILENAME@\cf3 has been\ written to the root of your chosen partition.\ \ \cf0 Please \cf4 read it\cf0 to find out if the installation was\ Index: branches/ErmaC/Trunk/package/Resources/ar.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/ar.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Trunk/package/Resources/ar.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -14,7 +14,7 @@ \f0 \ \f1 \'de\'cf -\f0 \cf2 Chameleon_Installer_Log.txt\cf3 +\f0 \cf2 @LOG_FILENAME@\cf3 \f1 \'ed\'d3\'e3\'ec \f0 \ Index: branches/ErmaC/Trunk/package/Resources/pt-PT.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/pt-PT.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Trunk/package/Resources/pt-PT.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ Os scripts est\'e3o finalizados e foi gerado um\ - ficheiro \cf2 Chameleon_Installer_Log.txt\cf3 que se\ + ficheiro \cf2 @LOG_FILENAME@\cf3 que se\ encontra na raiz da parti\'e7\'e3o selecionada.\ \ \cf0 Por Favor \cf4 leia-o\cf0 para verificar se a instala\'e7\'e3o foi realizada\ Index: branches/ErmaC/Trunk/package/Resources/es.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/es.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Trunk/package/Resources/es.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ Los scripts se han completado y un archivo\ - de nombre \cf2 Chameleon_Installer_Log.txt\cf3 ha sido\ + de nombre \cf2 @LOG_FILENAME@\cf3 ha sido\ escrito en la ra\'edz de la partici\'f3n seleccionada.\ \ \cf0 Por favor \cf4 l\'e9alo\cf0 para saber si la instalaci\'f3n fue\ Index: branches/ErmaC/Trunk/package/Resources/mk.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/mk.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Trunk/package/Resources/mk.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ \uc0\u1057 \u1082 \u1088 \u1080 \u1087 \u1090 \u1072 \u1090 \u1072 \u1077 \u1079 \u1072 \u1074 \u1088 \u1096 \u1077 \u1085 \u1072 \u1080 \u1076 \u1072 \u1090 \u1086 \u1090 \u1077 \u1082 \u1072 \ - \uc0\u1089 \u1086 \u1080 \u1084 \u1077 \cf2 Chameleon_Installer_Log.txt\cf3 \uc0\u1077 \ + \uc0\u1089 \u1086 \u1080 \u1084 \u1077 \cf2 @LOG_FILENAME@\cf3 \uc0\u1077 \ \uc0\u1079 \u1072 \u1087 \u1080 \u1096 \u1072 \u1085 \u1072 \u1074 \u1086 root \u1085 \u1072 \u1080 \u1079 \u1073 \u1088 \u1072 \u1085 \u1072 \u1090 \u1072 \u1087 \u1072 \u1088 \u1090 \u1080 \u1094 \u1080 \u1112 \u1072 .\ \ \cf0 \uc0\u1042 \u1077 \u1084 \u1086 \u1083 \u1080 \u1084 \u1077 \cf4 \uc0\u1087 \u1088 \u1086 \u1095 \u1080 \u1090 \u1072 \u1112 \u1090 \u1077 \u1112 \u1072 \cf0 \uc0\u1076 \u1072 \u1076 \u1086 \u1079 \u1085 \u1072 \u1077 \u1090 \u1077 \u1076 \u1072 \u1083 \u1080 \u1080 \u1085 \u1089 \u1090 \u1072 \u1083 \u1072 \u1094 \u1080 \u1112 \u1072 \u1090 \u1072 \ Index: branches/ErmaC/Trunk/package/Resources/ko.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/ko.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Trunk/package/Resources/ko.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -13,7 +13,7 @@ \'bc\'b1\'c5\'c3\'b5\'c8 \'c6\'c4\'c6\'bc\'bc\'c7\'c0\'c7 \'b7\'e7\'c6\'ae \'b5\'f0\'b7\'ba\'c5\'e4\'b8\'ae\'bf\'a1 \f2\b \ -\f0 \cf2 Chameleon_Installer_Log.txt +\f0 \cf2 @LOG_FILENAME@ \f1\b0 \cf3 \'b8\'a6 \'bb\'fd\'bc\'ba\'c7\'cf\'bf\'b4\'bd\'c0\'b4\'cf\'b4\'d9. \f0\b \ \ Index: branches/ErmaC/Trunk/package/Resources/it.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/it.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Trunk/package/Resources/it.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ Le operazioni sono state completate ed un file\ - chiamato \cf2 Chameleon_Installer_Log.txt\cf3 \'e9 stato\ + chiamato \cf2 @LOG_FILENAME@\cf3 \'e9 stato\ scritto nella root della partizione scelta.\ \ \cf0 Per favore \cf4 leggilo\cf0 per vedere se l'installazione \'e9\ Index: branches/ErmaC/Trunk/package/Resources/sr.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/sr.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Trunk/package/Resources/sr.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ Skripte su zavr\'9aene i mapa pod\ - nazivom \cf2 Chameleon_Installer_Log.txt\cf3 je snimljena\ + nazivom \cf2 @LOG_FILENAME@\cf3 je snimljena\ u koren particije diska koje ste odabrali.\ \ \cf0 Molimo \cf4 pro\uc0\u269 itajte\cf0 kako biste saznali da li je instalacija bila\ Index: branches/ErmaC/Trunk/package/Resources/bg.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/bg.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Trunk/package/Resources/bg.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ The scripts have completed and a file\ - named \cf2 Chameleon_Installer_Log.txt\cf3 has been\ + named \cf2 @LOG_FILENAME@\cf3 has been\ written to the root of your chosen partition.\ \ \cf0 Please \cf4 read it\cf0 to find out if the installation was\ Index: branches/ErmaC/Trunk/package/Resources/de.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Trunk/package/Resources/de.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Trunk/package/Resources/de.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ Die Scripts wurden ausgef\'fchrt und eine Datei\ - genannt \cf2 Chameleon_Installer_Log.txt\cf3 wurde ins\ + genannt \cf2 @LOG_FILENAME@\cf3 wurde ins\ Rootverzeichnis deiner ausgesuchten Partition geschrieben. \ \ \cf0 Bitte \cf4 lese\cf5 die Datei\cf0 \cf3 um herauszufinden ob \ Index: branches/ErmaC/Trunk/package/buildpkg.sh =================================================================== --- branches/ErmaC/Trunk/package/buildpkg.sh (revision 1777) +++ branches/ErmaC/Trunk/package/buildpkg.sh (revision 1778) @@ -9,6 +9,7 @@ declare -r SRCROOT="$1" declare -r SYMROOT="$2" declare -r PKG_BUILD_DIR="$3" +declare -r SCPT_TPL_DIR="${PKGROOT}/Scripts.templates" if [[ $# -lt 3 ]];then echo "Too few arguments. Aborting..." >&2 && exit 1 @@ -44,26 +45,28 @@ # ====== REVISION/VERSION ====== -declare -r version=$( cat version ) +declare -r CHAMELEON_VERSION=$( cat version ) # stage -stage=${version##*-} -stage=${stage/RC/Release Candidate } -stage=${stage/FINAL/2.1 Final} -declare -r stage +CHAMELEON_STAGE=${CHAMELEON_VERSION##*-} +CHAMELEON_STAGE=${CHAMELEON_STAGE/RC/Release Candidate } +CHAMELEON_STAGE=${CHAMELEON_STAGE/FINAL/2.1 Final} +declare -r CHAMELEON_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" ) +declare -r CHAMELEON_REVISION=$( grep I386BOOT_CHAMELEONREVISION vers.h | awk '{ print $3 }' | tr -d '\"' ) +declare -r CHAMELEON_BUILDDATE=$( grep I386BOOT_BUILDDATE vers.h | awk '{ print $3,$4 }' | tr -d '\"' ) +declare -r CHAMELEON_TIMESTAMP=$( date -j -f "%Y-%m-%d %H:%M:%S" "${CHAMELEON_BUILDDATE}" "+%s" ) # ====== 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 -r whobuild=$(whoami | awk '{print $1}' | cut -d ":" -f3) +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_WHOBUILD=$(whoami | awk '{print $1}' | cut -d ":" -f3) # ====== GLOBAL VARIABLES ====== +declare -r LOG_FILENAME="Chameleon_Installer_Log.txt" + declare -a pkgrefs declare -a choice_key declare -a choice_options @@ -94,6 +97,134 @@ echo "${result%"${result##*[![:space:]]}"}" # remove trailing whitespace characters } +argument () { + local opt="$1" + + if [[ $# -eq 0 ]];then + echo "$0: option requires an argument -- '$opt'" >&2; exit 1 + fi + echo "$opt" +} + +function makeSubstitutions () { + # Substition is like: Key=Value + # + # Optionnal arguments: + # --subst= : add a new substitution + # --subst : add a new substitution + # + # Last argument(s) is/are file(s) where substitutions must be made + + local ownSubst="" + + function addSubst () { + local mySubst="$1" + case "$mySubst" in + *=*) keySubst=${mySubst%%=*} + valSubst=${mySubst#*=} + ownSubst=$(printf "%s\n%s" "$ownSubst" "s&@$keySubst@&$valSubst&g;t t") + ;; + *) echo "Invalid substitution $mySubst" >&2 + exit 1 + ;; + esac + } + + # Check the arguments. + while [[ $# -gt 0 ]];do + local option="$1" + case "$option" in + --subst) shift; addSubst "$(argument $@)"; shift ;; + --subst=*) shift; addSubst "${option#*=}" ;; + -*) + echo "Unrecognized makeSubstitutions option '$option'" >&2 + exit 1 + ;; + *) break ;; + esac + done + + if [[ $# -lt 1 ]];then + echo "makeSubstitutions invalid number of arguments: at least one file needed" >&2 + exit 1 + fi + + local chameleonSubsts=" +s&%CHAMELEONVERSION%&${CHAMELEON_VERSION%%-*}&g +s&%CHAMELEONREVISION%&${CHAMELEON_REVISION}&g +s&%CHAMELEONSTAGE%&${CHAMELEON_STAGE}&g +s&%DEVELOP%&${CHAMELEON_DEVELOP}&g +s&%CREDITS%&${CHAMELEON_CREDITS}&g +s&%PKGDEV%&${CHAMELEON_PKGDEV}&g +s&%WHOBUILD%&${CHAMELEON_WHOBUILD}&g +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s&@LOG_FILENAME@&${LOG_FILENAME}&g;t t" + + local allSubst=" +$chameleonSubsts +$ownSubst" + + for file in "$@";do + cp -pf "$file" "${file}.in" + sed "$allSubst" "${file}.in" > "${file}" + rm -f "${file}.in" + done +} + +addTemplateScripts () { + # Arguments: + # --pkg-rootdir= : path of the pkg root dir + # + # Optionnal arguments: + # --subst= : add a new substitution + # --subst : add a new substitution + # + # Substition is like: Key=Value + # + # $n : Name of template(s) (templates are in package/Scripts.templates + + local pkgRootDir="" + declare -a allSubst + + # Check the arguments. + while [[ $# -gt 0 ]];do + local option="$1" + case "$option" in + --pkg-rootdir=*) shift; pkgRootDir="${option#*=}" ;; + --subst) shift; allSubst[${#allSubst[*]}]="$option"; allSubst[${#allSubst[*]}]="$1" ; shift ;; + --subst=*) shift; allSubst[${#allSubst[*]}]="${option}" ;; + -*) + echo "Unrecognized addTemplateScripts option '$option'" >&2 + exit 1 + ;; + *) break ;; + esac + done + if [[ $# -lt 1 ]];then + echo "addTemplateScripts invalid number of arguments: you must specify a template name" >&2 + exit 1 + fi + [[ -z "$pkgRootDir" ]] && { echo "Error addTemplateScripts: --pkg-rootdir option is needed" >&2 ; exit 1; } + [[ ! -d "$pkgRootDir" ]] && { echo "Error addTemplateScripts: directory '$pkgRootDir' doesn't exists" >&2 ; exit 1; } + + for templateName in "$@";do + local templateRootDir="${SCPT_TPL_DIR}/${templateName}" + [[ ! -d "$templateRootDir" ]] && { + echo "Error addTemplateScripts: template '$templateName' doesn't exists" >&2; exit 1; } + + # Copy files to destination + rsync -pr --exclude=.svn --exclude="*~" "$templateRootDir/" "$pkgRootDir/Scripts/" + done + + files=$( find "$pkgRootDir/Scripts/" -type f ) + if [[ ${#allSubst[*]} -gt 0 ]];then + makeSubstitutions "${allSubst[@]}" $files + else + makeSubstitutions $files + fi +} + getPackageRefId () { echo ${1//_/.}.${2//_/.} | tr [:upper:] [:lower:] } @@ -267,14 +398,10 @@ packagesidentity="${chameleon_package_identity}" choiceId="Pre" mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root - mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Scripts - ditto --noextattr --noqtn ${SRCROOT}/revision ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources/revision - ditto --noextattr --noqtn ${SRCROOT}/version ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources/version - cp -f ${PKGROOT}/Scripts/Main/preinstall ${PKG_BUILD_DIR}/${choiceId}/Scripts - cp -f ${PKGROOT}/Scripts/Sub/InstallLog.sh ${PKG_BUILD_DIR}/${choiceId}/Scripts + addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" ${choiceId} packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") - buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/" + buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/" >/dev/null 2>&1 addChoice --start-visible="false" --start-selected="true" --pkg-refs="$packageRefId" "${choiceId}" # End build pre install package @@ -297,7 +424,7 @@ ditto --noextattr --noqtn ${SYMROOT}/i386/bdmesg ${PKG_BUILD_DIR}/${choiceId}/Root/usr/local/bin packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") - buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/" + buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/" >/dev/null 2>&1 addChoice --start-visible="false" --start-selected="true" --pkg-refs="$packageRefId" "${choiceId}" # End build core package @@ -312,7 +439,7 @@ echo "" > "${PKG_BUILD_DIR}/${choiceId}/Root/install_type_new" packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") - buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/$chamTemp" + buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/$chamTemp" >/dev/null 2>&1 addChoice --group="InstallType" --start-selected="!choices['Upgrade'].selected" --pkg-refs="$packageRefId" "${choiceId}" # End build new install package @@ -322,7 +449,7 @@ echo "" > "${PKG_BUILD_DIR}/${choiceId}/Root/install_type_upgrade" packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") - buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/$chamTemp" + buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/$chamTemp" >/dev/null 2>&1 addChoice --group="InstallType" --start-selected="chameleon_boot_plist_exists()" --pkg-refs="$packageRefId" "${choiceId}" # End build upgrade package @@ -336,12 +463,13 @@ choiceId="Standard" mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources + addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" InstallerLog cp -f ${PKGROOT}/Scripts/Main/${choiceId}postinstall ${PKG_BUILD_DIR}/${choiceId}/Scripts/postinstall cp -f ${PKGROOT}/Scripts/Sub/* ${PKG_BUILD_DIR}/${choiceId}/Scripts ditto --arch i386 `which SetFile` ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources/SetFile packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") - buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/" + buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/" >/dev/null 2>&1 addChoice --group="Chameleon" --start-selected="true" --pkg-refs="$packageRefId" "${choiceId}" # End build standard package @@ -349,12 +477,13 @@ choiceId="EFI" mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources + addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" InstallerLog cp -f ${PKGROOT}/Scripts/Main/ESPpostinstall ${PKG_BUILD_DIR}/${choiceId}/Scripts/postinstall cp -f ${PKGROOT}/Scripts/Sub/* ${PKG_BUILD_DIR}/${choiceId}/Scripts ditto --arch i386 `which SetFile` ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources/SetFile packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") - buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/" + buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/" >/dev/null 2>&1 addChoice --group="Chameleon" --start-visible="systemHasGPT()" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}" # End build efi package @@ -363,7 +492,7 @@ mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") - buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/" + buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/" >/dev/null 2>&1 addChoice --group="Chameleon" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}" # End build no bootloader choice package @@ -532,7 +661,7 @@ echo "" > "${PKG_BUILD_DIR}/$optionName/Root/${keyValue}" packageRefId=$(getPackageRefId "${packagesidentity}" "${optionName}") - buildpackage "$packageRefId" "${optionName}" "${PKG_BUILD_DIR}/${optionName}" "/$chamTemp/options" + buildpackage "$packageRefId" "${optionName}" "${PKG_BUILD_DIR}/${optionName}" "/$chamTemp/options" >/dev/null 2>&1 addChoice --group="${builtOptionsList}" \ --start-selected="check_chameleon_option('$key','$value')" \ --pkg-refs="$packageRefId" "${optionName}" @@ -569,7 +698,7 @@ echo "" > "${PKG_BUILD_DIR}/${choiceId}/Root/${chameleon_keylayout_key}=${availableOptions[i]}" packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") - buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/$chamTemp/options" + buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/$chamTemp/options" >/dev/null 2>&1 # Add the Keylayout package because the Keylayout module is needed addChoice --group="KeyLayout" \ --start-selected="check_chameleon_option('${chameleon_keylayout_key}','${choiceId}')" \ @@ -590,10 +719,10 @@ for (( i = 0 ; i < ${#themes[@]} ; i++ )); do theme=$( echo ${themes[$i]##*/} | awk 'BEGIN{OFS=FS=""}{$1=toupper($1);print}' ) mkdir -p "${PKG_BUILD_DIR}/${theme}/Root/" - rsync -r --exclude=.svn "${themes[$i]}/" "${PKG_BUILD_DIR}/${theme}/Root/${theme}" + rsync -r --exclude=.svn --exclude="*~" "${themes[$i]}/" "${PKG_BUILD_DIR}/${theme}/Root/${theme}" packageRefId=$(getPackageRefId "${packagesidentity}" "${theme}") - buildpackage "$packageRefId" "${theme}" "${PKG_BUILD_DIR}/${theme}" "/$chamTemp/Extra/Themes" + buildpackage "$packageRefId" "${theme}" "${PKG_BUILD_DIR}/${theme}" "/$chamTemp/Extra/Themes" >/dev/null 2>&1 addChoice --group="Themes" --start-selected="false" --pkg-refs="$packageRefId" "${theme}" done # End build theme packages# End build Extras package @@ -603,15 +732,11 @@ packagesidentity="${chameleon_package_identity}" choiceId="Post" mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root - mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Scripts - cp -f ${PKGROOT}/Scripts/Main/postinstall ${PKG_BUILD_DIR}/${choiceId}/Scripts - cp -f ${PKGROOT}/Scripts/Sub/InstallLog.sh ${PKG_BUILD_DIR}/${choiceId}/Scripts + addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" ${choiceId} InstallerLog cp -f ${PKGROOT}/Scripts/Sub/UnMountEFIvolumes.sh ${PKG_BUILD_DIR}/${choiceId}/Scripts - ditto --noextattr --noqtn ${SRCROOT}/revision ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources/revision - ditto --noextattr --noqtn ${SRCROOT}/version ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources/version packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") - buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/" + buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/" >/dev/null 2>&1 addChoice --start-visible="false" --start-selected="true" --pkg-refs="$packageRefId" "${choiceId}" # End build post install package @@ -647,7 +772,7 @@ #[ "${3}" == "relocatable" ] && header+="relocatable=\"true\" " header+="identifier=\"${packageRefId}\" " - header+="version=\"${version}\" " + header+="version=\"${CHAMELEON_VERSION}\" " [ "${targetPath}" != "relocatable" ] && header+="install-location=\"${targetPath}\" " @@ -680,7 +805,7 @@ (cd "${packagePath}/Temp" && xar -c -f "${packagePath}/../${packageName}.pkg" --compression none .) # Add the package to the list of build packages - pkgrefs[${#pkgrefs[*]}]="\t#${packageName}.pkg" + pkgrefs[${#pkgrefs[*]}]="\t#${packageName}.pkg" rm -rf "${packagePath}" fi @@ -753,7 +878,7 @@ makedistribution () { declare -r distributionDestDir="${SYMROOT}" - declare -r distributionFilename="${packagename// /}-${version}-r${revision}.pkg" + declare -r distributionFilename="${packagename// /}-${CHAMELEON_VERSION}-r${CHAMELEON_REVISION}.pkg" declare -r distributionFilePath="${distributionDestDir}/${distributionFilename}" rm -f "${distributionDestDir}/${packagename// /}"*.pkg @@ -793,21 +918,9 @@ # CleanUp the directory find "${PKG_BUILD_DIR}/${packagename}" \( -type d -name '.svn' \) -o -name '.DS_Store' -exec rm -rf {} \; -# Add Chameleon Version and Revision - perl -i -p -e "s/%CHAMELEONVERSION%/${version%%-*}/g" $( find "${PKG_BUILD_DIR}/${packagename}/Resources" -type f ) - perl -i -p -e "s/%CHAMELEONREVISION%/${revision}/g" $( find "${PKG_BUILD_DIR}/${packagename}/Resources" -type f ) + # Make substitutions like version, revision, stage, developers, credits, etc.. + makeSubstitutions $( find "${PKG_BUILD_DIR}/${packagename}/Resources" -type f ) -# Add Chameleon Stage - perl -i -p -e "s/%CHAMELEONSTAGE%/${stage}/g" $( find "${PKG_BUILD_DIR}/${packagename}/Resources" -type f ) - -# Adding Developer and credits - perl -i -p -e "s/%DEVELOP%/${develop}/g" $( find "${PKG_BUILD_DIR}/${packagename}/Resources" -type f ) - perl -i -p -e "s/%CREDITS%/${credits}/g" $( find "${PKG_BUILD_DIR}/${packagename}/Resources" -type f ) - perl -i -p -e "s/%PKGDEV%/${pkgdev}/g" $( find "${PKG_BUILD_DIR}/${packagename}/Resources" -type f ) - -# Adding whoami - perl -i -p -e "s/%WHOBUILD%/${whobuild}/g" $( find "${PKG_BUILD_DIR}/${packagename}/Resources" -type f ) - # Create the final package pkgutil --flatten "${PKG_BUILD_DIR}/${packagename}" "${distributionFilePath}" @@ -836,10 +949,10 @@ echo -e $COL_GREEN" ===========" echo -e $COL_BLUE" Package name: "$COL_RESET"${distributionFilename}" echo -e $COL_BLUE" MD5: "$COL_RESET"$md5" - echo -e $COL_BLUE" Version: "$COL_RESET"$version" - echo -e $COL_BLUE" Stage: "$COL_RESET"$stage" - echo -e $COL_BLUE" Date/Time: "$COL_RESET"$builddate" - echo -e $COL_BLUE" Builded by: "$COL_RESET"$whobuild" + 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 "" } Index: branches/ErmaC/Modules/package/Scripts.templates/InstallerLog/InstallLog.sh =================================================================== --- branches/ErmaC/Modules/package/Scripts.templates/InstallerLog/InstallLog.sh (revision 0) +++ branches/ErmaC/Modules/package/Scripts.templates/InstallerLog/InstallLog.sh (revision 1778) @@ -0,0 +1,50 @@ +#!/bin/bash + +#echo "===============================================" +#echo "InstallLog: Create/Append installation log" +#echo "**********************************************" + +# Writes to the @LOG_FILENAME@ file created +# by the preinstall script at the start of installation. + +# Receives two parameters +# $1 = selected volume for location of the install log +# $2 = text to write to the installer log + +if [ "$#" -eq 2 ]; then + logLocation="$1" + verboseText="$2" + #echo "DEBUG: passed argument = ${logLocation}" + #echo "DEBUG: passed argument = ${verboseText}" +else + echo "InstallLog: Error - wrong number of values passed" + exit 9 +fi + +logName="@LOG_FILENAME@" +logFile="${logLocation}"/$logName + +if [ -f "${logFile}" ]; then + + # Append messages to the log as passed by other scripts. + if [ "${verboseText}" = "Diskutil" ]; then + diskutil list >>"${logFile}" + echo "======================================================" >>"${logFile}" + fi + + if [ "${verboseText}" = "LineBreak" ]; then + echo "======================================================" >>"${logFile}" + fi + + if [[ "${verboseText}" == *fdisk* ]]; then + targetDiskRaw="${verboseText#fdisk *}" + fdisk $targetDiskRaw >>"${logFile}" + echo " " >>"${logFile}" + fi + + if [ "${verboseText}" != "LineBreak" ] && [[ "${verboseText}" != *fdisk* ]] && [[ "${verboseText}" != "Diskutil" ]]; then + echo "${verboseText}" >> "${logFile}" + fi +fi + +exit 0 Property changes on: branches/ErmaC/Modules/package/Scripts.templates/InstallerLog/InstallLog.sh ___________________________________________________________________ Added: svn:executable + * Index: branches/ErmaC/Modules/package/Scripts.templates/Post/postinstall =================================================================== --- branches/ErmaC/Modules/package/Scripts.templates/Post/postinstall (revision 0) +++ branches/ErmaC/Modules/package/Scripts.templates/Post/postinstall (revision 1778) @@ -0,0 +1,295 @@ +#!/bin/bash + +mergeString () { + local src="${1}" + local new="${2}" + local result="$src" + + for newItem in $new ;do + local found=0 + for srcItem in $src ;do + if [[ $newItem == $srcItem ]];then + found=1 + break + fi + done + [[ $found -eq 0 ]] && result="$result $newItem" + done + + echo "$result" +} + +echo "===============================================" +echo "Post Post-Install Script" +echo "*********************************" + +#echo "DEBUG: $ 1 = Full path to the installation package the installer app is processing: " $1 +#echo "DEBUG: $ 2 = Full path to the installation destination: " $2 +#echo "DEBUG: $ 3 = Installation volume (mountpoint) to receive the payload: " $3 +#echo "DEBUG: $ 4 = Root directory for the system: " $4 + +# Check target exists +if [ ! -e "$3" ] +then + echo "$3 volume does not exist!" + exit 1 +fi + +# If target volume root of current system then replace +# / with volume name. +if [ "$3" == "/" ] +then + dest_vol="/Volumes/"$( ls -1F /Volumes | sed -n 's:@$::p' ) +else + dest_vol="$3" +fi + +# Find script location so to find the Install Log script. +MYLOCATION="${PWD}/${BASH_ARGV[0]}" +export MYLOCATION="${MYLOCATION%/*}" +scriptDir=$MYLOCATION + +# Write some information to the Install Log +"$scriptDir"InstallLog.sh "${dest_vol}" "Running Post postinstall script" +"$scriptDir"InstallLog.sh "${dest_vol}" "Target volume = ${dest_vol}" + +# set temporary directory +chamTemp="$dest_vol/usr/local/chamTemp" + + +# --------------------------------------------- +# Build org.chameleon.Boot.plist +# --------------------------------------------- +# All options selected are now dummy files with +# the filename of the option and value residing +# in /usr/local/chamTemp/options/ +# for example. Boot Banner=Yes + +# Are there any options to build? +if [ "$(ls -A ${chamTemp}/options )" ]; then + + # Check for temporary directory/Extra folder. + if [ ! -d "$chamTemp"/Extra ]; then + mkdir "$chamTemp"/Extra + fi + + tempOCBP="$chamTemp"/Extra/org.chameleon.Boot.plist + + # Create template for org.chameleon.Boot.plist" + tempOCBP="$chamTemp"/Extra/org.chameleon.Boot.plist + cp "$4"/Library/Preferences/SystemConfiguration/com.apple.Boot.plist "$tempOCBP" + + # Read list of all boot options the user added. + while IFS= read -r -d '' FILE; do + option="${FILE##*/}" + key="${option%%=*}" + value="${option#*=}" + + # Check for 'Kernel Flags' key indicate that should be a kernel flag + if [[ "$key" = "Kernel Flags" ]];then + # plistbuddy only add's if the key doesn't already exist. + # So let's store any kernelflags and add them all at the + # same time once when we reach the end of the options list. + kernelflag[${#kernelflag[*]}]="$value" + "$scriptDir"InstallLog.sh "${dest_vol}" "Added kernel flag: $value" + else + # escape any spaces + keyToUse=$( echo "$key" | sed 's/ /\\ /g' ) + sudo /usr/libexec/plistbuddy -c "Add :${keyToUse} string ${value}" "$tempOCBP" + returnValue=$? + if [ ${returnValue} -ne 1 ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Added boot option: ${key}=${value}" + else + "$scriptDir"InstallLog.sh "${dest_vol}" "Can't add ${key}=${value} as an option already exists for: ${key}" + fi + fi + done < <( find "${chamTemp}/options" -type f -print0 ) + + # Add any kernel flags together in to one string. + kernelFlagString="${kernelflag[@]}" + # We add the final string in the next section. +fi + +# --------------------------------------------- +# Add any installed modules to the Install Log +# --------------------------------------------- +if [ -e "${chamTemp}"/Extra/modules ]; then + ls "${chamTemp}"/Extra/modules | while read FILE + do + "$scriptDir"InstallLog.sh "${dest_vol}" "Added module: $FILE" + if [ "$FILE" == "Keylayout.dylib" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Also adding required Keymaps." + fi + done +fi + +# --------------------------------------------- +# Add any installed themes to the Install Log +# --------------------------------------------- +if [ -e "${chamTemp}"/Extra/Themes ]; then + ls "${chamTemp}"/Extra/Themes | while read FILE + do + "$scriptDir"InstallLog.sh "${dest_vol}" "Added Theme: $FILE" + done +fi + +# Does a temporary /Extra folder exist? +if [ -d "$chamTemp"/Extra ]; then + + # --------------------------------------------- + # Merge /Extra folders? + # --------------------------------------------- + # Does the user want to upgrade an existing /Extra folder? + # If so, then merge their existing one in to the temp one. + if [ -e "$chamTemp/install_type_upgrade" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "User selected to do an upgrade install." + + # first move the new org.chameleon.Boot.plist out of tmp + # Extra folder so we can merge that separately. + mv "$tempOCBP" "$chamTemp/holding.plist" + + # Check for an existing /Extra folder + # and merge existing /Extra with temp one. + if [ -e "$dest_vol"/.ChameleonEFI ]; then + if [ -e "/Volumes/EFI/Extra" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Merging existing /Volumes/EFI/Extra folder." + ditto --noextattr --noqtn /Volumes/EFI/Extra "$chamTemp"/Extra + fi + else + if [ -e "$dest_vol/Extra" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Merging existing ${dest_vol}/Extra folder." + ditto --noextattr --noqtn "${dest_vol}"/Extra "$chamTemp"/Extra + fi + fi + + # Check existing plist name for old naming convention + # and change to new convention. + if [ -e "$chamTemp"/Extra/com.apple.Boot.plist ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "Renaming existing com.apple.Boot.plist to org.chameleon.Boot.plist." + mv "$chamTemp"/Extra/com.apple.Boot.plist "$tempOCBP" + fi + + # Before merging org.chameleon.Boot.plist, copy any + # existing kernel flags, then delete the entry. + currentFlags=$( sudo /usr/libexec/plistbuddy -c "Print :Kernel\ Flags" "$tempOCBP" ) + sudo /usr/libexec/plistbuddy -c "Delete :Kernel\ Flags" "$tempOCBP" + + # Merge new org.chameleon.Boot.plist (holding.plist) + # with their currently existing one. + "$scriptDir"InstallLog.sh "${dest_vol}" "------ +Merging new options into org.chameleon.Boot.plist. +NOTE: Please check the new merged org.chameleon.Boot.plist as +NOTE: any existing keys will NOT have been updated. +NOTE: For example: If you already had Wait=No as a boot option +NOTE: and chose Wait=Yes from the list, this will NOT be changed. +------" + sudo /usr/libexec/plistbuddy -c "Merge $chamTemp/holding.plist" "$tempOCBP" + + if [[ -n "$currentFlags" ]];then + # Combine new kernel flags with old ones. + kernelFlagString=$( mergeString "$currentFlags" "${kernelFlagString}" ) + fi + + elif [ -e "$chamTemp/install_type_new" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "User selected to make a new install." + fi + + # Write kernel flags option + kernelFlagString=$(echo ${kernelFlagString}) # Remove leading and trailing spaces + if [[ -n "$kernelFlagString" ]];then + sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelFlagString" "$tempOCBP" + returnValue=$? + if [ ${returnValue} -ne 0 ]; then # key already exists. + sudo /usr/libexec/plistbuddy -c "Delete :Kernel\ Flags" "$tempOCBP" + sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelFlagString" "$tempOCBP" + fi + fi + + # --------------------------------------------- + # Copy temp Extra folder to target destination + # --------------------------------------------- + # Check for an existing /Extra folder. If found, back it up + # before copying the temporary Extra folder to destination. + # Extra folder now resides in /usr/local/chamTemp/ + # Copy /usr/local/chamTemp/Extra to correct location. + + if [ ! -f "$dest_vol"/.ChameleonEFI ]; then + # The Standard install option chosen + rm -rf "$dest_vol/Extra" # Remove old Extra directory + + "$scriptDir"InstallLog.sh "${dest_vol}" "Writing new Extra folder to: $dest_vol/" + echo "Copying $chamTemp/Extra TO $dest_vol" + cp -R "$chamTemp"/Extra "$dest_vol" + else + # The EFI system partition install option was chosen + rm -rf "/Volumes/EFI/Extra" # Remove old Extra directory + + "$scriptDir"InstallLog.sh "${dest_vol}" "Writing new Extra folder to: /Volumes/EFI/" + cp -R "$chamTemp"/Extra "/Volumes/EFI" + fi +else + if [ ! -f "$dest_vol"/.ChameleonEFI ]; then + if [ -e "$dest_vol"/Extra ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "No elements selected for adding to an Extra folder, +so leaving existing $dest_vol/Extra folder untouched." + fi + else + if [ -e "/Volumes/EFI/Extra" ]; then + "$scriptDir"InstallLog.sh "${dest_vol}" "No elements selected for adding to an Extra folder, +so leaving existing /Volumes/EFI/Extra folder untouched." + fi + fi +fi + +# --------------------------------------------- +# Update Rights +# --------------------------------------------- +chmod 777 ${dest_vol}/Extra 2>/dev/null +chmod 666 ${dest_vol}/Extra/*.plist 2>/dev/null + +# --------------------------------------------- +# Cleanup +# --------------------------------------------- + +# Unmount ALL mounted volumes named EFI +"$scriptDir"UnMountEFIvolumes.sh "${dest_vol}" "${scriptDir}" + +# remove any temporary boot sector files if they exist +if [ -d /tmp/newbs ]; then + cleanUp="${cleanUp},1a" + rm /tmp/newbs +fi +if [ -d /tmp/origbs ]; then + cleanUp="${cleanUp},1b" + rm /tmp/origbs +fi +if [ -d /tmp/newBootSector ]; then + cleanUp="${cleanUp},1c" + rm /tmp/newbs +fi +if [ -d /tmp/originalBootSector ]; then + cleanUp="${cleanUp},1d" + rm /tmp/origbs +fi + +# delete the temporary Chameleon folder +if [ -e "$chamTemp" ]; then + cleanUp="${cleanUp},2" + rm -rf "$chamTemp" +fi + +# Remove /.ChameleonEFI file +if [ -f "$dest_vol"/.ChameleonEFI ]; then + cleanUp="${cleanUp},3" + rm "$dest_vol"/.ChameleonEFI +fi + +"$scriptDir"InstallLog.sh "${dest_vol}" "Cleanup: ${cleanUp}" +"$scriptDir"InstallLog.sh "${dest_vol}" "LineBreak" +"$scriptDir"InstallLog.sh "${dest_vol}" "Post script complete" + +echo "===============================================" +echo "END - Post Post-Install Script" +echo "*********************************" +echo "-----------------------------------------------" +echo "" Property changes on: branches/ErmaC/Modules/package/Scripts.templates/Post/postinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/ErmaC/Modules/package/Scripts.templates/Pre/preinstall =================================================================== --- branches/ErmaC/Modules/package/Scripts.templates/Pre/preinstall (revision 0) +++ branches/ErmaC/Modules/package/Scripts.templates/Pre/preinstall (revision 1778) @@ -0,0 +1,80 @@ +#!/bin/bash + +echo "===============================================" +echo "Pre-Install Script" +echo "*********************************" +echo "-----------------------------------------------" +echo "" + +# Creates text file named '@LOG_FILENAME@' +# at the root of the target volume. This is to help show the +# user why the installation process failed (even though the +# package installer ends reading 'Installation Successful'. + + + +# Find location of this script in the package installer +# so we know where all the other scripts are located. + +MYLOCATION="${PWD}/${BASH_ARGV[0]}" +export MYLOCATION="${MYLOCATION%/*}" +scriptDir=$MYLOCATION + + +# If target volume root of current system then replace +# / with volume name. +if [ "$3" == "/" ] +then + targetVolume="/Volumes/"$( ls -1F /Volumes | sed -n 's:@$::p' ) +else + targetVolume="$3" +fi + +logName="@LOG_FILENAME@" +logFile="${targetVolume}/$logName" + +# --------------------------------------------- +# Preparing Backing up Chameleon files +# --------------------------------------------- +backupDir="${targetVolume}/Chameleon.Backups/"$( date -j "+%F-%Hh%M" ) +mkdir -p "$backupDir" + +if [[ -f "$logFile" ]];then + # Backup old log file + mv "$logFile" "${backupDir}/${logName}" +fi + + +# Setup @LOG_FILENAME@ file +# by writing header and diskutil list + +echo "Chameleon installer log - $( date ) +Installer version: %CHAMELEONVERSION% %CHAMELEONREVISION% +======================================================" >"${logFile}" + +diskutil list >>"${logFile}" +echo "======================================================" >>"${logFile}" + +# --------------------------------------------- +# Backing up Chameleon files +# --------------------------------------------- +# Backup stage2 +if [[ -f "${targetVolume}/boot" ]];then + echo "Backing up stage2 file ${targetVolume}/boot to ${backupDir}/boot" >>"${logFile}" + cp -p "${targetVolume}/boot" "${backupDir}/boot" +fi +# Backup /Extra directory +if [[ -d "${targetVolume}/Extra" ]];then + echo "Moving ${targetVolume}/Extra folder to ${backupDir}/Extra" >>"${logFile}" + cp -pR "${targetVolume}/Extra" "${backupDir}/Extra" +fi +chflags -R nohidden "$backupDir" # Remove the invisible flag of files in the backups +echo "======================================================" >>"${logFile}" + +echo "===============================================" +echo "END - Pre-Install Script" +echo "*********************************" +echo "-----------------------------------------------" +echo "" + +exit 0 Property changes on: branches/ErmaC/Modules/package/Scripts.templates/Pre/preinstall ___________________________________________________________________ Added: svn:executable + * Index: branches/ErmaC/Modules/package/Scripts/Main/postinstall =================================================================== --- branches/ErmaC/Modules/package/Scripts/Main/postinstall (revision 1777) +++ branches/ErmaC/Modules/package/Scripts/Main/postinstall (revision 1778) @@ -1,295 +0,0 @@ -#!/bin/bash - -mergeString () { - local src="${1}" - local new="${2}" - local result="$src" - - for newItem in $new ;do - local found=0 - for srcItem in $src ;do - if [[ $newItem == $srcItem ]];then - found=1 - break - fi - done - [[ $found -eq 0 ]] && result="$result $newItem" - done - - echo "$result" -} - -echo "===============================================" -echo "Post Post-Install Script" -echo "*********************************" - -#echo "DEBUG: $ 1 = Full path to the installation package the installer app is processing: " $1 -#echo "DEBUG: $ 2 = Full path to the installation destination: " $2 -#echo "DEBUG: $ 3 = Installation volume (mountpoint) to receive the payload: " $3 -#echo "DEBUG: $ 4 = Root directory for the system: " $4 - -# Check target exists -if [ ! -e "$3" ] -then - echo "$3 volume does not exist!" - exit 1 -fi - -# If target volume root of current system then replace -# / with volume name. -if [ "$3" == "/" ] -then - dest_vol="/Volumes/"$( ls -1F /Volumes | sed -n 's:@$::p' ) -else - dest_vol="$3" -fi - -# Find script location so to find the Install Log script. -MYLOCATION="${PWD}/${BASH_ARGV[0]}" -export MYLOCATION="${MYLOCATION%/*}" -scriptDir=$MYLOCATION - -# Write some information to the Install Log -"$scriptDir"InstallLog.sh "${dest_vol}" "Running Post postinstall script" -"$scriptDir"InstallLog.sh "${dest_vol}" "Target volume = ${dest_vol}" - -# set temporary directory -chamTemp="$dest_vol/usr/local/chamTemp" - - -# --------------------------------------------- -# Build org.chameleon.Boot.plist -# --------------------------------------------- -# All options selected are now dummy files with -# the filename of the option and value residing -# in /usr/local/chamTemp/options/ -# for example. Boot Banner=Yes - -# Are there any options to build? -if [ "$(ls -A ${chamTemp}/options )" ]; then - - # Check for temporary directory/Extra folder. - if [ ! -d "$chamTemp"/Extra ]; then - mkdir "$chamTemp"/Extra - fi - - tempOCBP="$chamTemp"/Extra/org.chameleon.Boot.plist - - # Create template for org.chameleon.Boot.plist" - tempOCBP="$chamTemp"/Extra/org.chameleon.Boot.plist - cp "$4"/Library/Preferences/SystemConfiguration/com.apple.Boot.plist "$tempOCBP" - - # Read list of all boot options the user added. - while IFS= read -r -d '' FILE; do - option="${FILE##*/}" - key="${option%%=*}" - value="${option#*=}" - - # Check for 'Kernel Flags' key indicate that should be a kernel flag - if [[ "$key" = "Kernel Flags" ]];then - # plistbuddy only add's if the key doesn't already exist. - # So let's store any kernelflags and add them all at the - # same time once when we reach the end of the options list. - kernelflag[${#kernelflag[*]}]="$value" - "$scriptDir"InstallLog.sh "${dest_vol}" "Added kernel flag: $value" - else - # escape any spaces - keyToUse=$( echo "$key" | sed 's/ /\\ /g' ) - sudo /usr/libexec/plistbuddy -c "Add :${keyToUse} string ${value}" "$tempOCBP" - returnValue=$? - if [ ${returnValue} -ne 1 ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "Added boot option: ${key}=${value}" - else - "$scriptDir"InstallLog.sh "${dest_vol}" "Can't add ${key}=${value} as an option already exists for: ${key}" - fi - fi - done < <( find "${chamTemp}/options" -type f -print0 ) - - # Add any kernel flags together in to one string. - kernelFlagString="${kernelflag[@]}" - # We add the final string in the next section. -fi - -# --------------------------------------------- -# Add any installed modules to the Install Log -# --------------------------------------------- -if [ -e "${chamTemp}"/Extra/modules ]; then - ls "${chamTemp}"/Extra/modules | while read FILE - do - "$scriptDir"InstallLog.sh "${dest_vol}" "Added module: $FILE" - if [ "$FILE" == "Keylayout.dylib" ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "Also adding required Keymaps." - fi - done -fi - -# --------------------------------------------- -# Add any installed themes to the Install Log -# --------------------------------------------- -if [ -e "${chamTemp}"/Extra/Themes ]; then - ls "${chamTemp}"/Extra/Themes | while read FILE - do - "$scriptDir"InstallLog.sh "${dest_vol}" "Added Theme: $FILE" - done -fi - -# Does a temporary /Extra folder exist? -if [ -d "$chamTemp"/Extra ]; then - - # --------------------------------------------- - # Merge /Extra folders? - # --------------------------------------------- - # Does the user want to upgrade an existing /Extra folder? - # If so, then merge their existing one in to the temp one. - if [ -e "$chamTemp/install_type_upgrade" ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "User selected to do an upgrade install." - - # first move the new org.chameleon.Boot.plist out of tmp - # Extra folder so we can merge that separately. - mv "$tempOCBP" "$chamTemp/holding.plist" - - # Check for an existing /Extra folder - # and merge existing /Extra with temp one. - if [ -e "$dest_vol"/.ChameleonEFI ]; then - if [ -e "/Volumes/EFI/Extra" ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "Merging existing /Volumes/EFI/Extra folder." - ditto --noextattr --noqtn /Volumes/EFI/Extra "$chamTemp"/Extra - fi - else - if [ -e "$dest_vol/Extra" ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "Merging existing ${dest_vol}/Extra folder." - ditto --noextattr --noqtn "${dest_vol}"/Extra "$chamTemp"/Extra - fi - fi - - # Check existing plist name for old naming convention - # and change to new convention. - if [ -e "$chamTemp"/Extra/com.apple.Boot.plist ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "Renaming existing com.apple.Boot.plist to org.chameleon.Boot.plist." - mv "$chamTemp"/Extra/com.apple.Boot.plist "$tempOCBP" - fi - - # Before merging org.chameleon.Boot.plist, copy any - # existing kernel flags, then delete the entry. - currentFlags=$( sudo /usr/libexec/plistbuddy -c "Print :Kernel\ Flags" "$tempOCBP" ) - sudo /usr/libexec/plistbuddy -c "Delete :Kernel\ Flags" "$tempOCBP" - - # Merge new org.chameleon.Boot.plist (holding.plist) - # with their currently existing one. - "$scriptDir"InstallLog.sh "${dest_vol}" "------ -Merging new options into org.chameleon.Boot.plist. -NOTE: Please check the new merged org.chameleon.Boot.plist as -NOTE: any existing keys will NOT have been updated. -NOTE: For example: If you already had Wait=No as a boot option -NOTE: and chose Wait=Yes from the list, this will NOT be changed. -------" - sudo /usr/libexec/plistbuddy -c "Merge $chamTemp/holding.plist" "$tempOCBP" - - if [[ -n "$currentFlags" ]];then - # Combine new kernel flags with old ones. - kernelFlagString=$( mergeString "$currentFlags" "${kernelFlagString}" ) - fi - - elif [ -e "$chamTemp/install_type_new" ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "User selected to make a new install." - fi - - # Write kernel flags option - kernelFlagString=$(echo ${kernelFlagString}) # Remove leading and trailing spaces - if [[ -n "$kernelFlagString" ]];then - sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelFlagString" "$tempOCBP" - returnValue=$? - if [ ${returnValue} -ne 0 ]; then # key already exists. - sudo /usr/libexec/plistbuddy -c "Delete :Kernel\ Flags" "$tempOCBP" - sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelFlagString" "$tempOCBP" - fi - fi - - # --------------------------------------------- - # Copy temp Extra folder to target destination - # --------------------------------------------- - # Check for an existing /Extra folder. If found, back it up - # before copying the temporary Extra folder to destination. - # Extra folder now resides in /usr/local/chamTemp/ - # Copy /usr/local/chamTemp/Extra to correct location. - - if [ ! -f "$dest_vol"/.ChameleonEFI ]; then - # The Standard install option chosen - rm -rf "$dest_vol/Extra" # Remove old Extra directory - - "$scriptDir"InstallLog.sh "${dest_vol}" "Writing new Extra folder to: $dest_vol/" - echo "Copying $chamTemp/Extra TO $dest_vol" - cp -R "$chamTemp"/Extra "$dest_vol" - else - # The EFI system partition install option was chosen - rm -rf "/Volumes/EFI/Extra" # Remove old Extra directory - - "$scriptDir"InstallLog.sh "${dest_vol}" "Writing new Extra folder to: /Volumes/EFI/" - cp -R "$chamTemp"/Extra "/Volumes/EFI" - fi -else - if [ ! -f "$dest_vol"/.ChameleonEFI ]; then - if [ -e "$dest_vol"/Extra ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "No elements selected for adding to an Extra folder, -so leaving existing $dest_vol/Extra folder untouched." - fi - else - if [ -e "/Volumes/EFI/Extra" ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "No elements selected for adding to an Extra folder, -so leaving existing /Volumes/EFI/Extra folder untouched." - fi - fi -fi - -# --------------------------------------------- -# Update Rights -# --------------------------------------------- -chmod 777 ${dest_vol}/Extra 2>/dev/null -chmod 666 ${dest_vol}/Extra/*.plist 2>/dev/null - -# --------------------------------------------- -# Cleanup -# --------------------------------------------- - -# Unmount ALL mounted volumes named EFI -"$scriptDir"UnMountEFIvolumes.sh "${dest_vol}" "${scriptDir}" - -# remove any temporary boot sector files if they exist -if [ -d /tmp/newbs ]; then - cleanUp="${cleanUp},1a" - rm /tmp/newbs -fi -if [ -d /tmp/origbs ]; then - cleanUp="${cleanUp},1b" - rm /tmp/origbs -fi -if [ -d /tmp/newBootSector ]; then - cleanUp="${cleanUp},1c" - rm /tmp/newbs -fi -if [ -d /tmp/originalBootSector ]; then - cleanUp="${cleanUp},1d" - rm /tmp/origbs -fi - -# delete the temporary Chameleon folder -if [ -e "$chamTemp" ]; then - cleanUp="${cleanUp},2" - rm -rf "$chamTemp" -fi - -# Remove /.ChameleonEFI file -if [ -f "$dest_vol"/.ChameleonEFI ]; then - cleanUp="${cleanUp},3" - rm "$dest_vol"/.ChameleonEFI -fi - -"$scriptDir"InstallLog.sh "${dest_vol}" "Cleanup: ${cleanUp}" -"$scriptDir"InstallLog.sh "${dest_vol}" "LineBreak" -"$scriptDir"InstallLog.sh "${dest_vol}" "Post script complete" - -echo "===============================================" -echo "END - Post Post-Install Script" -echo "*********************************" -echo "-----------------------------------------------" -echo "" Index: branches/ErmaC/Modules/package/Scripts/Main/preinstall =================================================================== --- branches/ErmaC/Modules/package/Scripts/Main/preinstall (revision 1777) +++ branches/ErmaC/Modules/package/Scripts/Main/preinstall (revision 1778) @@ -1,84 +0,0 @@ -#!/bin/bash - -echo "===============================================" -echo "Pre-Install Script" -echo "*********************************" -echo "-----------------------------------------------" -echo "" - -# Creates text file named 'Chameleon_Installer_Log.txt' -# at the root of the target volume. This is to help show the -# user why the installation process failed (even though the -# package installer ends reading 'Installation Successful'. - - - -# Find location of this script in the package installer -# so we know where all the other scripts are located. - -MYLOCATION="${PWD}/${BASH_ARGV[0]}" -export MYLOCATION="${MYLOCATION%/*}" -scriptDir=$MYLOCATION - - -# If target volume root of current system then replace -# / with volume name. -if [ "$3" == "/" ] -then - targetVolume="/Volumes/"$( ls -1F /Volumes | sed -n 's:@$::p' ) -else - targetVolume="$3" -fi - -logName="Chameleon_Installer_Log.txt" -logFile="${targetVolume}/$logName" - -versionNumber=`cat "${scriptDir}"/Resources/version` -revisionNumber=`cat "${scriptDir}"/Resources/revision` - - -# --------------------------------------------- -# Preparing Backing up Chameleon files -# --------------------------------------------- -backupDir="${targetVolume}/Chameleon.Backups/"$( date -j "+%F-%Hh%M" ) -mkdir -p "$backupDir" - -if [[ -f "$logFile" ]];then - # Backup old log file - mv "$logFile" "${backupDir}/${logName}" -fi - - -# Setup Chameleon_Installer_Log.txt file -# by writing header and diskutil list - -echo "Chameleon installer log - $( date ) -Installer version: ${versionNumber} ${revisionNumber} -======================================================" >"${logFile}" - -diskutil list >>"${logFile}" -echo "======================================================" >>"${logFile}" - -# --------------------------------------------- -# Backing up Chameleon files -# --------------------------------------------- -# Backup stage2 -if [[ -f "${targetVolume}/boot" ]];then - echo "Backing up stage2 file ${targetVolume}/boot to ${backupDir}/boot" >>"${logFile}" - cp -p "${targetVolume}/boot" "${backupDir}/boot" -fi -# Backup /Extra directory -if [[ -d "${targetVolume}/Extra" ]];then - echo "Moving ${targetVolume}/Extra folder to ${backupDir}/Extra" >>"${logFile}" - cp -pR "${targetVolume}/Extra" "${backupDir}/Extra" -fi -chflags -R nohidden "$backupDir" # Remove the invisible flag of files in the backups -echo "======================================================" >>"${logFile}" - -echo "===============================================" -echo "END - Pre-Install Script" -echo "*********************************" -echo "-----------------------------------------------" -echo "" - -exit 0 Index: branches/ErmaC/Modules/package/Scripts/Sub/InstallLog.sh =================================================================== --- branches/ErmaC/Modules/package/Scripts/Sub/InstallLog.sh (revision 1777) +++ branches/ErmaC/Modules/package/Scripts/Sub/InstallLog.sh (revision 1778) @@ -1,53 +0,0 @@ -#!/bin/bash - -#echo "===============================================" -#echo "InstallLog: Create/Append installation log" -#echo "**********************************************" - -# Writes to the Chameleon_Installer_Log.txt file created -# by the preinstall script at the start of installation. - -# Receives two parameters -# $1 = selected volume for location of the install log -# $2 = text to write to the installer log - -if [ "$#" -eq 2 ]; then - logLocation="$1" - verboseText="$2" - #echo "DEBUG: passed argument = ${logLocation}" - #echo "DEBUG: passed argument = ${verboseText}" -else - echo "InstallLog: Error - wrong number of values passed" - exit 9 -fi - - - -logName="Chameleon_Installer_Log.txt" -logFile="${logLocation}"/$logName - - -if [ -f "${logFile}" ]; then - - # Append messages to the log as passed by other scripts. - if [ "${verboseText}" = "Diskutil" ]; then - diskutil list >>"${logFile}" - echo "======================================================" >>"${logFile}" - fi - - if [ "${verboseText}" = "LineBreak" ]; then - echo "======================================================" >>"${logFile}" - fi - - if [[ "${verboseText}" == *fdisk* ]]; then - targetDiskRaw="${verboseText#fdisk *}" - fdisk $targetDiskRaw >>"${logFile}" - echo " " >>"${logFile}" - fi - - if [ "${verboseText}" != "LineBreak" ] && [[ "${verboseText}" != *fdisk* ]] && [[ "${verboseText}" != "Diskutil" ]]; then - echo "${verboseText}" >> "${logFile}" - fi -fi - -exit 0 Index: branches/ErmaC/Modules/package/Resources/ja.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/ja.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Modules/package/Resources/ja.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ The scripts have completed and a file\ - named \cf2 Chameleon_Installer_Log.txt\cf3 has been\ + named \cf2 @LOG_FILENAME@\cf3 has been\ written to the root of your chosen partition.\ \ \cf0 Please \cf4 read it\cf0 to find out if the installation was\ Index: branches/ErmaC/Modules/package/Resources/he.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/he.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Modules/package/Resources/he.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ The scripts have completed and a file\ - named \cf2 Chameleon_Installer_Log.txt\cf3 has been\ + named \cf2 @LOG_FILENAME@\cf3 has been\ written to the root of your chosen partition.\ \ \cf0 Please \cf4 read it\cf0 to find out if the installation was\ Index: branches/ErmaC/Modules/package/Resources/bs.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/bs.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Modules/package/Resources/bs.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ Skripte su zavr\'9aile i datoteka pod\ - nazivom \cf2 Chameleon_Installer_Log.txt\cf3 je snimljena\ + nazivom \cf2 @LOG_FILENAME@\cf3 je snimljena\ na root particije diska koje ste odabrali.\ \ \cf0 Molimo \cf4 pro\uc0\u269 itajte ga\cf0 kako biste saznali da li je instalacija bila\ Index: branches/ErmaC/Modules/package/Resources/fr.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/fr.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Modules/package/Resources/fr.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ Les scripts sont termin\'e9s et un fichier\ - nomm\'e9 \cf2 Chameleon_Installer_Log.txt\cf3 a \cf0 \'e9\cf3 t\cf0 \'e9\cf3 \ + nomm\'e9 \cf2 @LOG_FILENAME@\cf3 a \cf0 \'e9\cf3 t\cf0 \'e9\cf3 \ \'e9\cf3 crit \'e0\'a0la racine de la partition choisie.\ \ \cf0 SVP \cf4 lisez le\cf0 pour savoir si l'installation est un\ Index: branches/ErmaC/Modules/package/Resources/nl.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/nl.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Modules/package/Resources/nl.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ De installatie is klaar en het bestand\ - \cf2 Chameleon_Installer_Log.txt\cf3 is geschreven\ + \cf2 @LOG_FILENAME@\cf3 is geschreven\ naar de root van de door u gekozen partitie.\ \ \cf0 Alstublieft \cf4 lees het\cf0 document om te zien of de installatie\ Index: branches/ErmaC/Modules/package/Resources/hr.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/hr.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Modules/package/Resources/hr.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ Skripte su zavr\'9aene i mapa pod\ - nazivom \cf2 Chameleon_Installer_Log.txt\cf3 je snimljena\ + nazivom \cf2 @LOG_FILENAME@\cf3 je snimljena\ u korijen particije diska koje ste odabrali.\ \ \cf0 Molimo \cf4 pro\uc0\u269 itajte\cf0 kako biste saznali da li je instalacija\ Index: branches/ErmaC/Modules/package/Resources/pl.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/pl.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Modules/package/Resources/pl.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -7,7 +7,7 @@ \f0\b\fs28 \cf0 \ \ -Zako\uc0\u324 czono wykonywanie skrypt\'f3w i plik logu \cf2 Chameleon_Installer_Log.txt\cf3 zosta\uc0\u322 zapisany \ +Zako\uc0\u324 czono wykonywanie skrypt\'f3w i plik logu \cf2 @LOG_FILENAME@\cf3 zosta\uc0\u322 zapisany \ na g\uc0\u322 \'f3wnym katalogu wybranej partycji.\ \ \cf0 Prosz\uc0\u281 \cf4 przeczytaj go\cf0 by dowiedzie\uc0\u263 si\u281 ,\ Index: branches/ErmaC/Modules/package/Resources/pt-BR.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/pt-BR.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Modules/package/Resources/pt-BR.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ Os scripts est\'e3o finalizados e foi gerado um\ - ficheiro \cf2 Chameleon_Installer_Log.txt\cf3 que se\ + ficheiro \cf2 @LOG_FILENAME@\cf3 que se\ encontra na raiz da parti\'e7\'e3o selecionada.\ \ \cf0 Por Favor \cf4 leia-o\cf0 para verificar se a instala\'e7\'e3o foi realizada\ Index: branches/ErmaC/Modules/package/Resources/ru.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/ru.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Modules/package/Resources/ru.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ The scripts have completed and a file\ - named \cf2 Chameleon_Installer_Log.txt\cf3 has been\ + named \cf2 @LOG_FILENAME@\cf3 has been\ written to the root of your chosen partition.\ \ \cf0 Please \cf4 read it\cf0 to find out if the installation was\ Index: branches/ErmaC/Modules/package/Resources/zh_TW.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/zh_TW.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Modules/package/Resources/zh_TW.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -13,7 +13,7 @@ \f1 \'81\'4b\'d4\'da\'df\'78\'93\'f1\'b0\'b2\'d1\'62\'b5\'c4\'b7\'d6\'b8\'ee\'85\'5e\'bd\'a8\'c1\'a2 \f0 \cf2 \ -\cf3 Chameleon_Installer_Log.txt +\cf3 @LOG_FILENAME@ \f1 \cf0 \'bc\'6f\'e4\'9b\'ce\'c4\'bc\'fe\'a1\'a3 \f0 \cf2 \ \ Index: branches/ErmaC/Modules/package/Resources/id.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/id.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Modules/package/Resources/id.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ Skrip ini telah selesai dan telah disematkan pada\ - berkas \cf2 Chameleon_Installer_Log.txt\cf3 yang ditaruh di\ + berkas \cf2 @LOG_FILENAME@\cf3 yang ditaruh di\ direktori utama dari partisi yang terinstall.\ \ \cf0 Silahkan \cf4 baca\cf0 berkas itu dan perhatikan apakah instalasi telah\ Index: branches/ErmaC/Modules/package/Resources/el.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/el.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Modules/package/Resources/el.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ The scripts have completed and a file\ - named \cf2 Chameleon_Installer_Log.txt\cf3 has been\ + named \cf2 @LOG_FILENAME@\cf3 has been\ written to the root of your chosen partition.\ \ \cf0 Please \cf4 read it\cf0 to find out if the installation was\ Index: branches/ErmaC/Modules/package/Resources/zh_CN.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/zh_CN.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Modules/package/Resources/zh_CN.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -13,7 +13,7 @@ \f1 \'b2\'a2\'d4\'da\'d1\'a1\'d4\'f1\'b0\'b2\'d7\'b0\'b5\'c4\'b7\'d6\'c7\'f8\'bd\'a8\'c1\'a2 \f0 \cf2 \ -\cf3 Chameleon_Installer_Log.txt +\cf3 @LOG_FILENAME@ \f1 \cf0 \'bc\'cd\'c2\'bc\'ce\'c4\'bc\'fe\'a1\'a3 \f0 \cf2 \ \ Index: branches/ErmaC/Modules/package/Resources/en.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/en.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Modules/package/Resources/en.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ The scripts have completed and a file\ - named \cf2 Chameleon_Installer_Log.txt\cf3 has been\ + named \cf2 @LOG_FILENAME@\cf3 has been\ written to the root of your chosen partition.\ \ \cf0 Please \cf4 read it\cf0 to find out if the installation was\ Index: branches/ErmaC/Modules/package/Resources/ar.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/ar.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Modules/package/Resources/ar.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -14,7 +14,7 @@ \f0 \ \f1 \'de\'cf -\f0 \cf2 Chameleon_Installer_Log.txt\cf3 +\f0 \cf2 @LOG_FILENAME@\cf3 \f1 \'ed\'d3\'e3\'ec \f0 \ Index: branches/ErmaC/Modules/package/Resources/pt-PT.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/pt-PT.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Modules/package/Resources/pt-PT.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ Os scripts est\'e3o finalizados e foi gerado um\ - ficheiro \cf2 Chameleon_Installer_Log.txt\cf3 que se\ + ficheiro \cf2 @LOG_FILENAME@\cf3 que se\ encontra na raiz da parti\'e7\'e3o selecionada.\ \ \cf0 Por Favor \cf4 leia-o\cf0 para verificar se a instala\'e7\'e3o foi realizada\ Index: branches/ErmaC/Modules/package/Resources/es.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/es.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Modules/package/Resources/es.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ Los scripts se han completado y un archivo\ - de nombre \cf2 Chameleon_Installer_Log.txt\cf3 ha sido\ + de nombre \cf2 @LOG_FILENAME@\cf3 ha sido\ escrito en la ra\'edz de la partici\'f3n seleccionada.\ \ \cf0 Por favor \cf4 l\'e9alo\cf0 para saber si la instalaci\'f3n fue\ Index: branches/ErmaC/Modules/package/Resources/mk.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/mk.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Modules/package/Resources/mk.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ \uc0\u1057 \u1082 \u1088 \u1080 \u1087 \u1090 \u1072 \u1090 \u1072 \u1077 \u1079 \u1072 \u1074 \u1088 \u1096 \u1077 \u1085 \u1072 \u1080 \u1076 \u1072 \u1090 \u1086 \u1090 \u1077 \u1082 \u1072 \ - \uc0\u1089 \u1086 \u1080 \u1084 \u1077 \cf2 Chameleon_Installer_Log.txt\cf3 \uc0\u1077 \ + \uc0\u1089 \u1086 \u1080 \u1084 \u1077 \cf2 @LOG_FILENAME@\cf3 \uc0\u1077 \ \uc0\u1079 \u1072 \u1087 \u1080 \u1096 \u1072 \u1085 \u1072 \u1074 \u1086 root \u1085 \u1072 \u1080 \u1079 \u1073 \u1088 \u1072 \u1085 \u1072 \u1090 \u1072 \u1087 \u1072 \u1088 \u1090 \u1080 \u1094 \u1080 \u1112 \u1072 .\ \ \cf0 \uc0\u1042 \u1077 \u1084 \u1086 \u1083 \u1080 \u1084 \u1077 \cf4 \uc0\u1087 \u1088 \u1086 \u1095 \u1080 \u1090 \u1072 \u1112 \u1090 \u1077 \u1112 \u1072 \cf0 \uc0\u1076 \u1072 \u1076 \u1086 \u1079 \u1085 \u1072 \u1077 \u1090 \u1077 \u1076 \u1072 \u1083 \u1080 \u1080 \u1085 \u1089 \u1090 \u1072 \u1083 \u1072 \u1094 \u1080 \u1112 \u1072 \u1090 \u1072 \ Index: branches/ErmaC/Modules/package/Resources/ko.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/ko.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Modules/package/Resources/ko.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -13,7 +13,7 @@ \'bc\'b1\'c5\'c3\'b5\'c8 \'c6\'c4\'c6\'bc\'bc\'c7\'c0\'c7 \'b7\'e7\'c6\'ae \'b5\'f0\'b7\'ba\'c5\'e4\'b8\'ae\'bf\'a1 \f2\b \ -\f0 \cf2 Chameleon_Installer_Log.txt +\f0 \cf2 @LOG_FILENAME@ \f1\b0 \cf3 \'b8\'a6 \'bb\'fd\'bc\'ba\'c7\'cf\'bf\'b4\'bd\'c0\'b4\'cf\'b4\'d9. \f0\b \ \ Index: branches/ErmaC/Modules/package/Resources/it.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/it.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Modules/package/Resources/it.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ Le operazioni sono state completate ed un file\ - chiamato \cf2 Chameleon_Installer_Log.txt\cf3 \'e9 stato\ + chiamato \cf2 @LOG_FILENAME@\cf3 \'e9 stato\ scritto nella root della partizione scelta.\ \ \cf0 Per favore \cf4 leggilo\cf0 per vedere se l'installazione \'e9\ Index: branches/ErmaC/Modules/package/Resources/sr.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/sr.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Modules/package/Resources/sr.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ Skripte su zavr\'9aene i mapa pod\ - nazivom \cf2 Chameleon_Installer_Log.txt\cf3 je snimljena\ + nazivom \cf2 @LOG_FILENAME@\cf3 je snimljena\ u koren particije diska koje ste odabrali.\ \ \cf0 Molimo \cf4 pro\uc0\u269 itajte\cf0 kako biste saznali da li je instalacija bila\ Index: branches/ErmaC/Modules/package/Resources/bg.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/bg.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Modules/package/Resources/bg.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ The scripts have completed and a file\ - named \cf2 Chameleon_Installer_Log.txt\cf3 has been\ + named \cf2 @LOG_FILENAME@\cf3 has been\ written to the root of your chosen partition.\ \ \cf0 Please \cf4 read it\cf0 to find out if the installation was\ Index: branches/ErmaC/Modules/package/Resources/de.lproj/Conclusion.rtfd/TXT.rtf =================================================================== --- branches/ErmaC/Modules/package/Resources/de.lproj/Conclusion.rtfd/TXT.rtf (revision 1777) +++ branches/ErmaC/Modules/package/Resources/de.lproj/Conclusion.rtfd/TXT.rtf (revision 1778) @@ -8,7 +8,7 @@ \f0\b\fs28 \cf0 \ \ Die Scripts wurden ausgef\'fchrt und eine Datei\ - genannt \cf2 Chameleon_Installer_Log.txt\cf3 wurde ins\ + genannt \cf2 @LOG_FILENAME@\cf3 wurde ins\ Rootverzeichnis deiner ausgesuchten Partition geschrieben. \ \ \cf0 Bitte \cf4 lese\cf5 die Datei\cf0 \cf3 um herauszufinden ob \ Index: branches/ErmaC/Modules/package/buildpkg.sh =================================================================== --- branches/ErmaC/Modules/package/buildpkg.sh (revision 1777) +++ branches/ErmaC/Modules/package/buildpkg.sh (revision 1778) @@ -9,6 +9,7 @@ declare -r SRCROOT="$1" declare -r SYMROOT="$2" declare -r PKG_BUILD_DIR="$3" +declare -r SCPT_TPL_DIR="${PKGROOT}/Scripts.templates" if [[ $# -lt 3 ]];then echo "Too few arguments. Aborting..." >&2 && exit 1 @@ -48,26 +49,28 @@ # ====== REVISION/VERSION ====== -declare -r version=$( cat version ) +declare -r CHAMELEON_VERSION=$( cat version ) # stage -stage=${version##*-} -stage=${stage/RC/Release Candidate } -stage=${stage/FINAL/2.1 Final} -declare -r stage +CHAMELEON_STAGE=${CHAMELEON_VERSION##*-} +CHAMELEON_STAGE=${CHAMELEON_STAGE/RC/Release Candidate } +CHAMELEON_STAGE=${CHAMELEON_STAGE/FINAL/2.1 Final} +declare -r CHAMELEON_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" ) +declare -r CHAMELEON_REVISION=$( grep I386BOOT_CHAMELEONREVISION vers.h | awk '{ print $3 }' | tr -d '\"' ) +declare -r CHAMELEON_BUILDDATE=$( grep I386BOOT_BUILDDATE vers.h | awk '{ print $3,$4 }' | tr -d '\"' ) +declare -r CHAMELEON_TIMESTAMP=$( date -j -f "%Y-%m-%d %H:%M:%S" "${CHAMELEON_BUILDDATE}" "+%s" ) # ====== 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 -r whobuild=$(whoami | awk '{print $1}' | cut -d ":" -f3) +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_WHOBUILD=$(whoami | awk '{print $1}' | cut -d ":" -f3) # ====== GLOBAL VARIABLES ====== +declare -r LOG_FILENAME="Chameleon_Installer_Log.txt" + declare -a pkgrefs declare -a choice_key declare -a choice_options @@ -98,6 +101,134 @@ echo "${result%"${result##*[![:space:]]}"}" # remove trailing whitespace characters } +argument () { + local opt="$1" + + if [[ $# -eq 0 ]];then + echo "$0: option requires an argument -- '$opt'" >&2; exit 1 + fi + echo "$opt" +} + +function makeSubstitutions () { + # Substition is like: Key=Value + # + # Optionnal arguments: + # --subst= : add a new substitution + # --subst : add a new substitution + # + # Last argument(s) is/are file(s) where substitutions must be made + + local ownSubst="" + + function addSubst () { + local mySubst="$1" + case "$mySubst" in + *=*) keySubst=${mySubst%%=*} + valSubst=${mySubst#*=} + ownSubst=$(printf "%s\n%s" "$ownSubst" "s&@$keySubst@&$valSubst&g;t t") + ;; + *) echo "Invalid substitution $mySubst" >&2 + exit 1 + ;; + esac + } + + # Check the arguments. + while [[ $# -gt 0 ]];do + local option="$1" + case "$option" in + --subst) shift; addSubst "$(argument $@)"; shift ;; + --subst=*) shift; addSubst "${option#*=}" ;; + -*) + echo "Unrecognized makeSubstitutions option '$option'" >&2 + exit 1 + ;; + *) break ;; + esac + done + + if [[ $# -lt 1 ]];then + echo "makeSubstitutions invalid number of arguments: at least one file needed" >&2 + exit 1 + fi + + local chameleonSubsts=" +s&%CHAMELEONVERSION%&${CHAMELEON_VERSION%%-*}&g +s&%CHAMELEONREVISION%&${CHAMELEON_REVISION}&g +s&%CHAMELEONSTAGE%&${CHAMELEON_STAGE}&g +s&%DEVELOP%&${CHAMELEON_DEVELOP}&g +s&%CREDITS%&${CHAMELEON_CREDITS}&g +s&%PKGDEV%&${CHAMELEON_PKGDEV}&g +s&%WHOBUILD%&${CHAMELEON_WHOBUILD}&g +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s&@LOG_FILENAME@&${LOG_FILENAME}&g;t t" + + local allSubst=" +$chameleonSubsts +$ownSubst" + + for file in "$@";do + cp -pf "$file" "${file}.in" + sed "$allSubst" "${file}.in" > "${file}" + rm -f "${file}.in" + done +} + +addTemplateScripts () { + # Arguments: + # --pkg-rootdir= : path of the pkg root dir + # + # Optionnal arguments: + # --subst= : add a new substitution + # --subst : add a new substitution + # + # Substition is like: Key=Value + # + # $n : Name of template(s) (templates are in package/Scripts.templates + + local pkgRootDir="" + declare -a allSubst + + # Check the arguments. + while [[ $# -gt 0 ]];do + local option="$1" + case "$option" in + --pkg-rootdir=*) shift; pkgRootDir="${option#*=}" ;; + --subst) shift; allSubst[${#allSubst[*]}]="$option"; allSubst[${#allSubst[*]}]="$1" ; shift ;; + --subst=*) shift; allSubst[${#allSubst[*]}]="${option}" ;; + -*) + echo "Unrecognized addTemplateScripts option '$option'" >&2 + exit 1 + ;; + *) break ;; + esac + done + if [[ $# -lt 1 ]];then + echo "addTemplateScripts invalid number of arguments: you must specify a template name" >&2 + exit 1 + fi + [[ -z "$pkgRootDir" ]] && { echo "Error addTemplateScripts: --pkg-rootdir option is needed" >&2 ; exit 1; } + [[ ! -d "$pkgRootDir" ]] && { echo "Error addTemplateScripts: directory '$pkgRootDir' doesn't exists" >&2 ; exit 1; } + + for templateName in "$@";do + local templateRootDir="${SCPT_TPL_DIR}/${templateName}" + [[ ! -d "$templateRootDir" ]] && { + echo "Error addTemplateScripts: template '$templateName' doesn't exists" >&2; exit 1; } + + # Copy files to destination + rsync -pr --exclude=.svn --exclude="*~" "$templateRootDir/" "$pkgRootDir/Scripts/" + done + + files=$( find "$pkgRootDir/Scripts/" -type f ) + if [[ ${#allSubst[*]} -gt 0 ]];then + makeSubstitutions "${allSubst[@]}" $files + else + makeSubstitutions $files + fi +} + getPackageRefId () { echo ${1//_/.}.${2//_/.} | tr [:upper:] [:lower:] } @@ -271,14 +402,10 @@ packagesidentity="${chameleon_package_identity}" choiceId="Pre" mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root - mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Scripts - ditto --noextattr --noqtn ${SRCROOT}/revision ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources/revision - ditto --noextattr --noqtn ${SRCROOT}/version ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources/version - cp -f ${PKGROOT}/Scripts/Main/preinstall ${PKG_BUILD_DIR}/${choiceId}/Scripts - cp -f ${PKGROOT}/Scripts/Sub/InstallLog.sh ${PKG_BUILD_DIR}/${choiceId}/Scripts + addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" ${choiceId} packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") - buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/" + buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/" >/dev/null 2>&1 addChoice --start-visible="false" --start-selected="true" --pkg-refs="$packageRefId" "${choiceId}" # End build pre install package @@ -301,7 +428,7 @@ ditto --noextattr --noqtn ${SYMROOT}/i386/bdmesg ${PKG_BUILD_DIR}/${choiceId}/Root/usr/local/bin packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") - buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/" + buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/" >/dev/null 2>&1 addChoice --start-visible="false" --start-selected="true" --pkg-refs="$packageRefId" "${choiceId}" # End build core package @@ -316,7 +443,7 @@ echo "" > "${PKG_BUILD_DIR}/${choiceId}/Root/install_type_new" packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") - buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/$chamTemp" + buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/$chamTemp" >/dev/null 2>&1 addChoice --group="InstallType" --start-selected="!choices['Upgrade'].selected" --pkg-refs="$packageRefId" "${choiceId}" # End build new install package @@ -326,7 +453,7 @@ echo "" > "${PKG_BUILD_DIR}/${choiceId}/Root/install_type_upgrade" packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") - buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/$chamTemp" + buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/$chamTemp" >/dev/null 2>&1 addChoice --group="InstallType" --start-selected="chameleon_boot_plist_exists()" --pkg-refs="$packageRefId" "${choiceId}" # End build upgrade package @@ -340,12 +467,13 @@ choiceId="Standard" mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources + addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" InstallerLog cp -f ${PKGROOT}/Scripts/Main/${choiceId}postinstall ${PKG_BUILD_DIR}/${choiceId}/Scripts/postinstall cp -f ${PKGROOT}/Scripts/Sub/* ${PKG_BUILD_DIR}/${choiceId}/Scripts ditto --arch i386 `which SetFile` ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources/SetFile packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") - buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/" + buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/" >/dev/null 2>&1 addChoice --group="Chameleon" --start-selected="true" --pkg-refs="$packageRefId" "${choiceId}" # End build standard package @@ -353,12 +481,13 @@ choiceId="EFI" mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources + addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" InstallerLog cp -f ${PKGROOT}/Scripts/Main/ESPpostinstall ${PKG_BUILD_DIR}/${choiceId}/Scripts/postinstall cp -f ${PKGROOT}/Scripts/Sub/* ${PKG_BUILD_DIR}/${choiceId}/Scripts ditto --arch i386 `which SetFile` ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources/SetFile packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") - buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/" + buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/" >/dev/null 2>&1 addChoice --group="Chameleon" --start-visible="systemHasGPT()" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}" # End build efi package @@ -367,7 +496,7 @@ mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") - buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/" + buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/" >/dev/null 2>&1 addChoice --group="Chameleon" --start-selected="false" --pkg-refs="$packageRefId" "${choiceId}" # End build no bootloader choice package @@ -604,7 +733,7 @@ echo "" > "${PKG_BUILD_DIR}/$optionName/Root/${keyValue}" packageRefId=$(getPackageRefId "${packagesidentity}" "${optionName}") - buildpackage "$packageRefId" "${optionName}" "${PKG_BUILD_DIR}/${optionName}" "/$chamTemp/options" + buildpackage "$packageRefId" "${optionName}" "${PKG_BUILD_DIR}/${optionName}" "/$chamTemp/options" >/dev/null 2>&1 addChoice --group="${builtOptionsList}" \ --start-selected="check_chameleon_option('$key','$value')" \ --pkg-refs="$packageRefId" "${optionName}" @@ -641,7 +770,7 @@ echo "" > "${PKG_BUILD_DIR}/${choiceId}/Root/${chameleon_keylayout_key}=${availableOptions[i]}" packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") - buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/$chamTemp/options" + buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/$chamTemp/options" >/dev/null 2>&1 # Add the Keylayout package because the Keylayout module is needed addChoice --group="KeyLayout" \ --start-selected="check_chameleon_option('${chameleon_keylayout_key}','${choiceId}')" \ @@ -662,10 +791,10 @@ for (( i = 0 ; i < ${#themes[@]} ; i++ )); do theme=$( echo ${themes[$i]##*/} | awk 'BEGIN{OFS=FS=""}{$1=toupper($1);print}' ) mkdir -p "${PKG_BUILD_DIR}/${theme}/Root/" - rsync -r --exclude=.svn "${themes[$i]}/" "${PKG_BUILD_DIR}/${theme}/Root/${theme}" + rsync -r --exclude=.svn --exclude="*~" "${themes[$i]}/" "${PKG_BUILD_DIR}/${theme}/Root/${theme}" packageRefId=$(getPackageRefId "${packagesidentity}" "${theme}") - buildpackage "$packageRefId" "${theme}" "${PKG_BUILD_DIR}/${theme}" "/$chamTemp/Extra/Themes" + buildpackage "$packageRefId" "${theme}" "${PKG_BUILD_DIR}/${theme}" "/$chamTemp/Extra/Themes" >/dev/null 2>&1 addChoice --group="Themes" --start-selected="false" --pkg-refs="$packageRefId" "${theme}" done # End build theme packages# End build Extras package @@ -675,15 +804,11 @@ packagesidentity="${chameleon_package_identity}" choiceId="Post" mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Root - mkdir -p ${PKG_BUILD_DIR}/${choiceId}/Scripts - cp -f ${PKGROOT}/Scripts/Main/postinstall ${PKG_BUILD_DIR}/${choiceId}/Scripts - cp -f ${PKGROOT}/Scripts/Sub/InstallLog.sh ${PKG_BUILD_DIR}/${choiceId}/Scripts + addTemplateScripts --pkg-rootdir="${PKG_BUILD_DIR}/${choiceId}" ${choiceId} InstallerLog cp -f ${PKGROOT}/Scripts/Sub/UnMountEFIvolumes.sh ${PKG_BUILD_DIR}/${choiceId}/Scripts - ditto --noextattr --noqtn ${SRCROOT}/revision ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources/revision - ditto --noextattr --noqtn ${SRCROOT}/version ${PKG_BUILD_DIR}/${choiceId}/Scripts/Resources/version packageRefId=$(getPackageRefId "${packagesidentity}" "${choiceId}") - buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/" + buildpackage "$packageRefId" "${choiceId}" "${PKG_BUILD_DIR}/${choiceId}" "/" >/dev/null 2>&1 addChoice --start-visible="false" --start-selected="true" --pkg-refs="$packageRefId" "${choiceId}" # End build post install package @@ -719,7 +844,7 @@ #[ "${3}" == "relocatable" ] && header+="relocatable=\"true\" " header+="identifier=\"${packageRefId}\" " - header+="version=\"${version}\" " + header+="version=\"${CHAMELEON_VERSION}\" " [ "${targetPath}" != "relocatable" ] && header+="install-location=\"${targetPath}\" " @@ -752,7 +877,7 @@ (cd "${packagePath}/Temp" && xar -c -f "${packagePath}/../${packageName}.pkg" --compression none .) # Add the package to the list of build packages - pkgrefs[${#pkgrefs[*]}]="\t#${packageName}.pkg" + pkgrefs[${#pkgrefs[*]}]="\t#${packageName}.pkg" rm -rf "${packagePath}" fi @@ -825,7 +950,7 @@ makedistribution () { declare -r distributionDestDir="${SYMROOT}" - declare -r distributionFilename="${packagename// /}-${version}-r${revision}.pkg" + declare -r distributionFilename="${packagename// /}-${CHAMELEON_VERSION}-r${CHAMELEON_REVISION}.pkg" declare -r distributionFilePath="${distributionDestDir}/${distributionFilename}" rm -f "${distributionDestDir}/${packagename// /}"*.pkg @@ -865,21 +990,9 @@ # CleanUp the directory find "${PKG_BUILD_DIR}/${packagename}" \( -type d -name '.svn' \) -o -name '.DS_Store' -exec rm -rf {} \; -# Add Chameleon Version and Revision - perl -i -p -e "s/%CHAMELEONVERSION%/${version%%-*}/g" $( find "${PKG_BUILD_DIR}/${packagename}/Resources" -type f ) - perl -i -p -e "s/%CHAMELEONREVISION%/${revision}/g" $( find "${PKG_BUILD_DIR}/${packagename}/Resources" -type f ) + # Make substitutions like version, revision, stage, developers, credits, etc.. + makeSubstitutions $( find "${PKG_BUILD_DIR}/${packagename}/Resources" -type f ) -# Add Chameleon Stage - perl -i -p -e "s/%CHAMELEONSTAGE%/${stage}/g" $( find "${PKG_BUILD_DIR}/${packagename}/Resources" -type f ) - -# Adding Developer and credits - perl -i -p -e "s/%DEVELOP%/${develop}/g" $( find "${PKG_BUILD_DIR}/${packagename}/Resources" -type f ) - perl -i -p -e "s/%CREDITS%/${credits}/g" $( find "${PKG_BUILD_DIR}/${packagename}/Resources" -type f ) - perl -i -p -e "s/%PKGDEV%/${pkgdev}/g" $( find "${PKG_BUILD_DIR}/${packagename}/Resources" -type f ) - -# Adding whoami - perl -i -p -e "s/%WHOBUILD%/${whobuild}/g" $( find "${PKG_BUILD_DIR}/${packagename}/Resources" -type f ) - # Create the final package pkgutil --flatten "${PKG_BUILD_DIR}/${packagename}" "${distributionFilePath}" @@ -908,10 +1021,10 @@ echo -e $COL_GREEN" ===========" echo -e $COL_BLUE" Package name: "$COL_RESET"${distributionFilename}" echo -e $COL_BLUE" MD5: "$COL_RESET"$md5" - echo -e $COL_BLUE" Version: "$COL_RESET"$version" - echo -e $COL_BLUE" Stage: "$COL_RESET"$stage" - echo -e $COL_BLUE" Date/Time: "$COL_RESET"$builddate" - echo -e $COL_BLUE" Builded by: "$COL_RESET"$whobuild" + 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 "" }