Chameleon Applications

Chameleon Applications Commit Details

Date:2010-11-03 02:51:27 (13 years 5 months ago)
Author:blackosx
Commit:207
Parents: 206
Message:Amended EFI and Post scripts to unmount all occurrences of EFI volumes. Re-worked the way the /Extra/com.apple.Boot.plist is built.
Changes:
M/branches/blackosx/trunk/package/Scripts/Resolutions/1280x960x32/postinstall
M/branches/blackosx/trunk/package/Scripts/Resolutions/1024x768x32/postinstall
M/branches/blackosx/trunk/package/Scripts/Resolutions/1920x1200x32/postinstall
M/branches/blackosx/trunk/package/Scripts/Advanced/UseNvidiaROM/postinstall
M/branches/blackosx/trunk/package/Scripts/Advanced/ForceWake/postinstall
M/branches/blackosx/trunk/package/Scripts/Resolutions/1280x1024x32/postinstall
M/branches/blackosx/trunk/package/Scripts/Advanced/UseAtiROM/postinstall
M/branches/blackosx/trunk/package/Scripts/Resolutions/1920x1080x32/postinstall
M/branches/blackosx/trunk/package/Scripts/Resolutions/1680x1050x32/postinstall
M/branches/blackosx/trunk/package/Scripts/Advanced/QuietBoot/postinstall
M/branches/blackosx/trunk/package/Scripts/Advanced/ForceHPET/postinstall
M/branches/blackosx/trunk/package/Scripts/BaseOptions/DropSSDT/postinstall
M/branches/blackosx/trunk/package/Scripts/Advanced/SMBIOSdefaults/postinstall
M/branches/blackosx/trunk/package/Scripts/Advanced/GUI/postinstall
M/branches/blackosx/trunk/package/Scripts/Advanced/LegacyLogo/postinstall
M/branches/blackosx/trunk/package/Scripts/Advanced/Wake/postinstall
M/branches/blackosx/trunk/package/Scripts/Standard/postinstall
M/branches/blackosx/trunk/package/Scripts/EFI/postinstall
M/branches/blackosx/trunk/package/Scripts/BaseOptions/arch/postinstall
M/branches/blackosx/trunk/package/Scripts/BaseOptions/GenerateCStates/postinstall
M/branches/blackosx/trunk/package/Scripts/Advanced/Wait/postinstall
M/branches/blackosx/trunk/package/Scripts/BaseOptions/GraphicsEnabler/postinstall
M/branches/blackosx/trunk/package/Scripts/BaseOptions/RestartFix/postinstall
M/branches/blackosx/trunk/package/Scripts/BaseOptions/GeneratePStates/postinstall
M/branches/blackosx/trunk/package/Scripts/Post/postinstall
M/branches/blackosx/trunk/package/Scripts/Advanced/VBIOS/postinstall
M/branches/blackosx/trunk/package/Scripts/Advanced/EHCIacquire/postinstall
M/branches/blackosx/trunk/package/Scripts/Advanced/UseMemDetect/postinstall
M/branches/blackosx/trunk/package/Scripts/Resolutions/1600x900x32/postinstall
M/branches/blackosx/trunk/package/Scripts/BaseOptions/InstantMenu/postinstall
M/branches/blackosx/trunk/package/Scripts/BaseOptions/EthernetBuiltIn/postinstall
M/branches/blackosx/trunk/package/buildpkg
M/branches/blackosx/trunk/package/Scripts/Advanced/BootBanner/postinstall
M/branches/blackosx/trunk/revision
M/branches/blackosx/trunk/package/Scripts/Advanced/UHCIreset/postinstall

File differences

