Chameleon Applications

Chameleon Applications Commit Details

Date:2010-09-24 14:35:20 (13 years 5 months ago)
Author:blackosx
Commit:133
Parents: 132
Message:Adding more Scripts
Changes:
A/trunk/PackageBuilder/Scripts/Resolutions/1280x960x32
A/trunk/PackageBuilder/Scripts/Resolutions/1600x900x32/postinstall
A/trunk/PackageBuilder/Scripts/Resolutions/1024x768x32
A/trunk/PackageBuilder/Scripts/Resolutions/1920x1200x32
A/trunk/PackageBuilder/Scripts/Resolutions/1280x1024x32
A/trunk/PackageBuilder/Scripts/Standard/postinstall
A/trunk/PackageBuilder/Scripts/Standardhfs/postinstall
A/trunk/PackageBuilder/Scripts/Resolutions/1920x1080x32
A/trunk/PackageBuilder/Scripts/Resolutions/1680x1050x32
A/trunk/PackageBuilder/Scripts/Resolutions/1280x960x32/postinstall
A/trunk/PackageBuilder/Scripts/Resolutions/1024x768x32/postinstall
A/trunk/PackageBuilder/Scripts/Resolutions/1920x1200x32/postinstall
A/trunk/PackageBuilder/Scripts/Post
A/trunk/PackageBuilder/Scripts/Resolutions
A/trunk/PackageBuilder/Scripts/Resolutions/1280x1024x32/postinstall
A/trunk/PackageBuilder/Scripts/Resolutions/1600x900x32
A/trunk/PackageBuilder/Scripts/Resolutions/1680x1050x32/postinstall
A/trunk/PackageBuilder/Scripts/Resolutions/1920x1080x32/postinstall
A/trunk/PackageBuilder/Scripts/Standard
A/trunk/PackageBuilder/Scripts/Post/postinstall
A/trunk/PackageBuilder/Scripts/Standardhfs

File differences

