ubuntu 12.04安装QQ2012

最新消息2013-12-17:

腾讯再次弹出消息,我的QQ2012彻底不能用了,经过实验貌似只能用TM2013Preview1.exe了。

 

最新版本的QQ2013彻底无法安装

安装QQ2013和TM2013最新版本都遇到登录时,登录框空白的问题。

 

狗日的腾讯 gogogo

 

[u]华丽的分割线[/u]

---------------------------------------------------

背景:

先鄙视下腾讯:“QQ2011到期了,请升级到新QQ”,最近无法使用QQ2011了

wine 1.6-rc1发布了,对QQ的支持更好,参考:http://linuxtoy.org/archives/wine-1-6-rc1.html

实验结果:

  • QQ2012安装:能用。
  • QQ2013安装:除了查看消息记录或打开消息管理器就crash外,基本也能用。

安装QQ步骤:

补充一下,安装前,需要先卸载wine1.4:打开新立得:搜索wine,卸载所有的wine1.4的东西即可

  • 使用wine安装
    ~$: winetricks riched20 msxml3 ie7 mfc42
    #或
    ~$: winetricks riched20 msxml6 ie8 vcrun2008
  • 安装QQ2012

 

祝好运!

为方便不会用的人安装,特制作一键安装脚本如下(直接下载脚本运行):

  • 脚本功能(生成的脚本都在~/.wine/或~/.wine-1.6-32/目录下):
  1. 自动安装wine1.6
  2. 安装windows替代
  3. 安装QQ2012
  4. 设定wine使用linux系统默认浏览器打开网页
  5. 生成修复中文显示方块的bug脚本
  • 脚本代码:
#!/bin/bash -e
#####
# 在wine目录下生成如下脚本
# 1. killqq.sh:一键kill qq进程,因为退出QQ后,并未正确退出,导致不能再次登录,需要先杀掉
# 2. fix-fonts.sh:一般不会出现中文显示方块,如果出现,执行一下脚本
# 3. fix-webbrowers.sh:设定wine使用linux系统默认浏览器
####
qq_key=QQ2012