branches/blackosx/trunk/package/buildpkg
258258
259259
260260
261
261262
262263
263264
cp -f ${pkgroot}/Scripts/Post/* ${1}/Post/Scripts
buildpackage "${1}/Post" "/" "" "start_visible=\"false\" start_selected=\"true\""
outline[$((outlinecount++))]="${indent[$xmlindent]}</choices-outline>"
# build meta package
makedistribution "${1}" "${2}" "${3}" "${4}" "${5}"
branches/blackosx/trunk/package/Scripts/Standard/postinstall
33
44
55
6
6
7
78
89
910
......
4950
5051
5152
52
53
54
5355
5456
5557
......
225227
226228
227229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
228247
229248
230249
......
285304
286305
287306
288
289
307
308
309
310
290311
312
313
314
315
316
291317
292318
293319
diskloader="boot0"
diskloaderdualboot="boot0hfs"
partitionloader="boot1h"
partitionloaderhfs="boot1h"
partitionloaderfat="boot1f32"
filesystemloader="boot"
diskmicrocodetype[1]="GRUB,47525542"
echo "bootdisk: Disk device is ${bootdisk}"
echo "bootrdisk: Disk raw device is ${bootrdisk}"
echo "diskloader: Disk loader is ${diskloader}"
echo "partitionloader: Partition loader is ${partitionloader}"
echo "partitionloaderhfs: Partition loader is ${partitionloaderhfs}"
echo "partitionloaderfat: Partition loader is ${partitionloaderfat}"
echo "filesystemloader: Filesystem loader is ${filesystemloader}"
echo "bootresources: Boot Resources is ${bootresources}"
echo "-----------------------------------------------"
echo "==============================================="
echo "Check the format of the selected partition"
echo "*************************************"
if [ "$( fstyp ${bootdev} | grep hfs )" ]; then
echo "${bootdev} is a currently formatted as HFS"
efiformat="hfs"
fi
if [ "$( fstyp ${bootdev} | grep msdos )" ]; then
echo "${bootdev} is currently formatted as msdos"
efiformat="msdos"
fi
echo "-----------------------------------------------"
echo ""
echo ""
echo "==============================================="
echo "Determine Partition Scheme:"
echo "***************************"
echo "Diskupdate is false, so no stage 0 file was written"
fi
echo "Executing command: dd if=/usr/standalone/i386/${partitionloader} of=${bootrdev}"
dd if="${bootvolume}/usr/standalone/i386/${partitionloader}" of=${bootrdev}
if [ ${efiformat} = "hfs" ]; then
echo "Executing command: dd if=/usr/standalone/i386/${partitionloaderhfs} of=${bootrdev}"
dd if="${bootvolume}/usr/standalone/i386/${partitionloaderhfs}" of=${bootrdev}
fi
if [ ${efiformat} = "msdos" ]; then
echo "Executing command: dd if=/usr/standalone/i386/${partitionloaderfat} of=${bootrdev}"
dd if="${bootvolume}/usr/standalone/i386/${partitionloaderfat}" of=${bootrdev}
fi
echo "Executing command: cp /usr/standalone/i386/${filesystemloader} ${bootvolume}"
cp "${bootvolume}/usr/standalone/i386/${filesystemloader}" "${bootvolume}"
branches/blackosx/trunk/package/Scripts/EFI/postinstall
246246
247247
248248
249
250
251
252
253
254
255
256
257
258
259
260249
261250
262251
......
264253
265254
266255
267
256
268257
269258
270
271
272
273
274
275
259
260
261
262
263
264
265
266
267
268
269
276270
277
278
279
280
281
282271
283272
284273
......
286275
287276
288277
289
290
291278
292279
293280
}
#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
#}
}
echo "==============================================="
echo "Check the format of the EFI partition"
echo "Unmount all EFI partitions and Check their format"
echo "*************************************"
if [ "$( df | grep ${bootdev} )" ]; then
echo "${bootdev} is currently mounted, so un-mounting it"
umount -f ${bootdev}
else
echo "EFI partition is currently not mounted"
fi
# loop through and un-mount all mounted EFI partitions - Thanks kizwan
attempts=1
while [ "$( df | grep EFI )" ] && [ "${attempts}" -lt 5 ]; do
echo "Unmounting $( df | grep EFI | awk '{print $1}' )"
umount -f $( df | grep EFI | awk '{print $1}' )
attempts=$(( ${attempts} + 1 ))
done
if [ ${attempts} = 5 ]; then
echo "failed to unmount EFI partitions."
exit
fi
#if [[ `dd if=/dev/disk${1}s1 count=8 bs=1 skip=82 | uuencode -m -|head -n 2|tail -n 1` != "RkFUMzIgICA=" ]]; then
#echo "${bootdev} isn't a FAT32 partition"
#newfs_msdos -v "${bootervolumename}" "${bootdev}"
#fi
if [ "$( fstyp ${bootdev} | grep hfs )" ]; then
echo "${bootdev} is a currently formatted as HFS"
efiformat="hfs"
if [ "$( fstyp ${bootdev} | grep msdos )" ]; then
echo "${bootdev} is currently formatted as msdos"
efiformat="msdos"
#echo "Executing command: newfs_msdos -F 32 ${bootdev}"
#newfs_msdos -F 32 "${bootdev}"
fi
echo "-----------------------------------------------"
echo ""
branches/blackosx/trunk/package/Scripts/Advanced/ForceHPET/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
overide="ForceHPET"
string="Yes"
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 -f "${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}=y 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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@ForceHPET+Yes"
branches/blackosx/trunk/package/Scripts/Advanced/EHCIacquire/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
overide="EHCIacquire"
string="Yes"
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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@EHCIacquire+Yes"
branches/blackosx/trunk/package/Scripts/Advanced/VBIOS/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
overide="VBIOS"
string="Yes"
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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@VBIOS+Yes"
branches/blackosx/trunk/package/Scripts/Advanced/GUI/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
overide="GUI"
string="No"
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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@GUI+No"
branches/blackosx/trunk/package/Scripts/Advanced/SMBIOSdefaults/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
overide="SMBIOSdefault"
string="Yes"
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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@SMBIOSdefault+Yes"
branches/blackosx/trunk/package/Scripts/Advanced/UseMemDetect/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
overide="UseMemDetect"
string="No"
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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@UseMemDetect+No"
branches/blackosx/trunk/package/Scripts/Advanced/Wait/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
overide="Wait"
string="Yes"
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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@Wait+Yes"
branches/blackosx/trunk/package/Scripts/Advanced/LegacyLogo/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
overide="LegacyLogo"
string="Yes"
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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@LegacyLogo+Yes"
branches/blackosx/trunk/package/Scripts/Advanced/UseNvidiaROM/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
overide="UseNvidaROM"
string="Yes"
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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@UseNvidiaROM+Yes"
branches/blackosx/trunk/package/Scripts/Advanced/ForceWake/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
overide="ForceWake"
string="Yes"
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 -f "${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}=y 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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@ForceWake+Yes"
branches/blackosx/trunk/package/Scripts/Advanced/Wake/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
overide="Wake"
string="Yes"
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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@Wake+Yes"
branches/blackosx/trunk/package/Scripts/Advanced/UseAtiROM/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
overide="UseAtiROM"
string="Yes"
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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@UseAtiROM+Yes"
branches/blackosx/trunk/package/Scripts/Advanced/BootBanner/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
overide="BootBanner"
string="No"
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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@BootBanner+No"
branches/blackosx/trunk/package/Scripts/Advanced/QuietBoot/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
overide="QuietBoot"
string="Yes"
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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@QuietBoot+Yes"
branches/blackosx/trunk/package/Scripts/Advanced/UHCIreset/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
overide="UHCIreset"
string="Yes"
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}=y 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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@UHCIreset+Yes"
branches/blackosx/trunk/package/Scripts/Post/postinstall
11
22
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
3207
4208
5209
......
9213
10214
11215
12
216
217
218
219
220
221
13222
14223
15224
16225
17
226
227
228
229
230
231
232
233
234
235
18236
19237
20238
......
24242
25243
26244
27
28245
29
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
30268
31269
32
33
270
271
34272
35
36
37
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
38297
39298
40299
#!/bin/bash
main ()
{
echo "==============================================="
echo "set com.apple.Boot.plist options"
echo "****************************************"
temp="/private/tmp/Chameleon"
echo "Temp is ${temp}"
cd ${temp}
Dirlist=$(find . -type d | grep "/")
for directory in $Dirlist ; do
overide=$(echo $directory | sed 's/_/ /g' | tr -d "./@" |cut -d '+' -f1)
string=$(echo $directory | tr -d "./@" |cut -d'+' -f2)
bootplist="${3}/.Chameleon/Extra/com.apple.Boot.plist"
echo "bootplist = ${bootplist}"
systemplist="/Library/Preferences/SystemConfiguration/com.apple.Boot.plist"
echo "systemplist= ${systemplist}"
echo ""
bootoptionshdextra[1]="<key>${overide}</key>"
bootoptionshdextra[2]="<string>${string}</string>"
echo "bootoptionshdextra 1 = ${bootoptionshdextra[1]}"
echo "bootoptionshdextra 2= ${bootoptionshdextra[2]}"
echo ""
echo "if no directory exists named ${bootplist%/*} then mkdir ${bootplist%/*}"
echo ""
[ ! -d "${bootplist%/*}" ] && mkdir -p "${bootplist%/*}"
echo "if ${bootplist} doesn't exist"
echo ""
if [ ! -f "${bootplist}" ]; then
echo "if ${systemplist} doesn't exist"
echo ""
if [ -f "${systemplist}" ]; then
echo "copy ${systemplist} to ${systemplist}"
echo ""
cp "${systemplist}" "${bootplist}"
fi
fi
xmlvalue=$( getxmlvalue ${overide} "${bootplist}" | tr "[:upper:]" "[:lower:]" )
echo "xmlvalue = ${xmlvalue}"
echo ""
case "${xmlvalue:0:1}" in
y)echo "${overide}=y already set in ${bootplist} skipping."
echo ""
;;
n)echo "${overide}=n is set in ${bootplist} leaving."
echo ""
;;
*)echo "Adding ${overide}=${string} to ${bootplist}"
array=("${bootoptionshdextra[@]}")
searchfilereplaceline "${bootplist}" "<key>Kernel Flags</key>" "" "" "2"
echo ""
;;
esac
echo "set owner privileges for ${bootplist}"
chown "${USER}:20" "${bootplist}"
done
}
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}"
}
echo "==============================================="
echo "Post Script"
echo "***********"
echo ""
echo ""
main "${1}" "${2}" "${3}" "${4}"
temp="/private/tmp/Chameleon"
#source com.apple.boot.plist
fi
fi
# fix kext permissions
echo "==============================================="
echo "Fix Kext Permissions"
echo "********************"
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
echo "-----------------------------------------------"
echo ""
echo ""
echo "==============================================="
echo "Build mkext for Extras"
echo "**********************"
[ -d "${temp}" ] && rm -R -f "${temp}"
mkdir -p "${temp}/Extensions"
ditto --noextattr --noqtn --arch i386 "${2}/.Chameleon/Extra/Extensions" "${temp}/Extensions"
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
echo "-----------------------------------------------"
echo ""
echo ""
echo "==============================================="
echo "Removing Temporary Chameleon Directory"
echo "**************************************"
#rm -f -R "${temp}"
echo "-----------------------------------------------"
echo ""
echo ""
echo "==============================================="
echo "Are there any EFI partitions mounted?"
echo "*************************************"
if [ -d /Volumes/EFI ]; then
# remove link for extras install
#unlink -r "${2}/.Chameleon"
echo "Yes.."
echo ""
cp -R -f "${2}/.Chameleon/Extra" /Volumes/EFI/
umount -f /Volumes/EFI
rm -R -f /Volumes/EFI
# remove link for extras install
#unlink -r "${2}/.Chameleon"
#cp -R -f "${2}/.Chameleon/Extra" /Volumes/EFI/
echo "==============================================="
echo "Unmount all EFI partitions"
echo "**************************"
# loop through and un-mount all mounted EFI partitions - Thanks kizwan
attempts=1
while [ "$( df | grep EFI )" ] && [ "${attempts}" -lt 5 ]; do
echo "Unmounting $( df | grep EFI | awk '{print $1}' )"
umount -f $( df | grep EFI | awk '{print $1}' )
attempts=$(( ${attempts} + 1 ))
done
if [ ${attempts} != 5 ]; then
rm -R -f /Volumes/EFI
else
echo "failed to unmount EFI partitions."
fi
echo "-----------------------------------------------"
echo ""
echo ""
rm -R -f "${2}/.Chameleon"
fi
branches/blackosx/trunk/package/Scripts/BaseOptions/GenerateCStates/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
overide="GenerateCStates"
string="Yes"
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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@GenerateCStates+Yes"
branches/blackosx/trunk/package/Scripts/BaseOptions/DropSSDT/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
overide="DropSSDT"
string="Yes"
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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@DropSSDT+Yes"
branches/blackosx/trunk/package/Scripts/BaseOptions/EthernetBuiltIn/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
overide="EthernetBuiltIn"
string="Yes"
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 -f "${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}=y 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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@EthernetBuiltIn+Yes"
branches/blackosx/trunk/package/Scripts/BaseOptions/InstantMenu/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
overide="InstantMenu"
string="Yes"
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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@InstantMenu+Yes"
branches/blackosx/trunk/package/Scripts/BaseOptions/GraphicsEnabler/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
overide="GraphicsEnabler"
string="Yes"
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 -f "${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}=y 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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@GraphicsEnabler+Yes"
branches/blackosx/trunk/package/Scripts/BaseOptions/RestartFix/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
overide="RestartFix"
string="No"
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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@RestartFix+No"
branches/blackosx/trunk/package/Scripts/BaseOptions/arch/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
overide="arch"
string="i386"
main ()
{
bootplist="${3}/.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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@arch+i386"
branches/blackosx/trunk/package/Scripts/BaseOptions/GeneratePStates/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
overide="GeneratePStates"
string="Yes"
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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@GeneratePStates+Yes"
branches/blackosx/trunk/package/Scripts/Resolutions/1024x768x32/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@Graphics_Mode+1024x768x32"
branches/blackosx/trunk/package/Scripts/Resolutions/1920x1200x32/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@Graphics_Mode+1920x1200x32"
branches/blackosx/trunk/package/Scripts/Resolutions/1600x900x32/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@Graphics_Mode+1600x900x32"
branches/blackosx/trunk/package/Scripts/Resolutions/1280x1024x32/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@Graphics_Mode+1280x1024x32"
branches/blackosx/trunk/package/Scripts/Resolutions/1680x1050x32/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@Graphics_Mode+1680x1050x32"
branches/blackosx/trunk/package/Scripts/Resolutions/1920x1080x32/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@Graphics_Mode+1920x1080x32"
branches/blackosx/trunk/package/Scripts/Resolutions/1280x960x32/postinstall
11
22
3
3
44
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
5
6
587
59
608
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
9
#!/bin/bash
# set com.apple.Boot.plist options
temp="/private/tmp/Chameleon"
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}"
if [ -d ${temp} ]; then
mkdir ${temp};
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}"
mkdir -p "${temp}/@ Graphics_Mode+1280x960x32"
branches/blackosx/trunk/revision
1
1
198:201
206

Archive Download the corresponding diff file

Revision: 207