-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathWineQQ7.5Lite-uni-amd64.bash
386 lines (351 loc) · 10.3 KB
/
WineQQ7.5Lite-uni-amd64.bash
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
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
#!/bin/bash
export TZ="Asia/Shanghai"
export LANG=zh_CN.UTF-8
export WINETMP=$HOME/WineQQ-temp
export WINEPREFIX=$HOME/WineQQ
echo "欢迎使用Wine QQ安装脚本"
echo
#检查并创建临时目录
if [ -d $HOME/WineQQ-temp ]
then
true
else
mkdir $HOME/WineQQ-temp
fi
if [ -d $HOME/.local/share/icons/hicolor/256x256/apps ]
then
true
else
mkdir -p $HOME/.local/share/icons/hicolor/256x256/apps
fi
if [ -d $HOME/.local/share/applications/ ]
then
true
else
mkdir -p $HOME/.local/share/applications/
fi
wine_staging()
{
echo "正在获取Play on Linux编译好的Wine 1.7.49"
echo "也可以手动下载,放到$WINETMP里,然后重新运行脚本"
echo "下载地址:http://wine.playonlinux.com/binaries/linux-amd64/PlayOnLinux-wine-1.7.49-linux-amd64.pol"
read -p "按回车键继续,或按Ctrl+C退出脚本,手动下载后再运行"
if wget http://wine.playonlinux.com/binaries/linux-amd64/PlayOnLinux-wine-1.7.49-linux-amd64.pol -P $WINETMP -c
then
true
else
read -p "下载失败,按回车键重新下载,或按Ctrl+C退出"
wine_staging
fi
echo
echo "正在解压Wine 1.7.49"
if [ -d $HOME/.winevers ]
then
true
else
mkdir -p $HOME/.winevers
fi
if [ -d $HOME/.winevers/1.7.49 ]
then
rm -r $HOME/.winevers/1.7.49
tar xf $WINETMP/PlayOnLinux-wine-1.7.49-linux-amd64.pol -C $HOME/.winevers
mv $HOME/.winevers/wineversion/1.7.49 $HOME/.winevers/1.7.49
rm -r $HOME/.winevers/wineversion $HOME/.winevers/files $HOME/.winevers/playonlinux
export WINE=$HOME/.winevers/1.7.49/bin/wine
export WINE_PATH=$HOME/.winevers/1.7.49/bin
else
tar xf $WINETMP/PlayOnLinux-wine-1.7.49-linux-amd64.pol -C $HOME/.winevers
mv $HOME/.winevers/wineversion/1.7.49 $HOME/.winevers/1.7.49
rm -r $HOME/.winevers/wineversion $HOME/.winevers/files $HOME/.winevers/playonlinux
export WINE=$HOME/.winevers/1.7.49/bin/wine
export WINE_PATH=$HOME/.winevers/1.7.49/bin
fi
}
if [ -f /usr/bin/wine ]
then
echo "目前的Wine版本是Wine 1.7.49或更高吗?可以打开一个新的终端标签或窗口,执行wine --version来查看"
echo "如果不是,请更新Wine版本,或使用Play on Linux编译好的Wine 1.7.49,否则QQ安装可能会出问题。"
read -p "y - 安装Wine 1.7.49,n - 继续使用系统的Wine : " install_staging_or_not
if [ $install_staging_or_not = "y" ]
then
wine_staging
else
export WINE=/usr/bin/wine
export WINE_PATH=/usr/bin
fi
else
echo "没有安装Wine,此脚本将会安装Play on Linux编译的Wine 1.7.49"
read -p "按回车键继续,或按Ctrl+C退出脚本"
wine_staging
fi
if [ -f /usr/bin/7z ]
then
true
else
echo "此脚本需要用到p7zip,请在安装后重新运行此脚本。(并确认/usr/bin/7z文件存在。)"
exit 1
fi
if [ -d $HOME/WineQQ ]
then
echo "检测到已存在的WineQQ容器,是否删除?"
echo "若是使用此脚本上次安装所留下的,"
echo "或是以前用旧版脚本安装过用此版本来更新,请选择删除"
ping 127.0.0.1 -c 3 >/dev/null
read -p "是否删除?(y/n) " remove_bottle
if [ $remove_bottle = "y" ]
then
rm -r $HOME/WineQQ
$WINE wineboot >/dev/null 2>&1
else
true
fi
else
$WINE wineboot >/dev/null 2>&1
fi
#安装字体
get_wenq()
{
install_microhei()
{
echo
echo "正在下载文泉驿微米黑,也可以手动下载并将文件放到$WINETMP下面"
echo "下载地址:http://jaist.dl.sourceforge.net/project/wqy/wqy-microhei/0.2.0-beta/wqy-microhei-0.2.0-beta.tar.gz"
read -p "按回车键继续,或按Ctrl+C退出脚本,手动下载后再运行"
if [ -f $WINETMP/wqy-microhei-0.2.0-beta.tar.gz ]
then
true
else
if wget http://jaist.dl.sourceforge.net/project/wqy/wqy-microhei/0.2.0-beta/wqy-microhei-0.2.0-beta.tar.gz -P $WINETMP -c
then
true
else
echo
echo "下载不成功,按回车键重试,或者按Ctrl+C退出,手动下载字体后再重新运行脚本。"
install_microhei
fi
fi
if [ -d $HOME/.fonts ]
then
true
else
mkdir -p $HOME/.fonts
fi
tar xf $WINETMP/wqy-microhei-0.2.0-beta.tar.gz -C $WINETMP
cp $WINETMP/wqy-microhei/wqy-microhei.ttc $HOME/.fonts
rm -r $WINETMP/wqy-microhei
}
font_reg()
{
cat > $WINETMP/fonts.reg<<EOF
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine\Fonts\Replacements]
"Arial Unicode MS"="文泉驿微米黑"
"Batang"="文泉驿微米黑"
"Dotum"="文泉驿微米黑"
"Gulim"="文泉驿微米黑"
"Lucida Console"="文泉驿微米黑"
"Microsoft Sans Serif"="文泉驿微米黑"
"Microsoft YaHei"="文泉驿微米黑"
"MingLiU"="文泉驿微米黑"
"MS Gothic"="文泉驿微米黑"
"MS Mincho"="文泉驿微米黑"
"MS PGothic"="文泉驿微米黑"
"MS PMincho"="文泉驿微米黑"
"MS UI Gothic"="文泉驿微米黑"
"NSimSun"="文泉驿微米黑"
"PMingLiU"="文泉驿微米黑"
"SimFang"="文泉驿微米黑"
"SimHei"="文泉驿微米黑"
"SimKai"="文泉驿微米黑"
"SimSun"="文泉驿微米黑"
"Tahoma"="文泉驿微米黑"
"YaHei"="文泉驿微米黑"
"Yahei UI"="文泉驿微米黑"
"宋体"="文泉驿微米黑"
"新細明體"="文泉驿微米黑"
"MSPゴシック"="文泉驿微米黑"
EOF
iconv -f utf8 -t gbk $WINETMP/fonts.reg -o $WINETMP/fonts_reg.reg
rm WINETMP/fonts.reg
$WINE regedit $WINETMP/fonts_reg.reg
$WINE_PATH/wineserver -k
if [ $WINE_PATH = /usr/bin ]
then
if [ -d /usr/share/wine/font.disable ]
then
true
else
echo "删除Wine的Tahoma字体,以解决一处乱码的死角,这需要root权限,可能会提示输入密码。"
sudo mkdir /usr/share/wine/font.disable
sudo mv /usr/share/wine/fonts/tahoma* /usr/share/wine/font.disable
fi
else
mkdir $WINE_PATH/../share/wine/font.disable
mv $WINE_PATH/../share/wine/fonts/tahoma* $WINE_PATH/../share/wine/font.disable
fi
}
echo
echo "即将设置字体,如果不清楚系统是否有文泉驿微米黑。"
echo "可以在系统设置的字体选项中查看,"
echo "或者在一些文本编辑器的字体设置中看看列表里有没有该字体。"
echo "如果实在不清楚,请选 1"
echo
echo "1 - 现在安装文泉驿微米黑并设置"
echo "2 - 系统里有文泉驿微米黑,直接设置"
echo "3 - 不用了,安装后自行设置字体"
read -p "选择:" font_choice
case $font_choice in
1)
install_microhei
font_reg
;;
2)
font_reg
;;
3)
true
;;
*)
echo
echo "选项无效,请在1,2,3中选择。"
echo "再重复一遍:"
get_wenq
;;
esac
}
get_wenq
get_qq()
#为了实现递归,这里将获取QQ的过程写为函数
{
echo
echo "即将下载QQ 7.5轻聊版。也可以手动下载,之后放在$WINETMP里"
echo "下载地址:http://dldir1.qq.com/qqfile/qq/QQ7.5Light/15462/QQ7.5Light.exe"
read -p "按回车键继续,或按Ctrl+C退出脚本,手动下载后再运行"
if wget http://dldir1.qq.com/qqfile/qq/QQ7.5Light/15462/QQ7.5Light.exe -P $WINETMP -c
then
true
else
read -p "下载未成功,按回车键重新下载(支持断点续传),若要退出脚本手动下载,请按Ctrl + C"
get_qq
fi
}
get_qq
#调用函数
echo "即将安装WineQQ。安装完毕后如果自动打开QQ登录窗口,请先关闭,因为安装后还需要一些处理才能正常使用,切记!"
ping 127.0.0.1 -c 3 >/dev/null
read -p "按回车键继续"
#可能遇到安装器提示IE版本过低问题
cat >$WINETMP/iehack.reg << EOF
REGEDIT4
[HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer]
"Version"="8.0"
EOF
$WINE regedit $WINETMP/iehack.reg >/dev/null 2>&1
$WINE $WINETMP/QQ7.5Light.exe >/dev/null 2>&1
$WINE_PATH/wineserver -k
read -p "刚才点击了“安装完成”按钮吗?(y/n)" install_finished
if [ $install_finished = "y" ]
then
true
else
echo "可能安装没有成功,请重新运行此脚本"
exit 1
fi
echo "正在hack注册表"
cat >$WINETMP/txhack.reg <<EOF
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine\DllOverrides]
"*riched20"="native,builtin"
"riched20.dll"="native,builtin"
"txplatform.exe"=""
"txupd.exe"=""
EOF
$WINE regedit $WINETMP/txhack.reg >/dev/null 2>&1
echo "正在从QQ可执行程序中提取图标"
7z -y e $WINEPREFIX/drive_c/Program\ Files\ \(x86\)/Tencent/QQLite/Bin/QQ.exe -o$WINETMP/qqicon >/dev/null
cp $WINETMP/qqicon/4 $HOME/.local/share/icons/hicolor/256x256/apps/WineQQ.png
echo "正在创建启动脚本"
cat > $WINEPREFIX/qq_launcher.sh <<EOF
#!/bin/sh
export TZ="Asia/Shanghai"
export LC_ALL=zh_CN.UTF-8
export WINEPREFIX=$WINEPREFIX
export WINE=$WINE
export WINE_PATH=$WINE_PATH
runqq()
{
\$WINE "C:\Program Files (x86)\Tencent\QQLite\Bin\QQ.exe" >/dev/null 2>&1
}
wineqq_verbose()
{
\$WINE "C:\Program Files (x86)\Tencent\QQLite\Bin\QQ.exe"
}
runhelp()
{
echo
echo "记住,只有选项能用:"
echo "-h 或 --help : 就是你正在看的这些东西"
echo "-v 或 --verbose : 把QQ运行时那些又臭又长的东西显示出来 "
echo "-r 或 --regedit : 呼叫注册表编辑器,胆小者勿入"
echo "-c 或 --winecfg : 召唤winecfg来帮你设置酒瓶"
echo "-t 或 --taskmgr : 开启用来杀进程的任务管理器"
echo "-e 或 --explorer : 打开Wine的文件管理器,然而这并没有什么用"
echo "-k 或 --kill : 关掉把酒瓶里运行的程序都关掉,但不会打碎这个酒瓶"
echo "-u 或 --uninstall :把酒瓶里的东西全部倒掉(卸载)"
echo
}
case \$1 in
"-h"|"--help")
runhelp
;;
"-v"|"--verbose")
wineqq_verbose
;;
"-r"|"--regedit")
$WINE regedit
;;
"-c"|"--winecfg")
$WINE winecfg
;;
"-t"|"--taskmgr")
$WINE taskmgr
;;
"-e"|"--explorer")
$WINE explorer
;;
"-k"|"--kill")
$WINE_PATH/wineserver -k
;;
"-u"|"-uninstall")
rm -rf \$WINEPREFIX
rm -rf \$HOME\.winevers
rm \$HOME/.local/share/applications/wineqq.desktop
rm \$HOME/.local/share/icons/hicolor/256x256/apps/WineQQ.png
;;
*)
if [ -z \$1 ];
then
runqq
else
echo "谁告诉你 \$1 这个选项的?"
runhelp
fi
;;
esac
EOF
chmod +x $WINEPREFIX/qq_launcher.sh
echo "创建菜单项"
cat >$WINETMP/QQ.desktop <<EOF
[Desktop Entry]
Name=QQ 7.5 Lite
Comment=Tencent QQ 7.5 Lite
Categories=Network;
Exec=$WINEPREFIX/qq_launcher.sh
Icon=WineQQ
Type=Application
EOF
cp $WINETMP/QQ.desktop $HOME/.local/share/applications/wineqq.desktop
$WINE_PATH/wineserver -k
echo "安装完成!在主菜单中找到QQ的菜单项启动。"
rm -r $WINETMP
exit 0