Chameleon

Chameleon Commit Details

Date:2012-01-09 12:01:13 (12 years 3 months ago)
Author:ErmaC
Commit:1778
Parents: 1777
Message:Merge trunk(r1777) package changes.
Changes:
D/branches/ErmaC/Modules/package/Scripts/Main/preinstall
D/branches/ErmaC/Trunk/package/Scripts/Main/postinstall
D/branches/ErmaC/Trunk/package/Scripts/Main/preinstall
D/branches/ErmaC/Modules/package/Scripts/Main/postinstall
D/branches/ErmaC/Trunk/package/Scripts/Sub/InstallLog.sh
D/branches/ErmaC/Modules/package/Scripts/Sub/InstallLog.sh
C/trunk/package/Scripts.templates/Pre/preinstall → /branches/ErmaC/Modules/package/Scripts.templates/Pre/preinstall
C/trunk/package/Scripts.templates/Post/postinstall → /branches/ErmaC/Trunk/package/Scripts.templates/Post/postinstall
C/trunk/package/Scripts.templates/InstallerLog/InstallLog.sh → /branches/ErmaC/Modules/package/Scripts.templates/InstallerLog/InstallLog.sh
A/branches/ErmaC/Modules/package/Scripts.templates
A/branches/ErmaC/Trunk/package/Scripts.templates/Post
A/branches/ErmaC/Trunk/package/Scripts.templates/Pre
A/branches/ErmaC/Modules/package/Scripts.templates/InstallerLog
A/branches/ErmaC/Modules/package/Scripts.templates/Pre
A/branches/ErmaC/Modules/package/Scripts.templates/Post
A/branches/ErmaC/Trunk/package/Scripts.templates/InstallerLog
A/branches/ErmaC/Trunk/package/Scripts.templates
M/branches/ErmaC/Modules/package/Resources/zh_CN.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Trunk/package/Resources/ko.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Trunk/package/Resources/it.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Modules/package/Resources/mk.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Modules/package/Resources/es.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Trunk/package/Resources/bg.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Modules/package/Resources/sr.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Trunk/package/Resources/ja.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Trunk/package/Resources/zh_TW.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Modules/package/Resources/de.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Modules/package/Resources/he.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Trunk/package/Resources/bs.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Trunk/package/Resources/pt-PT.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Trunk/package/Resources/hr.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Trunk/package/Resources/pl.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Modules/package/Resources/fr.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Modules/package/Resources/nl.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Trunk/package/Resources/ru.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Modules/package/Resources/zh_TW.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Modules/package/Resources/id.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Modules/package/Resources/el.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Trunk/package/Resources/es.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Modules/package/Resources/ar.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Modules/package/Resources/en.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Trunk/package/Resources/mk.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Modules/package/Resources/pt-PT.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Modules/package/Resources/ko.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Modules/package/Resources/it.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Trunk/package/Resources/pt-BR.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Trunk/package/Resources/sr.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Trunk/package/Resources/de.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Trunk/package/Resources/he.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Modules/package/Resources/bg.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Modules/package/buildpkg.sh
M/branches/ErmaC/Modules/package/Resources/ja.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Trunk/package/Resources/zh_CN.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Trunk/package/Resources/fr.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Trunk/package/Resources/nl.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Modules/package/Resources/bs.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Modules/package/Resources/hr.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Modules/package/Resources/pl.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Trunk/package/buildpkg.sh
M/branches/ErmaC/Modules/package/Resources/pt-BR.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Modules/package/Resources/ru.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Trunk/package/Resources/id.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Trunk/package/Resources/el.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Trunk/package/Resources/en.lproj/Conclusion.rtfd/TXT.rtf
M/branches/ErmaC/Trunk/package/Resources/ar.lproj/Conclusion.rtfd/TXT.rtf

File differences

