Chameleon

Chameleon Commit Details

Date:2011-12-31 18:53:51 (8 years 5 months ago)
Author:JrCs
Commit:1767
Parents: 1766
Message:Improved chameleon installer - Improved backup of chameleon files
Changes:
M/trunk/package/Scripts/Main/postinstall
M/trunk/package/Scripts/Main/preinstall

File differences

trunk/package/Scripts/Main/postinstall
5656
5757
5858
59
5960
6061
6162
......
227228
228229
229230
231
230232
231
232
233
234
235
236233
237234
238235
239236
240237
241
242
243
244
245
238
239
246240
247241
248242
......
261255
262256
263257
258
259
260
261
262
263
264264
265265
266266
# set temporary directory
chamTemp="$dest_vol/usr/local/chamTemp"
# ---------------------------------------------
# Build org.chameleon.Boot.plist
# ---------------------------------------------
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
fi
# ---------------------------------------------
# Update Rights
# ---------------------------------------------
chmod 777 ${dest_vol}/Extra 2>/dev/null
chmod 666 ${dest_vol}/Extra/*.plist 2>/dev/null
# ---------------------------------------------
# Cleanup
# ---------------------------------------------
trunk/package/Scripts/Main/preinstall
99
1010
1111
12
12
1313
1414
1515
......
2525
2626
2727
28
28
2929
3030
3131
3232
3333
34
34
3535
3636
3737
3838
3939
40
41
42
43
44
4045
46
47
48
49
50
51
4152
4253
4354
4455
4556
4657
47
58
4859
4960
5061
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
5177
52
5378
5479
5580
# 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'.
# / 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 "*********************************"

Archive Download the corresponding diff file

Revision: 1767