-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
326 lines (270 loc) · 12.2 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
#!/bin/sh
clear
osascript -e "tell application \"Terminal\" to set the font size of window 1 to 12"
osascript -e "tell application \"Terminal\" to set background color of window 1 to {1028, 12850, 65535}"
osascript -e "tell application \"Terminal\" to set normal text color of window 1 to {65535, 65535, 65535}"
clear
loc=`locale | grep LANG | sed -e 's/.*LANG="\(.*\)_.*/\1/'`
if [ ! $loc = "ru" ]; then
printf '\n\n***** SpiraMira Hybrid Mode Patch for Mojave (10.14.1 - 10.14.6) ******\n'
printf '***** Version 1.44 beta net ******\n'
else
printf '\n\n***** Патч гибридного режима интерфейса SpiraMira (10.14.1 - 10.14.6) ******\n'
printf '***** Версия 1.44 beta net ******\n'
fi
sleep 0.5
if [ ! $loc = "ru" ]; then
printf '***** Your system '
printf "`sw_vers -productName`"
printf ': '; printf "`sw_vers -productVersion`"
printf '('
printf "`sw_vers -buildVersion`"
printf ') '
printf ' ******\n\n\n'
else
printf '***** Ваша система '
printf "`sw_vers -productName`"
printf ': '; printf "`sw_vers -productVersion`"
printf '('
printf "`sw_vers -buildVersion`"
printf ') '
printf ' ******\n\n\n'
fi
string=`sw_vers -productVersion`
string=`echo ${string//[^0-9]/}`
string=${string:0:5}
legal=0
case "$string" in
"10141" ) legal=1;;
"10142" ) legal=1;;
"10143" ) legal=1;;
"10144" ) legal=1;;
"10145" ) legal=1;;
"10146" ) legal=1;;
esac
if [ $legal = 0 ]; then
if [ ! $loc = "ru" ]; then
printf '\nThis program is for 10.14.1 - 10.14.6 (Mojave) only\n'
printf '\n!!!! UNABLE TO CONTUNUE. BYE !!!!\n\n\n\n\n'
read -p "Press any key to close this window " -n 1 -r
else
printf '\nЭта программа только для 10.14.1 - 10.14.6 (Mojave) \n'
printf '\n!!!! ВЫПОЛНЕНИЕ НЕВОЗМОЖНО. ВЫХОД !!!!\n\n\n\n\n'
read -p "Для выхода нажмите любую клавишу" -n 1 -r
fi
osascript -e 'tell application "Terminal" to close first window' & exit
exit
fi
if [ ! $loc = "ru" ]; then
printf 'Checking internet conectivity\n'
else
printf 'Проверяем интернет соединение\n'
fi
if ping -c 1 google.com >> /dev/null 2>&1; then
net=1
if [ ! $loc = "ru" ]; then
printf 'Internet conectivity check passed.\n'
else
printf 'Доступ в интернет подтвержден.\n'
fi
else
net=0
if [ ! $loc = "ru" ]; then
printf 'Internet conectivity check failed !!!\n'
else
printf 'Интернет соединение недоступно !!!\n'
fi
fi
cd $(dirname $0)
if [ $net = 1 ]; then
mkdir -p HybridMode/$string 2>/dev/null
case "$string" in
"10141" ) bstring=18B75; zname="https://github.com/SpiraMira/HybridMode-Public/blob/master/files/18B75/patchedapps/Hybrid-18B75-v1.3.zip?raw=true";;
"10142" ) bstring=18C54; zname="https://github.com/SpiraMira/HybridMode-Public/blob/master/files/18C54/patchedapps/HybridMode-185C4-v1.4.1.zip?raw=true";;
"10143" ) bstring=18D109; zname="https://github.com/SpiraMira/HybridMode-Public/blob/master/files/18D109/patchedapps/Hybrid-18D109-v1.4.2.zip?raw=true";;
"10144" ) bstring=18E226; zname="https://github.com/SpiraMira/HybridMode-Public/blob/master/files/18E226/patchedapps/Hybrid-18E226-v1.4.3.zip?raw=true";;
"10145" ) bstring=18E226; zname="https://github.com/SpiraMira/HybridMode-Public/releases/download/v1.5/Hybrid-18F132-v1.5.zip?raw=true";;
"10146" ) bstring=18E226; zname="https://github.com/SpiraMira/HybridMode-Public/releases/download/v1.5/Hybrid-18F132-v1.5.zip?raw=true";;
esac
if [ ! $loc = "ru" ]; then
printf 'Downloading patched files from SpiraMira repository .\n'
else
printf 'Загрузка патченных файлов из репозитория SpiraMira .\n'
fi
while :;do printf '.' ;sleep 0.4;done &
trap "kill $!" EXIT
cd ./HybridMode/$string
rm -f HIToolbox
rm -f CoreUI
curl -L -s -o Hybrid.zip $zname 2>/dev/null
unzip -o -qq Hybrid*.zip 2>/dev/null
rm Hybrid*.zip 2>/dev/null
mv CoreUI* CoreUI 2>/dev/null
mv HIToolbox* HIToolbox 2>/dev/null
chmod +x CoreUI 2>/dev/null
chmod +x HIToolbox 2>/dev/null
cd ../../
kill $!
wait $! 2>/dev/null
trap " " EXIT
printf ' \n'
if [ ! -f "HybridMode/$string/CoreUI" ] || [ ! -f "HybridMode/$string/HIToolbox" ]; then
net=0
rm -R -f HybridMode
if [ ! $loc = "ru" ]; then
printf 'Downloading failed. !!!\n\n'
else
printf 'Загрузка не успешна. !!!\n\n'
fi
else
if [ ! $loc = "ru" ]; then
printf 'Downloading successful. !!!\n\n'
else
printf 'Загрузка успешна. !!!\n\n'
fi
fi
fi
if [ $net = 0 ]; then
if [ ! -f "HybridMode.zip" ]; then
if [ ! $loc = "ru" ]; then
printf 'no files to make this patch !!!\n'
printf 'the end of the program !!!\n\n\n'
read -p "Press any key to close this window " -n 1 -r
else
printf 'Не получены файлы для патча !!!\n'
printf 'Продолжение программы невозможно. !!!\n\n\n'
read -p "Для выхода нажмите любую клавишу" -n 1 -r
fi
rm -R ./HybridMode
rm -R -f ./__MACOSX
clear
osascript -e 'tell application "Terminal" to close first window' & exit
else
if [ ! $loc = "ru" ]; then
printf 'Local archive files found. !!!\n'
else
printf 'Найден локальный архив. !!!\n'
fi
unzip -o -qq HybridMode.zip
if [ ! -f "HybridMode/$string/CoreUI" ] || [ ! -f "HybridMode/$string/HIToolbox" ]; then
if [ ! $loc = "ru" ]; then
printf 'The patched files for '"`sw_vers -productVersion`"' in archive not found. !!!\n\n'
printf 'the end of the program !!!\n\n\n'
read -p "Press any key to close this window " -n 1 -r
else
printf 'Файлы для патча '"`sw_vers -productVersion`"' в архиве не найдены !!!\n\n'
printf 'Продолжение программы невозможно. !!!\n\n\n'
read -p "Для выхода нажмите любую клавишу" -n 1 -r
fi
rm -R -f ./HybridMode
rm -R -f ./__MACOSX
clear
osascript -e 'tell application "Terminal" to close first window' & exit
fi
fi
fi
SystemCoreUI=`md5 -q /System/Library/PrivateFrameworks/CoreUI.framework/Versions/Current/CoreUI`
SystemHIToolbox=`md5 -q /System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Versions/Current/HIToolbox`
ModCoreUI=`md5 -q HybridMode/$string/CoreUI`
ModHIToolbox=`md5 -q HybridMode/$string/HiToolbox`
if [[ $SystemCoreUI = $ModCoreUI ]]; then
if [[ $SystemHIToolbox = $ModHIToolbox ]]; then
if [ ! $loc = "ru" ]; then
printf 'OK ! Hybrid mod patch has already done\n\n\n'
else
printf 'OK ! патч гибридного режима уже был сделан\n\n\n'
fi
if [ ! $loc = "ru" ]; then
read -p "Press any key to close this window " -n 1 -r
else
read -p "Для выхода нажмите любую клавишу" -n 1 -r
fi
rm -R ./HybridMode
rm -R -f ./__MACOSX
clear
osascript -e 'tell application "Terminal" to close first window' & exit
fi
fi
frstat=0
if [[ ! $SystemCoreUI = $ModCoreUI ]]; then
if [ ! $loc = "ru" ]; then
printf 'To continue enter your mac user account password\n'
printf 'To escape press CTRL+Z keys\n\n'
else
printf 'Для продолжения введите пароль пользователя мак\n'
printf 'Для отмены выполнения нажмите CTRL+Z \n\n'
fi
me=`sudo whoami`
frstat=1
if [ -f "/System/Library/PrivateFrameworks/CoreUI.framework/Versions/Current/CoreUI.back" ]; then
sudo rm /System/Library/PrivateFrameworks/CoreUI.framework/Versions/Current/CoreUI.back
fi
sudo rm /System/Library/PrivateFrameworks/CoreUI.framework/Versions/Current/CoreUI
sudo cp HybridMode/$string/CoreUI /System/Library/PrivateFrameworks/CoreUI.framework/Versions/Current/
sudo chmod 755 /Volumes/OSX/S*/L*/PrivateFrameworks/CoreUI.framework/Versions/Current/CoreUI
sudo chown 0:0 /Volumes/OSX/S*/L*/PrivateFrameworks/CoreUI.framework/Versions/Current/CoreUI
if [ ! $loc = "ru" ]; then
printf '\nOK ! CoreUI mod patch done\n'
else
printf '\nOK ! Патч CoreUI для гибридного режима сделан\n'
fi
fi
if [[ ! $SystemHIToolbox = $ModHIToolbox ]]; then
if [ ! "$me" = "root" ]; then
if [ ! $loc = "ru" ]; then
printf 'To continue enter your mac user account password\n'
printf 'To escape press CTRL+Z keys\n\n'
else
printf 'Для продолжения введите пароль пользователя мак\n'
printf 'Для отмены выполнения нажмите CTRL+Z \n\n'
fi
fi
if [ -f "/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Versions/Current/HIToolbox.back" ]; then
sudo rm /System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Versions/Current/HIToolbox.back
fi
frstat=1
sudo rm /System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Versions/Current/HIToolbox
sudo cp HybridMode/$string/HiToolbox /System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Versions/Current/
sudo chmod 755 /Volumes/OSX/S*/L*/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Versions/Current/HIToolbox
sudo chown 0:0 /Volumes/OSX/S*/L*/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Versions/Current/HIToolbox
if [ ! $loc = "ru" ]; then
printf '\nOK ! HIToolbox mod patch done\n'
else
printf '\nOK ! Патч HIToolbox для гибридного режима сделан\n'
fi
fi
if [[ $frstat == 1 ]]
then
if [ ! $loc = "ru" ]; then
printf '\nupdate the system frameworks cache. It takes a few minutes\n'
printf '\nProcessing: '
else
printf '\nОбновляем кэш системных сценариев. Это занимает несколько минут\n'
printf '\nВыполняется: '
fi
sleep 1
while :;do printf '.';sleep 3;done &
trap "kill $!" EXIT
sudo update_dyld_shared_cache -debug -force -root / 2>/dev/null
kill $!
wait $! 2>/dev/null
trap " " EXIT
if [ ! $loc = "ru" ]; then
printf '\n\nSystem Frameworks Cache Updated\n'
printf 'Reboot the system to apply the settings\n\n'
sleep 1
else
printf '\n\nКэш системных сценариев обновлен\n'
printf 'Перезагрузите систему для применения изменений\n\n'
fi
fi
rm -R ./HybridMode
rm -R -f ./__MACOSX
if [ ! $loc = "ru" ]; then
read -p "Press any key to close this window " -n 1 -r
else
read -p "Для выхода нажмите любую клавишу" -n 1 -r
fi
clear
osascript -e 'tell application "Terminal" to close first window' & exit
exit