trunk/PackageBuilder/Scripts/Standard/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
#!/bin/bash
diskloader="boot0"
partitionloader="boot1h"
filesystemloader="boot"
diskmicrocodetype[1]="GRUB,47525542"
diskmicrocodetype[2]="LILO,4c494c4f"
start ()
{
# 1 volume
bootvolume="${@}"
echo "Volume is $bootvolume"
bootresources="${0%/*}"
echo "$bootresources"
if [ -z "${bootvolume}" ]; then
echo
echo "Cannot find the volume. Exiting."
echo
exit
fi
bootdev=$( df "${bootvolume}" | sed -n '2p' | awk '{print $1}' )
bootrdev=${bootdev/disk/rdisk}
if [ "${bootdev}" = "${bootdev#*disk*s}" ]; then
echo
echo "ERROR Volume does not use slices."
echo
exit
fi
bootdisk=${bootdev%s*}
bootrdisk=${bootdisk/disk/rdisk}
bootslice=${bootdev#*disk*s}
echo "Volume is ${bootvolume}"
echo "Volume device is ${bootdev}"
echo "Volume raw device is ${bootrdev}"
echo "Volume slice is ${bootslice}"
echo "Disk device is ${bootdisk}"
echo "Disk raw device is ${bootrdisk}"
echo "Disk loader is ${diskloader}"
echo "Partition loader is ${partitionloader}"
echo "Filesystem loader is ${filesystemloader}"
echo "Boot Resources is ${bootresources}"
}
checkdiskmicrocodetype ()
{
diskmicrocode=$( dd 2>/dev/null if=${bootdisk} count=1 | dd 2>/dev/null count=1 bs=437 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )
diskmicrocodetypecounter=0
while [ ${diskmicrocodetypecounter} -lt ${#diskmicrocodetype[@]} ]; do
diskmicrocodetypecounter=$(( ${diskmicrocodetypecounter} + 1 ))
diskmicrocodetypeid=${diskmicrocodetype[${diskmicrocodetypecounter}]#*,}
if [ ! "${diskmicrocode}" = "${diskmicrocode/${diskmicrocodetypeid}/}" ]; then
echo "${diskmicrocodetype[${diskmicrocodetypecounter}]%,*} found."
fi
done
}
checkdiskmicrocode ()
{
# 1 action ( check or set )
diskmicrocode=$( dd 2>/dev/null if=${bootdisk} count=1 | dd 2>/dev/null count=1 bs=437 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )
diskmicrocodemd5=$( dd 2>/dev/null if=${bootdisk} count=1 | dd 2>/dev/null count=1 bs=437 | md5 )
if [ $( echo "${diskmicrocode}" | awk -F0 '{print NF-1}' ) = 874 ]; then
if [ "${1}" = "set" ]; then
echo "No disk microcode found. Updating."
diskupdate=true
else
echo "No disk microcode found."
fi
else
if [ ${1} = set ]; then
echo "Disk microcode found. Preserving."
else
echo "Disk microcode found."
fi
echo "Disk microcode MD5 is ${diskmicrocodemd5}"
fi
}
checkdisksignature ()
{
disksignature=$( dd 2>/dev/null if=${bootdisk} count=1 | dd 2>/dev/null count=4 bs=1 skip=440 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )
if [ $( echo "${disksignature}" | awk -F0 '{print NF-1}' ) = 8 ]; then
echo "No disk signature found."
else
echo "Disk signature found."
echo "Disk signature is 0x${disksignature}"
fi
}
checkpartitionbootcode ()
{
# 1 action ( check or set )
partitionbootcode=$( dd if=${bootrdev} count=1 2>/dev/null | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )
partitionbootcodeextended=$( dd if=${bootrdev} count=1 skip=1 2>/dev/null | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )
if [ $( echo "${partitionbootcode}" | awk -F0 '{print NF-1}' ) = 1024 ]; then
if [ "${1}" = "set" ]; then
echo "No partition bootcode found. Updating."
else
echo "No partition bootcode found."
fi
else
if [ "${1}" = "set" ]; then
echo "Partition bootcode found. Overwriting."
else
echo "Partition bootcode found."
fi
if [ $( echo "${partitionbootcodeextended}" | awk -F0 '{print NF-1}' ) = 1024 ]; then
partitionbootcodemd5=$( dd 2>/dev/null if=${bootrdev} count=1 | md5 )
else
partitionbootcodemd5=$( dd 2>/dev/null if=${bootrdev} count=2 | md5 )
echo "Partition bootcode is dual sector."
fi
echo "Partition bootcode MD5 is ${partitionbootcodemd5}"
fi
}
checkpartitionactive ()
{
partitionactive=$( fdisk440 -d ${bootrdisk} | grep -n "*" | awk -F: '{print $1}')
if [ -n "${partitionactive}" ]; then
echo "Partition flagged active is ${partitionactive}"
else
echo "No partition flagged active."
fi
}
start ${3}
#partitiontable=$( diskutil list ${bootdisk} | sed -n '3p' | awk '{print $2}' )
#[ "${partitiontable}" = "GUID_partition_scheme" ] && echo "GPT found."
#[ "${partitiontable}" = "FDisk_partition_scheme" ] && echo "MBR found."
#[ "${partitiontable}" = "Apple_partition_scheme" ] && echo "APT found." && exit
partitiontable=$( dd 2>/dev/null if=${bootdisk} count=1 skip=1 | dd 2>/dev/null count=8 bs=1 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )
if [ "${partitiontable:0:16}" == "4546492050415254" ]; then
partitiontable=$( dd 2>/dev/null if=${bootdisk} count=1 | dd 2>/dev/null count=64 bs=1 skip=446 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )
if [ "${partitiontable:8:2}" == "ee" ]; then
if [ "${partitiontable:40:2}" == "00" ] && [ "${partitiontable:72:2}" == "00" ] && [ "${partitiontable:104:2}" == "00" ]; then
partitiontable="GPT"
else
partitiontable="GPT/MBR"
fi
fi
else
partitiontable="MBR"
fi
echo "${partitiontable} found."
diskupdate=false
checkdiskmicrocodetype
checkdiskmicrocode set
checkdisksignature
checkpartitionbootcode set
checkpartitionactive
if ${diskupdate}; then
echo "Executing command: fdisk -u -f /usr/standalone/i386/${diskloader} -y ${bootdisk}"
fdisk -u -f "${bootvolume}/usr/standalone/i386/${diskloader}" -y ${bootdisk}
fi
echo "Executing command: dd if=/usr/standalone/i386/${partitionloader} of=${bootrdev}"
dd if="${bootvolume}/usr/standalone/i386/${partitionloader}" of=${bootrdev}
echo "Executing command: cp /usr/standalone/i386/${filesystemloader} ${bootvolume}"
cp "${bootvolume}/usr/standalone/i386/${filesystemloader}" "${bootvolume}"
echo "Executing command: ${bootresources}/Tools/SetFile -a V ${bootvolume}/${filesystemloader}"
"${bootresources}/Tools/SetFile" -a V "${bootvolume}/${filesystemloader}"
# If table is GPT make the first partition active (BadAxe compatibility).
#[ "${partitiontable}" = "GPT" ] && bootslice=1
fdisk440 -e ${bootdisk} <<-MAKEACTIVE
print
flag ${bootslice}
write
y
quit
MAKEACTIVE
checkdiskmicrocode check
checkdisksignature
checkpartitionbootcode check
checkpartitionactive
# Check efi partition
if [ -d /Volumes/EFI ]; then
umount -f /Volumes/EFI
rm -R -f /Volumes/EFI
fi
if [ -d "${bootvolume}/Extra/Extensions" ]; then
#echo "Executing command: mkdir -p ${bootvolume}/Extra/Extensions"
mkdir -p "${bootvolume}/ExtraBackup"
cp -f -R "${bootvolume}/Extra" "${bootvolume}/ExtraBackup"
rm -f -R "${bootvolume}/Extra"
fi
# unpack any existing Extensions.mkext already on the booter volume
if [ -f "${2}/ExtraBackup/Extensions.mkext" ]; then
echo "Executing command: mkextunpack -d ${2}/Extra/Extensions ${2}/ExtraBackup/Extensions.mkext"
mkextunpack -d "${2}/.Chameleon/Extra/Extensions" "${2}/.Chameleon/ExtraBackup/Extensions.mkext"
echo "Executing command: rm -R -f ${2}/ExtraBackup/Extensions.mkext"
rm -R -f "${2}/ExtraBackup/Extensions.mkext"
fi
# setup link for extras
#[ -h "${2}/.Chameleon" ] && unlink "${2}/.Chameleon"
#echo "Executing command: ln -s . ${2}/.Chameleon"
#ln -s "${2}" "${2}/.Chameleon"
exit
trunk/PackageBuilder/Scripts/Standardhfs/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
#!/bin/bash
diskloader="boot0hfs"
partitionloader="boot1h"
filesystemloader="boot"
diskmicrocodetype[1]="GRUB,47525542"
diskmicrocodetype[2]="LILO,4c494c4f"
start ()
{
# 1 volume
bootvolume="${@}"
echo "Volume is $bootvolume"
bootresources="${0%/*}"
echo "$bootresources"
if [ -z "${bootvolume}" ]; then
echo
echo "Cannot find the volume. Exiting."
echo
exit
fi
bootdev=$( df "${bootvolume}" | sed -n '2p' | awk '{print $1}' )
bootrdev=${bootdev/disk/rdisk}
if [ "${bootdev}" = "${bootdev#*disk*s}" ]; then
echo
echo "ERROR Volume does not use slices."
echo
exit
fi
bootdisk=${bootdev%s*}
bootrdisk=${bootdisk/disk/rdisk}
bootslice=${bootdev#*disk*s}
echo "Volume is ${bootvolume}"
echo "Volume device is ${bootdev}"
echo "Volume raw device is ${bootrdev}"
echo "Volume slice is ${bootslice}"
echo "Disk device is ${bootdisk}"
echo "Disk raw device is ${bootrdisk}"
echo "Disk loader is ${diskloader}"
echo "Partition loader is ${partitionloader}"
echo "Filesystem loader is ${filesystemloader}"
echo "Boot Resources is ${bootresources}"
}
checkdiskmicrocodetype ()
{
diskmicrocode=$( dd 2>/dev/null if=${bootdisk} count=1 | dd 2>/dev/null count=1 bs=437 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )
diskmicrocodetypecounter=0
while [ ${diskmicrocodetypecounter} -lt ${#diskmicrocodetype[@]} ]; do
diskmicrocodetypecounter=$(( ${diskmicrocodetypecounter} + 1 ))
diskmicrocodetypeid=${diskmicrocodetype[${diskmicrocodetypecounter}]#*,}
if [ ! "${diskmicrocode}" = "${diskmicrocode/${diskmicrocodetypeid}/}" ]; then
echo "${diskmicrocodetype[${diskmicrocodetypecounter}]%,*} found."
fi
done
}
checkdiskmicrocode ()
{
# 1 action ( check or set )
diskmicrocode=$( dd 2>/dev/null if=${bootdisk} count=1 | dd 2>/dev/null count=1 bs=437 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )
diskmicrocodemd5=$( dd 2>/dev/null if=${bootdisk} count=1 | dd 2>/dev/null count=1 bs=437 | md5 )
if [ $( echo "${diskmicrocode}" | awk -F0 '{print NF-1}' ) = 874 ]; then
if [ "${1}" = "set" ]; then
echo "No disk microcode found. Updating."
diskupdate=true
else
echo "No disk microcode found."
fi
else
if [ ${1} = set ]; then
echo "Disk microcode found. Preserving."
else
echo "Disk microcode found."
fi
echo "Disk microcode MD5 is ${diskmicrocodemd5}"
fi
}
checkdisksignature ()
{
disksignature=$( dd 2>/dev/null if=${bootdisk} count=1 | dd 2>/dev/null count=4 bs=1 skip=440 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )
if [ $( echo "${disksignature}" | awk -F0 '{print NF-1}' ) = 8 ]; then
echo "No disk signature found."
else
echo "Disk signature found."
echo "Disk signature is 0x${disksignature}"
fi
}
checkpartitionbootcode ()
{
# 1 action ( check or set )
partitionbootcode=$( dd if=${bootrdev} count=1 2>/dev/null | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )
partitionbootcodeextended=$( dd if=${bootrdev} count=1 skip=1 2>/dev/null | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )
if [ $( echo "${partitionbootcode}" | awk -F0 '{print NF-1}' ) = 1024 ]; then
if [ "${1}" = "set" ]; then
echo "No partition bootcode found. Updating."
else
echo "No partition bootcode found."
fi
else
if [ "${1}" = "set" ]; then
echo "Partition bootcode found. Overwriting."
else
echo "Partition bootcode found."
fi
if [ $( echo "${partitionbootcodeextended}" | awk -F0 '{print NF-1}' ) = 1024 ]; then
partitionbootcodemd5=$( dd 2>/dev/null if=${bootrdev} count=1 | md5 )
else
partitionbootcodemd5=$( dd 2>/dev/null if=${bootrdev} count=2 | md5 )
echo "Partition bootcode is dual sector."
fi
echo "Partition bootcode MD5 is ${partitionbootcodemd5}"
fi
}
checkpartitionactive ()
{
partitionactive=$( fdisk440 -d ${bootrdisk} | grep -n "*" | awk -F: '{print $1}')
if [ -n "${partitionactive}" ]; then
echo "Partition flagged active is ${partitionactive}"
else
echo "No partition flagged active."
fi
}
start ${3}
#partitiontable=$( diskutil list ${bootdisk} | sed -n '3p' | awk '{print $2}' )
#[ "${partitiontable}" = "GUID_partition_scheme" ] && echo "GPT found."
#[ "${partitiontable}" = "FDisk_partition_scheme" ] && echo "MBR found."
#[ "${partitiontable}" = "Apple_partition_scheme" ] && echo "APT found." && exit
partitiontable=$( dd 2>/dev/null if=${bootdisk} count=1 skip=1 | dd 2>/dev/null count=8 bs=1 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )
if [ "${partitiontable:0:16}" == "4546492050415254" ]; then
partitiontable=$( dd 2>/dev/null if=${bootdisk} count=1 | dd 2>/dev/null count=64 bs=1 skip=446 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )
if [ "${partitiontable:8:2}" == "ee" ]; then
if [ "${partitiontable:40:2}" == "00" ] && [ "${partitiontable:72:2}" == "00" ] && [ "${partitiontable:104:2}" == "00" ]; then
partitiontable="GPT"
else
partitiontable="GPT/MBR"
fi
fi
else
partitiontable="MBR"
fi
echo "${partitiontable} found."
diskupdate=false
checkdiskmicrocodetype
checkdiskmicrocode set
checkdisksignature
checkpartitionbootcode set
checkpartitionactive
if ${diskupdate}; then
echo "Executing command: fdisk -u -f /usr/standalone/i386/${diskloader} -y ${bootdisk}"
fdisk -u -f "${bootvolume}/usr/standalone/i386/${diskloader}" -y ${bootdisk}
fi
echo "Executing command: dd if=/usr/standalone/i386/${partitionloader} of=${bootrdev}"
dd if="${bootvolume}/usr/standalone/i386/${partitionloader}" of=${bootrdev}
echo "Executing command: cp /usr/standalone/i386/${filesystemloader} ${bootvolume}"
cp "${bootvolume}/usr/standalone/i386/${filesystemloader}" "${bootvolume}"
echo "Executing command: ${bootresources}/Tools/SetFile -a V ${bootvolume}/${filesystemloader}"
"${bootresources}/Tools/SetFile" -a V "${bootvolume}/${filesystemloader}"
# If table is GPT make the first partition active (BadAxe compatibility).
[ "${partitiontable}" = "GPT" ] && bootslice=1
fdisk440 -e ${bootdisk} <<-MAKEACTIVE
print
flag ${bootslice}
write
y
quit
MAKEACTIVE
checkdiskmicrocode check
checkdisksignature
checkpartitionbootcode check
checkpartitionactive
# Check efi partition
if [ -d /Volumes/EFI ]; then
umount -f /Volumes/EFI
rm -R -f /Volumes/EFI
fi
if ! [ -d "${bootvolume}/Extra/Extensions" ]; then
#echo "Executing command: mkdir -p ${bootvolume}/Extra/Extensions"
mkdir -p "${bootvolume}/ExtraBackup"
cp -f -R "${bootvolume}/Extra" "${bootvolume}/ExtraBackup"
rm -f -R "${bootvolume}/Extra"
fi
# unpack any existing Extensions.mkext already on the booter volume
if [ -f "${2}/ExtraBackup/Extensions.mkext" ]; then
echo "Executing command: mkextunpack -d ${2}/Extra/Extensions ${2}/ExtraBackup/Extensions.mkext"
mkextunpack -d "${2}/.Chameleon/Extra/Extensions" "${2}/.Chameleon/ExtraBackup/Extensions.mkext"
echo "Executing command: rm -R -f ${2}/ExtraBackup/Extensions.mkext"
rm -R -f "${2}/ExtraBackup/Extensions.mkext"
fi
# setup link for extras
#[ -h "${2}/.Chameleon" ] && unlink "${2}/.Chameleon"
#echo "Executing command: ln -s . ${2}/.Chameleon"
#ln -s "${2}" "${2}/.Chameleon"
exit
trunk/PackageBuilder/Scripts/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
#!/bin/bash
temp="/private/tmp/Chameleon"
#source com.apple.boot.plist
if ! [ -f "${2}/.Chameleon/Extra/com.apple.Boot.plist" ]; then
if [ -f "${2}/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" ]; then
cp -f "${2}/Library/Preferences/SystemConfiguration/com.apple.Boot.plist" "${2}/.Chameleon/Extra"
fi
fi
# fix kext permissions
find "${2}/.Chameleon/Extra/Extensions" -type f -exec chmod 644 {} \;
find "${2}/.Chameleon/Extra/Extensions" -type d -exec chmod 755 {} \;
chown -R 0:0 "${2}/.Chameleon/Extra/Extensions"
# build mkext for extras
[ -d "${temp}" ] && rm -R -f "${temp}"
mkdir -p "${temp}/Extensions"
ditto --noextattr --noqtn --arch i386 "${2}/.Chameleon/Extra/Extensions" "${temp}/Extensions"
find "${temp}" -type f -exec chmod 644 {} \;
find "${temp}" -type d -exec chmod 755 {} \;
chown -R 0:0 "${temp}"
kextcache -m "${temp}/Extensions.mkext" "${temp}/Extensions"
cp -f "${temp}/Extensions.mkext" "${2}/.Chameleon/Extra"
#cp -f "${temp}/Extensions.mkext" "${2}/Extra"
rm -f -R "${temp}"
# Check efi partition
if [ -d /Volumes/EFI ]; then
# remove link for extras install
#unlink -r "${2}/.Chameleon"
cp -R -f "${2}/.Chameleon/Extra" /Volumes/EFI/
umount -f /Volumes/EFI
rm -R -f /Volumes/EFI
rm -R -f "${2}/.Chameleon"
fi
cp -R -f "${2}/.Chameleon/Extra" "${2}/"
rm -R -f "${2}/.Chameleon"
exit 0
trunk/PackageBuilder/Scripts/Resolutions/1024x768x32/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
#!/bin/bash
# set com.apple.Boot.plist options
overide="Graphics Mode"
string="1024x768x32"
main ()
{
bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist"
systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist"
bootoptionshdextra[1]="<key>${overide}</key>"
bootoptionshdextra[2]="<string>${string}</string>"
[ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}"
if [ ! -f "${bootplist}" ]; then
if [ -f "${systemplist}" ]; then
cp "${systemplist}" "${bootplist}"
fi
fi
xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" )
case "${xmlvalue:0:1}" in
y)echo "${overide}=y already set in ${bootplist} skipping."
;;
n)echo "${overide}=n is set in ${bootplist} leaving."
;;
*)echo "Adding ${overide}=${string} to ${bootplist}"
array=("${bootoptionshdextra[@]}")
searchfilereplaceline "${bootplist}" "<key>Kernel Flags</key>" "" "" "2"
;;
esac
chown "${USER}:20" "${bootplist}"
}
getxmlvalue ()
{
# 1 xml key
# 2 xml file
if [ -f "${2}" ]; then
local value
while read value; do
if [ ! "${value}" = "${value/<key>${1}</key>/}" ]; then
read value
value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}"
echo "$value"
break
fi
done < "${2}"
fi
}
searchfilereplaceline ()
{
mv "${1}" "${1}.orig"
prefunctionifs="${IFS}"
unset fileinput
unset fileoutput
unset find
unset replace
unset deletelines
unset deletelinesskip
unset insertlinesskip
fileinput="${1}.orig"
fileoutput="${1}"
find="${2}"
replace="${3}"
deletelines="${4%,*}"
insertlinesskip="${5}"
matchlinefound="0"
if [ "${#4}" = "${4#*,}" ]; then
deletelinesskip="0"
else
deletelinesskip="${4#*,}"
fi
IFS="\n"
while read line
do
{
if [ ! "${line}" = "${line/${find}/}" ]; then
{
# Trim the longest match from the end for <*
xmlelementindent="${line%%<*}"
# Trim the longest match from the start for *<
xmlelementtemp="${line#*<}"
# Add back in stripped <
xmlelement="<${xmlelementtemp}"
# Trim the shortest match from the start for <
xmltagtemp="${xmlelement#<}"
# Trim the longest match from the end for >*
xmltag="${xmltagtemp%%>*}"
# Trim the shortest match from the start for *>
xmltexttemp="${xmlelement#*>}"
# Trim the longest match from the end for <*
xmltext="${xmltexttemp%%<*}"
if [ "${replace}" ]; then
{
echo "${xmlelementindent}<${xmltag}>${replace}</${xmltag}>" >>"${fileoutput}"
}
else
{
echo "${line}" >>"${fileoutput}"
}
fi
matchlinefound="1"
}
else
{
if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then
{
if [ "${matchlinefound}" = "${insertlinesskip}" ]; then
{
arraysize=0
while [ ${arraysize} -lt ${#array[@]} ];
do
echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}"
let arraysize="${arraysize}+1"
done
}
fi
}
fi
if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then
{
:
}
else
{
echo "${line}" >>"${fileoutput}"
}
fi
if [ "${matchlinefound}" -gt 0 ]; then
let matchlinefound="${matchlinefound}+1"
fi
}
fi
}
done < "${fileinput}"
IFS=${prefunctionifs}
rm -f "${fileinput}"
}
main "${1}" "${2}" "${3}" "${4}"
trunk/PackageBuilder/Scripts/Resolutions/1920x1200x32/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
#!/bin/bash
# set com.apple.Boot.plist options
overide="Graphics Mode"
string="1920x1200x32"
main ()
{
bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist"
systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist"
bootoptionshdextra[1]="<key>${overide}</key>"
bootoptionshdextra[2]="<string>${string}</string>"
[ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}"
if [ ! -f "${bootplist}" ]; then
if [ -f "${systemplist}" ]; then
cp "${systemplist}" "${bootplist}"
fi
fi
xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" )
case "${xmlvalue:0:1}" in
y)echo "${overide}=y already set in ${bootplist} skipping."
;;
n)echo "${overide}=n is set in ${bootplist} leaving."
;;
*)echo "Adding ${overide}=${string} to ${bootplist}"
array=("${bootoptionshdextra[@]}")
searchfilereplaceline "${bootplist}" "<key>Kernel Flags</key>" "" "" "2"
;;
esac
chown "${USER}:20" "${bootplist}"
}
getxmlvalue ()
{
# 1 xml key
# 2 xml file
if [ -f "${2}" ]; then
local value
while read value; do
if [ ! "${value}" = "${value/<key>${1}</key>/}" ]; then
read value
value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}"
echo "$value"
break
fi
done < "${2}"
fi
}
searchfilereplaceline ()
{
mv "${1}" "${1}.orig"
prefunctionifs="${IFS}"
unset fileinput
unset fileoutput
unset find
unset replace
unset deletelines
unset deletelinesskip
unset insertlinesskip
fileinput="${1}.orig"
fileoutput="${1}"
find="${2}"
replace="${3}"
deletelines="${4%,*}"
insertlinesskip="${5}"
matchlinefound="0"
if [ "${#4}" = "${4#*,}" ]; then
deletelinesskip="0"
else
deletelinesskip="${4#*,}"
fi
IFS="\n"
while read line
do
{
if [ ! "${line}" = "${line/${find}/}" ]; then
{
# Trim the longest match from the end for <*
xmlelementindent="${line%%<*}"
# Trim the longest match from the start for *<
xmlelementtemp="${line#*<}"
# Add back in stripped <
xmlelement="<${xmlelementtemp}"
# Trim the shortest match from the start for <
xmltagtemp="${xmlelement#<}"
# Trim the longest match from the end for >*
xmltag="${xmltagtemp%%>*}"
# Trim the shortest match from the start for *>
xmltexttemp="${xmlelement#*>}"
# Trim the longest match from the end for <*
xmltext="${xmltexttemp%%<*}"
if [ "${replace}" ]; then
{
echo "${xmlelementindent}<${xmltag}>${replace}</${xmltag}>" >>"${fileoutput}"
}
else
{
echo "${line}" >>"${fileoutput}"
}
fi
matchlinefound="1"
}
else
{
if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then
{
if [ "${matchlinefound}" = "${insertlinesskip}" ]; then
{
arraysize=0
while [ ${arraysize} -lt ${#array[@]} ];
do
echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}"
let arraysize="${arraysize}+1"
done
}
fi
}
fi
if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then
{
:
}
else
{
echo "${line}" >>"${fileoutput}"
}
fi
if [ "${matchlinefound}" -gt 0 ]; then
let matchlinefound="${matchlinefound}+1"
fi
}
fi
}
done < "${fileinput}"
IFS=${prefunctionifs}
rm -f "${fileinput}"
}
main "${1}" "${2}" "${3}" "${4}"
trunk/PackageBuilder/Scripts/Resolutions/1600x900x32/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
#!/bin/bash
# set com.apple.Boot.plist options
overide="Graphics Mode"
string="1600x900x32"
main ()
{
bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist"
systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist"
bootoptionshdextra[1]="<key>${overide}</key>"
bootoptionshdextra[2]="<string>${string}</string>"
[ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}"
if [ ! -f "${bootplist}" ]; then
if [ -f "${systemplist}" ]; then
cp "${systemplist}" "${bootplist}"
fi
fi
xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" )
case "${xmlvalue:0:1}" in
y)echo "${overide}=y already set in ${bootplist} skipping."
;;
n)echo "${overide}=n is set in ${bootplist} leaving."
;;
*)echo "Adding ${overide}=${string} to ${bootplist}"
array=("${bootoptionshdextra[@]}")
searchfilereplaceline "${bootplist}" "<key>Kernel Flags</key>" "" "" "2"
;;
esac
chown "${USER}:20" "${bootplist}"
}
getxmlvalue ()
{
# 1 xml key
# 2 xml file
if [ -f "${2}" ]; then
local value
while read value; do
if [ ! "${value}" = "${value/<key>${1}</key>/}" ]; then
read value
value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}"
echo "$value"
break
fi
done < "${2}"
fi
}
searchfilereplaceline ()
{
mv "${1}" "${1}.orig"
prefunctionifs="${IFS}"
unset fileinput
unset fileoutput
unset find
unset replace
unset deletelines
unset deletelinesskip
unset insertlinesskip
fileinput="${1}.orig"
fileoutput="${1}"
find="${2}"
replace="${3}"
deletelines="${4%,*}"
insertlinesskip="${5}"
matchlinefound="0"
if [ "${#4}" = "${4#*,}" ]; then
deletelinesskip="0"
else
deletelinesskip="${4#*,}"
fi
IFS="\n"
while read line
do
{
if [ ! "${line}" = "${line/${find}/}" ]; then
{
# Trim the longest match from the end for <*
xmlelementindent="${line%%<*}"
# Trim the longest match from the start for *<
xmlelementtemp="${line#*<}"
# Add back in stripped <
xmlelement="<${xmlelementtemp}"
# Trim the shortest match from the start for <
xmltagtemp="${xmlelement#<}"
# Trim the longest match from the end for >*
xmltag="${xmltagtemp%%>*}"
# Trim the shortest match from the start for *>
xmltexttemp="${xmlelement#*>}"
# Trim the longest match from the end for <*
xmltext="${xmltexttemp%%<*}"
if [ "${replace}" ]; then
{
echo "${xmlelementindent}<${xmltag}>${replace}</${xmltag}>" >>"${fileoutput}"
}
else
{
echo "${line}" >>"${fileoutput}"
}
fi
matchlinefound="1"
}
else
{
if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then
{
if [ "${matchlinefound}" = "${insertlinesskip}" ]; then
{
arraysize=0
while [ ${arraysize} -lt ${#array[@]} ];
do
echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}"
let arraysize="${arraysize}+1"
done
}
fi
}
fi
if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then
{
:
}
else
{
echo "${line}" >>"${fileoutput}"
}
fi
if [ "${matchlinefound}" -gt 0 ]; then
let matchlinefound="${matchlinefound}+1"
fi
}
fi
}
done < "${fileinput}"
IFS=${prefunctionifs}
rm -f "${fileinput}"
}
main "${1}" "${2}" "${3}" "${4}"
trunk/PackageBuilder/Scripts/Resolutions/1280x1024x32/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
#!/bin/bash
# set com.apple.Boot.plist options
overide="Graphics Mode"
string="1280x1024x32"
main ()
{
bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist"
systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist"
bootoptionshdextra[1]="<key>${overide}</key>"
bootoptionshdextra[2]="<string>${string}</string>"
[ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}"
if [ ! -f "${bootplist}" ]; then
if [ -f "${systemplist}" ]; then
cp "${systemplist}" "${bootplist}"
fi
fi
xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" )
case "${xmlvalue:0:1}" in
y)echo "${overide}=y already set in ${bootplist} skipping."
;;
n)echo "${overide}=n is set in ${bootplist} leaving."
;;
*)echo "Adding ${overide}=${string} to ${bootplist}"
array=("${bootoptionshdextra[@]}")
searchfilereplaceline "${bootplist}" "<key>Kernel Flags</key>" "" "" "2"
;;
esac
chown "${USER}:20" "${bootplist}"
}
getxmlvalue ()
{
# 1 xml key
# 2 xml file
if [ -f "${2}" ]; then
local value
while read value; do
if [ ! "${value}" = "${value/<key>${1}</key>/}" ]; then
read value
value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}"
echo "$value"
break
fi
done < "${2}"
fi
}
searchfilereplaceline ()
{
mv "${1}" "${1}.orig"
prefunctionifs="${IFS}"
unset fileinput
unset fileoutput
unset find
unset replace
unset deletelines
unset deletelinesskip
unset insertlinesskip
fileinput="${1}.orig"
fileoutput="${1}"
find="${2}"
replace="${3}"
deletelines="${4%,*}"
insertlinesskip="${5}"
matchlinefound="0"
if [ "${#4}" = "${4#*,}" ]; then
deletelinesskip="0"
else
deletelinesskip="${4#*,}"
fi
IFS="\n"
while read line
do
{
if [ ! "${line}" = "${line/${find}/}" ]; then
{
# Trim the longest match from the end for <*
xmlelementindent="${line%%<*}"
# Trim the longest match from the start for *<
xmlelementtemp="${line#*<}"
# Add back in stripped <
xmlelement="<${xmlelementtemp}"
# Trim the shortest match from the start for <
xmltagtemp="${xmlelement#<}"
# Trim the longest match from the end for >*
xmltag="${xmltagtemp%%>*}"
# Trim the shortest match from the start for *>
xmltexttemp="${xmlelement#*>}"
# Trim the longest match from the end for <*
xmltext="${xmltexttemp%%<*}"
if [ "${replace}" ]; then
{
echo "${xmlelementindent}<${xmltag}>${replace}</${xmltag}>" >>"${fileoutput}"
}
else
{
echo "${line}" >>"${fileoutput}"
}
fi
matchlinefound="1"
}
else
{
if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then
{
if [ "${matchlinefound}" = "${insertlinesskip}" ]; then
{
arraysize=0
while [ ${arraysize} -lt ${#array[@]} ];
do
echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}"
let arraysize="${arraysize}+1"
done
}
fi
}
fi
if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then
{
:
}
else
{
echo "${line}" >>"${fileoutput}"
}
fi
if [ "${matchlinefound}" -gt 0 ]; then
let matchlinefound="${matchlinefound}+1"
fi
}
fi
}
done < "${fileinput}"
IFS=${prefunctionifs}
rm -f "${fileinput}"
}
main "${1}" "${2}" "${3}" "${4}"
trunk/PackageBuilder/Scripts/Resolutions/1680x1050x32/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
#!/bin/bash
# set com.apple.Boot.plist options
overide="Graphics Mode"
string="1680x1050x32"
main ()
{
bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist"
systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist"
bootoptionshdextra[1]="<key>${overide}</key>"
bootoptionshdextra[2]="<string>${string}</string>"
[ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}"
if [ ! -f "${bootplist}" ]; then
if [ -f "${systemplist}" ]; then
cp "${systemplist}" "${bootplist}"
fi
fi
xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" )
case "${xmlvalue:0:1}" in
y)echo "${overide}=y already set in ${bootplist} skipping."
;;
n)echo "${overide}=n is set in ${bootplist} leaving."
;;
*)echo "Adding ${overide}=${string} to ${bootplist}"
array=("${bootoptionshdextra[@]}")
searchfilereplaceline "${bootplist}" "<key>Kernel Flags</key>" "" "" "2"
;;
esac
chown "${USER}:20" "${bootplist}"
}
getxmlvalue ()
{
# 1 xml key
# 2 xml file
if [ -f "${2}" ]; then
local value
while read value; do
if [ ! "${value}" = "${value/<key>${1}</key>/}" ]; then
read value
value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}"
echo "$value"
break
fi
done < "${2}"
fi
}
searchfilereplaceline ()
{
mv "${1}" "${1}.orig"
prefunctionifs="${IFS}"
unset fileinput
unset fileoutput
unset find
unset replace
unset deletelines
unset deletelinesskip
unset insertlinesskip
fileinput="${1}.orig"
fileoutput="${1}"
find="${2}"
replace="${3}"
deletelines="${4%,*}"
insertlinesskip="${5}"
matchlinefound="0"
if [ "${#4}" = "${4#*,}" ]; then
deletelinesskip="0"
else
deletelinesskip="${4#*,}"
fi
IFS="\n"
while read line
do
{
if [ ! "${line}" = "${line/${find}/}" ]; then
{
# Trim the longest match from the end for <*
xmlelementindent="${line%%<*}"
# Trim the longest match from the start for *<
xmlelementtemp="${line#*<}"
# Add back in stripped <
xmlelement="<${xmlelementtemp}"
# Trim the shortest match from the start for <
xmltagtemp="${xmlelement#<}"
# Trim the longest match from the end for >*
xmltag="${xmltagtemp%%>*}"
# Trim the shortest match from the start for *>
xmltexttemp="${xmlelement#*>}"
# Trim the longest match from the end for <*
xmltext="${xmltexttemp%%<*}"
if [ "${replace}" ]; then
{
echo "${xmlelementindent}<${xmltag}>${replace}</${xmltag}>" >>"${fileoutput}"
}
else
{
echo "${line}" >>"${fileoutput}"
}
fi
matchlinefound="1"
}
else
{
if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then
{
if [ "${matchlinefound}" = "${insertlinesskip}" ]; then
{
arraysize=0
while [ ${arraysize} -lt ${#array[@]} ];
do
echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}"
let arraysize="${arraysize}+1"
done
}
fi
}
fi
if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then
{
:
}
else
{
echo "${line}" >>"${fileoutput}"
}
fi
if [ "${matchlinefound}" -gt 0 ]; then
let matchlinefound="${matchlinefound}+1"
fi
}
fi
}
done < "${fileinput}"
IFS=${prefunctionifs}
rm -f "${fileinput}"
}
main "${1}" "${2}" "${3}" "${4}"
trunk/PackageBuilder/Scripts/Resolutions/1920x1080x32/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
#!/bin/bash
# set com.apple.Boot.plist options
overide="Graphics Mode"
string="1920x1080x32"
main ()
{
bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist"
systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist"
bootoptionshdextra[1]="<key>${overide}</key>"
bootoptionshdextra[2]="<string>${string}</string>"
[ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}"
if [ ! -f "${bootplist}" ]; then
if [ -f "${systemplist}" ]; then
cp "${systemplist}" "${bootplist}"
fi
fi
xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" )
case "${xmlvalue:0:1}" in
y)echo "${overide}=y already set in ${bootplist} skipping."
;;
n)echo "${overide}=n is set in ${bootplist} leaving."
;;
*)echo "Adding ${overide}=${string} to ${bootplist}"
array=("${bootoptionshdextra[@]}")
searchfilereplaceline "${bootplist}" "<key>Kernel Flags</key>" "" "" "2"
;;
esac
chown "${USER}:20" "${bootplist}"
}
getxmlvalue ()
{
# 1 xml key
# 2 xml file
if [ -f "${2}" ]; then
local value
while read value; do
if [ ! "${value}" = "${value/<key>${1}</key>/}" ]; then
read value
value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}"
echo "$value"
break
fi
done < "${2}"
fi
}
searchfilereplaceline ()
{
mv "${1}" "${1}.orig"
prefunctionifs="${IFS}"
unset fileinput
unset fileoutput
unset find
unset replace
unset deletelines
unset deletelinesskip
unset insertlinesskip
fileinput="${1}.orig"
fileoutput="${1}"
find="${2}"
replace="${3}"
deletelines="${4%,*}"
insertlinesskip="${5}"
matchlinefound="0"
if [ "${#4}" = "${4#*,}" ]; then
deletelinesskip="0"
else
deletelinesskip="${4#*,}"
fi
IFS="\n"
while read line
do
{
if [ ! "${line}" = "${line/${find}/}" ]; then
{
# Trim the longest match from the end for <*
xmlelementindent="${line%%<*}"
# Trim the longest match from the start for *<
xmlelementtemp="${line#*<}"
# Add back in stripped <
xmlelement="<${xmlelementtemp}"
# Trim the shortest match from the start for <
xmltagtemp="${xmlelement#<}"
# Trim the longest match from the end for >*
xmltag="${xmltagtemp%%>*}"
# Trim the shortest match from the start for *>
xmltexttemp="${xmlelement#*>}"
# Trim the longest match from the end for <*
xmltext="${xmltexttemp%%<*}"
if [ "${replace}" ]; then
{
echo "${xmlelementindent}<${xmltag}>${replace}</${xmltag}>" >>"${fileoutput}"
}
else
{
echo "${line}" >>"${fileoutput}"
}
fi
matchlinefound="1"
}
else
{
if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then
{
if [ "${matchlinefound}" = "${insertlinesskip}" ]; then
{
arraysize=0
while [ ${arraysize} -lt ${#array[@]} ];
do
echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}"
let arraysize="${arraysize}+1"
done
}
fi
}
fi
if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then
{
:
}
else
{
echo "${line}" >>"${fileoutput}"
}
fi
if [ "${matchlinefound}" -gt 0 ]; then
let matchlinefound="${matchlinefound}+1"
fi
}
fi
}
done < "${fileinput}"
IFS=${prefunctionifs}
rm -f "${fileinput}"
}
main "${1}" "${2}" "${3}" "${4}"
trunk/PackageBuilder/Scripts/Resolutions/1280x960x32/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
#!/bin/bash
# set com.apple.Boot.plist options
overide="Graphics Mode"
string="1280x960x32"
main ()
{
bootplist="${2}/.Chameleon/Extra/com.apple.Boot.plist"
systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist"
bootoptionshdextra[1]="<key>${overide}</key>"
bootoptionshdextra[2]="<string>${string}</string>"
[ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}"
if [ ! -f "${bootplist}" ]; then
if [ -f "${systemplist}" ]; then
cp "${systemplist}" "${bootplist}"
fi
fi
xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" )
case "${xmlvalue:0:1}" in
y)echo "${overide}=y already set in ${bootplist} skipping."
;;
n)echo "${overide}=n is set in ${bootplist} leaving."
;;
*)echo "Adding ${overide}=${string} to ${bootplist}"
array=("${bootoptionshdextra[@]}")
searchfilereplaceline "${bootplist}" "<key>Kernel Flags</key>" "" "" "2"
;;
esac
chown "${USER}:20" "${bootplist}"
}
getxmlvalue ()
{
# 1 xml key
# 2 xml file
if [ -f "${2}" ]; then
local value
while read value; do
if [ ! "${value}" = "${value/<key>${1}</key>/}" ]; then
read value
value="${value#*<}" ; value="<${value}" ; value="${value#*>}" ; value="${value# *}" ; value="${value%%<*}"
echo "$value"
break
fi
done < "${2}"
fi
}
searchfilereplaceline ()
{
mv "${1}" "${1}.orig"
prefunctionifs="${IFS}"
unset fileinput
unset fileoutput
unset find
unset replace
unset deletelines
unset deletelinesskip
unset insertlinesskip
fileinput="${1}.orig"
fileoutput="${1}"
find="${2}"
replace="${3}"
deletelines="${4%,*}"
insertlinesskip="${5}"
matchlinefound="0"
if [ "${#4}" = "${4#*,}" ]; then
deletelinesskip="0"
else
deletelinesskip="${4#*,}"
fi
IFS="\n"
while read line
do
{
if [ ! "${line}" = "${line/${find}/}" ]; then
{
# Trim the longest match from the end for <*
xmlelementindent="${line%%<*}"
# Trim the longest match from the start for *<
xmlelementtemp="${line#*<}"
# Add back in stripped <
xmlelement="<${xmlelementtemp}"
# Trim the shortest match from the start for <
xmltagtemp="${xmlelement#<}"
# Trim the longest match from the end for >*
xmltag="${xmltagtemp%%>*}"
# Trim the shortest match from the start for *>
xmltexttemp="${xmlelement#*>}"
# Trim the longest match from the end for <*
xmltext="${xmltexttemp%%<*}"
if [ "${replace}" ]; then
{
echo "${xmlelementindent}<${xmltag}>${replace}</${xmltag}>" >>"${fileoutput}"
}
else
{
echo "${line}" >>"${fileoutput}"
}
fi
matchlinefound="1"
}
else
{
if [ "${insertlinesskip}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -le "${insertlinesskip}" ]; then
{
if [ "${matchlinefound}" = "${insertlinesskip}" ]; then
{
arraysize=0
while [ ${arraysize} -lt ${#array[@]} ];
do
echo "${xmlelementindent}${array[${arraysize}]}" >>"${fileoutput}"
let arraysize="${arraysize}+1"
done
}
fi
}
fi
if [ "${deletelines}" ] && [ "${matchlinefound}" -gt 0 ] && [ "${matchlinefound}" -lt $((${deletelines}+${deletelinesskip})) ] && [ "${matchlinefound}" -ge ${deletelinesskip} ]; then
{
:
}
else
{
echo "${line}" >>"${fileoutput}"
}
fi
if [ "${matchlinefound}" -gt 0 ]; then
let matchlinefound="${matchlinefound}+1"
fi
}
fi
}
done < "${fileinput}"
IFS=${prefunctionifs}
rm -f "${fileinput}"
}
main "${1}" "${2}" "${3}" "${4}"

Archive Download the corresponding diff file

Revision: 133