if [ "" = "${work_time}" ]; then export work_time=$(date +%Y-%m-%d_%H-%M-%S); fi
readyWine() {
	#1. 安装wine 1.6
	if [ ! -f /usr/bin/wine ] || [ "`wine --version|grep 1.6`" = "" ]; then
		if [ ! -f /etc/apt/sources.list.d/ubuntu-wine-ppa-precise.list ]; then
			echo "添加wine软件源:"
			sudo add-apt-repository ppa:ubuntu-wine/ppa
		fi
		echo "安装wine 1.6:"
		sudo apt-get update
		sudo apt-get -y install wine
	fi
	#2. 初始化目录和脚本
	export WINEPREFIX=${HOME}/.wine
	if [ -d "${WINEPREFIX}/drive_c/Program Files (x86)" ]; then
		echo "你安装的是64bit .wine环境,将自动创建32位wine安装QQ."
		export WINEPREFIX=${HOME}/.wine-1.6-32
	fi
	if [ -d "${WINEPREFIX}/drive_c/windows" ] && [ ! -d "${WINEPREFIX}/drive_c/Program Files" ]; then
		rm -rf ${WINEPREFIX}
	fi
	
	echo "wine目录:${WINEPREFIX}"
	if [ ! -d "${WINEPREFIX}" ]; then
		echo "准备wine目录:${WINEPREFIX}"
		export WINEARCH=win32
		wineboot -u

		echo '#!/bin/bash
export WINEPREFIX='${WINEPREFIX}'
winetricks $@' > ${WINEPREFIX}/winetricks.sh

		echo '#!/bin/bash
export WINEPREFIX='${WINEPREFIX}'
wine $@' > ${WINEPREFIX}/wine.sh

		echo '#!/bin/bash
export WINEPREFIX='${WINEPREFIX}'
wine regedit $@' > ${WINEPREFIX}/regedit.sh

		echo '#!/bin/bash
export WINEPREFIX='${WINEPREFIX}'
winecfg' > ${WINEPREFIX}/winecfg.sh

		chmod +x ${WINEPREFIX}/*.sh
	fi
	
	echo "winetricks 准备必要文件:"
	echo "	安装IE时,请不要选择安装最新更新"
	echo "	1. riched20 msxml3 ie7 mfc42"
	echo "	2. riched20 msxml6 ie8 vcrun2008"
	echo "请选择1、2(default 2):"
	read tmp
	if [ "$tmp" = "1" ]; then
		winetricks riched20 msxml3 ie7 mfc42 || echo "wine准备完毕."
	else
		winetricks riched20 msxml6 ie8 vcrun2008 || echo "wine准备完毕."
	fi
}
readyQQ() {
	if [ ! -f "${WINEPREFIX}/drive_c/Program Files/Tencent/QQ/Bin/QQ.exe" ]; then
		cache_dir=~/.cache/winetricks/qq
		export cache_file=$cache_dir/$qq_key.exe
		if [ ! -f "${cache_file}" ] || [ "`md5sum ${cache_file}|grep 1da3ff01ee9d269c193f6f3398260a20`" = "" ]; then
			mkdir -p ${cache_dir}
			echo "下载QQ安装文件:"
			gvfs-open ${cache_dir}
			wget -N -c "http://dl_dir.qq.com/qqfile/qq/$qq_key/$qq_key.exe" -P ${cache_dir}/
		fi
		
		wine ${cache_file}
		echo "5s后自动kill QQ安装进程..."
		sleep 5s
		ps -eo 'pid,cmd'|grep '.exe'|grep QQ|sed 's/^\s*//'|cut -f 1 -d' '|xargs kill
	fi
}
readyQQSh() {
	#桌面图标
	if [ ! -f "${WINEPREFIX}/QQ.desktop" ]; then
		echo "生成启动脚本:${WINEPREFIX}/qq.sh"
		echo '#!/bin/bash
	exo-open '${WINEPREFIX}'/QQ.desktop' > ${WINEPREFIX}/qq.sh
		chmod +x ${WINEPREFIX}/qq.sh

		echo '[Desktop Entry]
Name='$qq_key'
Exec=env WINEPREFIX="'${WINEPREFIX}'" wine C:\\\\Program\\ Files\\\\Tencent\\\\QQ\\\\Bin\\\\QQ.exe 
Type=Application
StartupNotify=true
Path='${WINEPREFIX}'/dosdevices/c:/Program Files/Tencent/QQ/Bin/
Icon=977B_QQ.0' > ${WINEPREFIX}/$qq_key.desktop
	fi
	rm -f ~/桌面/$qq_key.desktop
	ln -sf ${WINEPREFIX}/$qq_key.desktop ~/桌面/
	#一键killQQ脚本
	if [ ! -f "${WINEPREFIX}/killqq.sh" ]; then
		echo "#!/bin/bash
qq_proc=\"\`ps -eo 'pid,cmd'|grep '.exe'|grep QQ|sed 's/^\s*//'\`\"
echo \"\$qq_proc\"|cut -f 1 -d' '|xargs kill
echo '杀死:'
echo \$qq_proc
sleep 2s
\`ps -eo 'pid,cmd'|grep '.exe'|grep QQ|sed 's/^\s*//'\`
" > ${WINEPREFIX}/killqq.sh
		chmod +x ${WINEPREFIX}/killqq.sh
	fi
	mkdir -p ~/bin
	ln -sf ${WINEPREFIX}/killqq.sh ~/bin/
	ln -sf ${WINEPREFIX}/killqq.sh ~/桌面/
	
	if [ ! -f "${WINEPREFIX}/fix-fonts.sh" ]; then
		echo '[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Fonts]
"SimSun (TrueType)"="Z:\\usr\\bin\\..\\share\\wine\\fonts\\\\wqy-microhei.ttc"'>${WINEPREFIX}/fonts.reg
		echo '#!/bin/bash
echo "修复中文显示为方块"
sudo ln -s /usr/share/fonts/truetype/wqy/wqy-microhei.ttc /usr/share/wine/fonts/
export WINEPREFIX="'${WINEPREFIX}'"
wine regedit $WINEPREFIX/fonts.reg'>${WINEPREFIX}/fix-fonts.sh
		chmod +x ${WINEPREFIX}/fix-fonts.sh
	fi
	if [ ! -f "${WINEPREFIX}/fix-webbrowers.sh" ]; then
		echo '[HKEY_CLASSES_ROOT\http\shell\open\command]
@="\"C:\\windows\\system32\\winebrowser.exe\" -nohome %1"

[HKEY_CLASSES_ROOT\https\shell\open\command]
@="\"C:\\windows\\system32\\winebrowser.exe\" -nohome %1"'>${WINEPREFIX}/webbrowers.reg
		echo '#!/bin/bash
echo "设定windows默认浏览器为linux的缺省浏览器"
export WINEPREFIX="'${WINEPREFIX}'"
wine regedit $WINEPREFIX/webbrowers.reg'>${WINEPREFIX}/fix-webbrowers.sh
		chmod +x ${WINEPREFIX}/fix-webbrowers.sh
	fi
}

readyWine
readyQQ
readyQQSh
${WINEPREFIX}/fix-webbrowers.sh
exo-open ~/桌面/$qq_key.desktop >/dev/null 2>/dev/null &

 

 

你可能感兴趣的:(wine,shell,linux,qq,ubuntu)