Chameleon

Chameleon Commit Details

Date:2012-01-11 18:09:25 (12 years 3 months ago)
Author:JrCs
Commit:1791
Parents: 1790
Message:Simplify the creation of the backup directory by the installer
Changes:
M/trunk/package/Scripts.templates/Pre/preinstall

File differences

trunk/package/Scripts.templates/Pre/preinstall
3838
3939
4040
41
41
42
4243
43
44
45
46
47
44
45
4846
4947
5048
......
6159
6260
6361
64
65
66
67
68
69
70
71
72
73
74
75
76
77
62
63
64
65
66
7867
68
69
70
71
72
7973
74
75
76
77
78
79
8080
8181
8282
# ---------------------------------------------
# Preparing Backing up of Chameleon files
# ---------------------------------------------
backupDir="${targetVolume}/Chameleon.Backups/"$( date -j "+%F-%Hh%M" )
backupRootDir="${targetVolume}/Chameleon.Backups"
backupDir="${backupRootDir}/"$( date -j "+%F-%Hh%M" )
# Only make backupDir if required
if [[ ! -d "$backupDir" && \
( -f "$logFile" || -f "${targetVolume}/boot" || -d "${targetVolume}/Extra" ) ]];then
mkdir -p "$backupDir"
fi
# Create the backup dirextory
mkdir -p "$backupDir"
[[ -f "$logFile" ]] && mv "$logFile" "${backupDir}/${logName}" # Backup old log file
# ---------------------------------------------
# Backing up Chameleon files
# ---------------------------------------------
if [[ -d "$backupDir" ]];then
# 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 "Backing up Chameleon files" >>"${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 "Backing up ${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
find "${backupRootDir}" -type d -depth -empty -exec rmdir {} \; # Remove empty directories
echo "======================================================" >>"${logFile}"
echo "==============================================="
echo "END - Pre-Install Script"
echo "*********************************"

Archive Download the corresponding diff file

Revision: 1791