branches/ErmaC/Trunk/package/Scripts.templates/InstallerLog/InstallLog.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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
branches/ErmaC/Trunk/package/Scripts.templates/Post/postinstall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
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 ""
branches/ErmaC/Trunk/package/Scripts.templates/Pre/preinstall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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
branches/ErmaC/Trunk/package/Scripts/Main/postinstall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
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 ""
branches/ErmaC/Trunk/package/Scripts/Main/preinstall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/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
branches/ErmaC/Trunk/package/Scripts/Sub/InstallLog.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/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
branches/ErmaC/Trunk/package/Resources/ja.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Trunk/package/Resources/he.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Trunk/package/Resources/bs.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Trunk/package/Resources/fr.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Trunk/package/Resources/nl.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Trunk/package/Resources/hr.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Trunk/package/Resources/pl.lproj/Conclusion.rtfd/TXT.rtf
77
88
99
10
10
1111
1212
1313
\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 ,\
branches/ErmaC/Trunk/package/Resources/pt-BR.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Trunk/package/Resources/ru.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Trunk/package/Resources/zh_TW.lproj/Conclusion.rtfd/TXT.rtf
1313
1414
1515
16
16
1717
1818
1919
\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 \
\
branches/ErmaC/Trunk/package/Resources/id.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Trunk/package/Resources/el.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Trunk/package/Resources/zh_CN.lproj/Conclusion.rtfd/TXT.rtf
1313
1414
1515
16
16
1717
1818
1919
\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 \
\
branches/ErmaC/Trunk/package/Resources/en.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Trunk/package/Resources/ar.lproj/Conclusion.rtfd/TXT.rtf
1414
1515
1616
17
17
1818
1919
2020
\f0 \
\f1 \'de\'cf
\f0 \cf2 Chameleon_Installer_Log.txt\cf3
\f0 \cf2 @LOG_FILENAME@\cf3
\f1 \'ed\'d3\'e3\'ec
\f0 \
branches/ErmaC/Trunk/package/Resources/pt-PT.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Trunk/package/Resources/es.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Trunk/package/Resources/mk.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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 \
branches/ErmaC/Trunk/package/Resources/ko.lproj/Conclusion.rtfd/TXT.rtf
1313
1414
1515
16
16
1717
1818
1919
\'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 \
\
branches/ErmaC/Trunk/package/Resources/it.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Trunk/package/Resources/sr.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Trunk/package/Resources/bg.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Trunk/package/Resources/de.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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 \
branches/ErmaC/Trunk/package/buildpkg.sh
99
1010
1111
12
1213
1314
1415
......
4445
4546
4647
47
48
4849
4950
50
51
52
53
51
52
53
54
5455
55
56
57
56
57
58
5859
5960
6061
61
62
63
64
62
63
64
65
6566
6667
68
69
6770
6871
6972
......
9497
9598
9699
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
97228
98229
99230
......
267398
268399
269400
270
271
272
273
274
401
275402
276403
277
404
278405
279406
280407
......
297424
298425
299426
300
427
301428
302429
303430
......
312439
313440
314441
315
442
316443
317444
318445
......
322449
323450
324451
325
452
326453
327454
328455
......
336463
337464
338465
466
339467
340468
341469
342470
343471
344
472
345473
346474
347475
......
349477
350478
351479
480
352481
353482
354483
355484
356485
357
486
358487
359488
360489
......
363492
364493
365494
366
495
367496
368497
369498
......
532661
533662
534663
535
664
536665
537666
538667
......
569698
570699
571700
572
701
573702
574703
575704
......
590719
591720
592721
593
722
594723
595724
596
725
597726
598727
599728
......
603732
604733
605734
606
607
608
735
609736
610
611
612737
613738
614
739
615740
616741
617742
......
647772
648773
649774
650
775
651776
652777
653778
......
680805
681806
682807
683
808
684809
685810
686811
......
753878
754879
755880
756
881
757882
758883
759884
......
793918
794919
795920
796
797
798
921
922
799923
800
801
802
803
804
805
806
807
808
809
810
811924
812925
813926
......
836949
837950
838951
839
840
841
842
952
953
954
955
843956
844957
845958
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
# ====== 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
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=<substition> : add a new substitution
# --subst <substition> : 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=<pkg_rootdir> : path of the pkg root dir
#
# Optionnal arguments:
# --subst=<substition> : add a new substitution
# --subst <substition> : 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:]
}
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
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
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
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
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
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
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
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}"
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}')" \
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
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
#[ "${3}" == "relocatable" ] && header+="relocatable=\"true\" "
header+="identifier=\"${packageRefId}\" "
header+="version=\"${version}\" "
header+="version=\"${CHAMELEON_VERSION}\" "
[ "${targetPath}" != "relocatable" ] && header+="install-location=\"${targetPath}\" "
(cd "${packagePath}/Temp" && xar -c -f "${packagePath}/../${packageName}.pkg" --compression none .)
# Add the package to the list of build packages
pkgrefs[${#pkgrefs[*]}]="\t<pkg-ref id=\"${packageRefId}\" installKBytes='${installedsize}' version='${version}.0.0.${timestamp}'>#${packageName}.pkg</pkg-ref>"
pkgrefs[${#pkgrefs[*]}]="\t<pkg-ref id=\"${packageRefId}\" installKBytes='${installedsize}' version='${CHAMELEON_VERSION}.0.0.${CHAMELEON_TIMESTAMP}'>#${packageName}.pkg</pkg-ref>"
rm -rf "${packagePath}"
fi
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
# 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}"
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 ""
}
branches/ErmaC/Modules/package/Scripts.templates/InstallerLog/InstallLog.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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
branches/ErmaC/Modules/package/Scripts.templates/Post/postinstall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
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 ""
branches/ErmaC/Modules/package/Scripts.templates/Pre/preinstall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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
branches/ErmaC/Modules/package/Scripts/Main/postinstall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
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 ""
branches/ErmaC/Modules/package/Scripts/Main/preinstall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/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
branches/ErmaC/Modules/package/Scripts/Sub/InstallLog.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/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
branches/ErmaC/Modules/package/Resources/ja.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Modules/package/Resources/he.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Modules/package/Resources/bs.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Modules/package/Resources/fr.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Modules/package/Resources/nl.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Modules/package/Resources/hr.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Modules/package/Resources/pl.lproj/Conclusion.rtfd/TXT.rtf
77
88
99
10
10
1111
1212
1313
\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 ,\
branches/ErmaC/Modules/package/Resources/pt-BR.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Modules/package/Resources/ru.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Modules/package/Resources/zh_TW.lproj/Conclusion.rtfd/TXT.rtf
1313
1414
1515
16
16
1717
1818
1919
\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 \
\
branches/ErmaC/Modules/package/Resources/id.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Modules/package/Resources/el.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Modules/package/Resources/zh_CN.lproj/Conclusion.rtfd/TXT.rtf
1313
1414
1515
16
16
1717
1818
1919
\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 \
\
branches/ErmaC/Modules/package/Resources/en.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Modules/package/Resources/ar.lproj/Conclusion.rtfd/TXT.rtf
1414
1515
1616
17
17
1818
1919
2020
\f0 \
\f1 \'de\'cf
\f0 \cf2 Chameleon_Installer_Log.txt\cf3
\f0 \cf2 @LOG_FILENAME@\cf3
\f1 \'ed\'d3\'e3\'ec
\f0 \
branches/ErmaC/Modules/package/Resources/pt-PT.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Modules/package/Resources/es.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Modules/package/Resources/mk.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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 \
branches/ErmaC/Modules/package/Resources/ko.lproj/Conclusion.rtfd/TXT.rtf
1313
1414
1515
16
16
1717
1818
1919
\'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 \
\
branches/ErmaC/Modules/package/Resources/it.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Modules/package/Resources/sr.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Modules/package/Resources/bg.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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\
branches/ErmaC/Modules/package/Resources/de.lproj/Conclusion.rtfd/TXT.rtf
88
99
1010
11
11
1212
1313
1414
\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 \
branches/ErmaC/Modules/package/buildpkg.sh
99
1010
1111
12
1213
1314
1415
......
4849
4950
5051
51
52
5253
5354
54
55
56
57
55
56
57
58
5859
59
60
61
60
61
62
6263
6364
6465
65
66
67
68
66
67
68
69
6970
7071
72
73
7174
7275
7376
......
98101
99102
100103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
101232
102233
103234
......
271402
272403
273404
274
275
276
277
278
405
279406
280407
281
408
282409
283410
284411
......
301428
302429
303430
304
431
305432
306433
307434
......
316443
317444
318445
319
446
320447
321448
322449
......
326453
327454
328455
329
456
330457
331458
332459
......
340467
341468
342469
470
343471
344472
345473
346474
347475
348
476
349477
350478
351479
......
353481
354482
355483
484
356485
357486
358487
359488
360489
361
490
362491
363492
364493
......
367496
368497
369498
370
499
371500
372501
373502
......
604733
605734
606735
607
736
608737
609738
610739
......
641770
642771
643772
644
773
645774
646775
647776
......
662791
663792
664793
665
794
666795
667796
668
797
669798
670799
671800
......
675804
676805
677806
678
679
680
807
681808
682
683
684809
685810
686
811
687812
688813
689814
......
719844
720845
721846
722
847
723848
724849
725850
......
752877
753878
754879
755
880
756881
757882
758883
......
825950
826951
827952
828
953
829954
830955
831956
......
865990
866991
867992
868
869
870
993
994
871995
872
873
874
875
876
877
878
879
880
881
882
883996
884997
885998
......
9081021
9091022
9101023
911
912
913
914
1024
1025
1026
1027
9151028
9161029
9171030
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
# ====== 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
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=<substition> : add a new substitution
# --subst <substition> : 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=<pkg_rootdir> : path of the pkg root dir
#
# Optionnal arguments:
# --subst=<substition> : add a new substitution
# --subst <substition> : 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:]
}
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
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
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
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
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
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
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
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}"
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}')" \
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
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
#[ "${3}" == "relocatable" ] && header+="relocatable=\"true\" "
header+="identifier=\"${packageRefId}\" "
header+="version=\"${version}\" "
header+="version=\"${CHAMELEON_VERSION}\" "
[ "${targetPath}" != "relocatable" ] && header+="install-location=\"${targetPath}\" "
(cd "${packagePath}/Temp" && xar -c -f "${packagePath}/../${packageName}.pkg" --compression none .)
# Add the package to the list of build packages
pkgrefs[${#pkgrefs[*]}]="\t<pkg-ref id=\"${packageRefId}\" installKBytes='${installedsize}' version='${version}.0.0.${timestamp}'>#${packageName}.pkg</pkg-ref>"
pkgrefs[${#pkgrefs[*]}]="\t<pkg-ref id=\"${packageRefId}\" installKBytes='${installedsize}' version='${CHAMELEON_VERSION}.0.0.${CHAMELEON_TIMESTAMP}'>#${packageName}.pkg</pkg-ref>"
rm -rf "${packagePath}"
fi
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
# 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}"
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 ""
}

Archive Download the corresponding diff file

Revision: 1778