Index: trunk/package/Scripts/Main/postinstall =================================================================== --- trunk/package/Scripts/Main/postinstall (revision 1766) +++ trunk/package/Scripts/Main/postinstall (revision 1767) @@ -56,6 +56,7 @@ # set temporary directory chamTemp="$dest_vol/usr/local/chamTemp" + # --------------------------------------------- # Build org.chameleon.Boot.plist # --------------------------------------------- @@ -227,22 +228,15 @@ if [ ! -f "$dest_vol"/.ChameleonEFI ]; then # The Standard install option chosen + rm -rf "$dest_vol/Extra" # Remove old Extra directory - # Does an /Extra folder already exist? - if [ -e "$dest_vol"/Extra ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "Moving $dest_vol/Extra folder to $dest_vol/Extra-OLD-$( date "+%H-%M-%S" )" - mv "$dest_vol/Extra" "$dest_vol/Extra_OLD-"$( date "+%H-%M-%S" ) - fi "$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 - # Does a /Volumes/Extra folder already exist? - if [ -e "/Volumes/EFI/Extra" ]; then - "$scriptDir"InstallLog.sh "${dest_vol}" "Moving /Volumes/EFI/Extra folder to /Volumes/EFI/Extra-OLD-$( date "+%H-%M-%S" )" - mv "/Volumes/EFI/Extra" "/Volumes/EFI/Extra_OLD-"$( date "+%H-%M-%S" ) - fi + 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 @@ -261,6 +255,12 @@ fi # --------------------------------------------- +# Update Rights +# --------------------------------------------- +chmod 777 ${dest_vol}/Extra 2>/dev/null +chmod 666 ${dest_vol}/Extra/*.plist 2>/dev/null + +# --------------------------------------------- # Cleanup # --------------------------------------------- Index: trunk/package/Scripts/Main/preinstall =================================================================== --- trunk/package/Scripts/Main/preinstall (revision 1766) +++ trunk/package/Scripts/Main/preinstall (revision 1767) @@ -9,7 +9,7 @@ # 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'. +# package installer ends reading 'Installation Successful'. @@ -25,31 +25,56 @@ # / with volume name. if [ "$3" == "/" ] then - targetVolume="/Volumes/"$( ls -1F /Volumes | sed -n 's:@$::p' ) + targetVolume="/Volumes/"$( ls -1F /Volumes | sed -n 's:@$::p' ) else targetVolume="$3" fi logName="Chameleon_Installer_Log.txt" -logFile="${targetVolume}"/$logName +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 "*********************************"