Index: trunk/package/Scripts.templates/Pre/preinstall =================================================================== --- trunk/package/Scripts.templates/Pre/preinstall (revision 1786) +++ trunk/package/Scripts.templates/Pre/preinstall (revision 1787) @@ -7,16 +7,14 @@ echo "" # Creates text file named '@LOG_FILENAME@' -# at the root of the target volume. This is to give the user +# at the root of the target volume. This is to give the user # a record of the installation process and also to show why # possibly the installation process failed (even though the -# package installer ends reading 'Installation Successful'. +# package installer ends reading 'Installation Successful'). # This script also prepares, then backs up any previous # stage2 boot file, /Extra folder and install log if they exist. - - # Find location of this script in the package installer # so we know where all the other scripts are located. @@ -41,13 +39,14 @@ # Preparing Backing up of Chameleon files # --------------------------------------------- backupDir="${targetVolume}/Chameleon.Backups/"$( date -j "+%F-%Hh%M" ) -if [[ -f "$logFile" ]];then - # Only make backupDir if required + +# Only make backupDir if required +if [[ ! -d "$backupDir" && \ + ( -f "$logFile" || -f "${targetVolume}/boot" || -d "${targetVolume}/Extra" ) ]];then mkdir -p "$backupDir" - # Backup old log file - mv "$logFile" "${backupDir}/${logName}" fi +[[ -f "$logFile" ]] && mv "$logFile" "${backupDir}/${logName}" # Backup old log file # Setup Chameleon Log file # by writing header and diskutil list @@ -62,23 +61,18 @@ # --------------------------------------------- # Backing up Chameleon files # --------------------------------------------- -if [[ -f "${targetVolume}/boot" ]] || [[ -d "${targetVolume}/Extra" ]];then - if [[ ! -d "$backupDir" ]];then - mkdir -p "$backupDir" - fi - # 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}" +# 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" Index: trunk/package/buildpkg.sh =================================================================== --- trunk/package/buildpkg.sh (revision 1786) +++ trunk/package/buildpkg.sh (revision 1787) @@ -166,11 +166,9 @@ $ownSubst" for file in "$@";do - if [[ ! $file == *.svn* ]]; then - cp -pf "$file" "${file}.in" - sed "$allSubst" "${file}.in" > "${file}" - rm -f "${file}.in" - fi + cp -pf "$file" "${file}.in" + sed "$allSubst" "${file}.in" > "${file}" + rm -f "${file}.in" done }