aboutsummarylogtreecommitdiffstats
path: root/run.sh
diff options
context:
space:
mode:
authorCountStarlight2019-01-03 17:48:46 +0800
committerCountStarlight2019-01-03 17:48:46 +0800
commit1f9700200a8cf00b4977538b22b1251e635a207f (patch)
tree16902df970b28e9c51f814879522a8f588b506f1 /run.sh
downloadaur-1f9700200a8cf00b4977538b22b1251e635a207f.tar.gz
WeChat 2.6.2
Signed-off-by: CountStarlight <countstarlight@gmail.com>
Diffstat (limited to 'run.sh')
-rwxr-xr-xrun.sh110
1 files changed, 110 insertions, 0 deletions
diff --git a/run.sh b/run.sh
new file mode 100755
index 000000000000..1128682c0930
--- /dev/null
+++ b/run.sh
@@ -0,0 +1,110 @@
+#!/bin/sh
+
+# Copyright (C) 2016 Deepin, Inc.
+#
+# Author: Li LongYu <lilongyu@linuxdeepin.com>
+# Peng Hao <penghao@linuxdeepin.com>
+
+WINEPREFIX="$HOME/.deepinwine/Deepin-WeChat"
+APPDIR="/opt/deepinwine/apps/Deepin-WeChat"
+APPVER="2.6.2.31deepin0"
+APPTAR="files.7z"
+PACKAGENAME="com.wechat"
+WINE_CMD="wine"
+
+HelpApp()
+{
+ echo " Extra Commands:"
+ echo " -r/--reset Reset app to fix errors"
+ echo " -e/--remove Remove deployed app files"
+ echo " -h/--help Show program help info"
+}
+CallApp()
+{
+ env WINEPREFIX="$WINEPREFIX" WINEDEBUG=-msvcrt $WINE_CMD "c:\\Program Files\\Tencent\\WeChat\\WeChat.exe" &
+}
+ExtractApp()
+{
+ mkdir -p "$1"
+ 7z x "$APPDIR/$APPTAR" -o"$1"
+ mv "$1/drive_c/users/@current_user@" "$1/drive_c/users/$USER"
+ sed -i "s#@current_user@#$USER#" $1/*.reg
+}
+DeployApp()
+{
+ ExtractApp "$WINEPREFIX"
+ echo "$APPVER" > "$WINEPREFIX/PACKAGE_VERSION"
+}
+RemoveApp()
+{
+ rm -rf "$WINEPREFIX"
+}
+ResetApp()
+{
+ echo "Reset $PACKAGENAME....."
+ read -p "* Are you sure?(Y/N)" ANSWER
+ if [ "$ANSWER" = "Y" -o "$ANSWER" = "y" -o -z "$ANSWER" ]; then
+ EvacuateApp
+ DeployApp
+ CallApp
+ fi
+}
+UpdateApp()
+{
+ if [ -f "$WINEPREFIX/PACKAGE_VERSION" ] && [ "$(cat "$WINEPREFIX/PACKAGE_VERSION")" = "$APPVER" ]; then
+ return
+ fi
+ if [ -d "${WINEPREFIX}.tmpdir" ]; then
+ rm -rf "${WINEPREFIX}.tmpdir"
+ fi
+ ExtractApp "${WINEPREFIX}.tmpdir"
+ /opt/deepinwine/tools/updater -s "${WINEPREFIX}.tmpdir" -c "${WINEPREFIX}" -v
+ rm -rf "${WINEPREFIX}.tmpdir"
+ echo "$APPVER" > "$WINEPREFIX/PACKAGE_VERSION"
+}
+RunApp()
+{
+ if [ -d "$WINEPREFIX" ]; then
+ UpdateApp
+ else
+ DeployApp
+ fi
+ CallApp
+}
+
+CreateBottle()
+{
+ if [ -d "$WINEPREFIX" ]; then
+ UpdateApp
+ else
+ DeployApp
+ fi
+}
+
+if [ -z $1 ]; then
+ RunApp
+ exit 0
+fi
+case $1 in
+ "-r" | "--reset")
+ ResetApp
+ ;;
+ "-c" | "--create")
+ CreateBottle
+ ;;
+ "-e" | "--remove")
+ RemoveApp
+ ;;
+ "-u" | "--uri")
+ RunApp $2
+ ;;
+ "-h" | "--help")
+ HelpApp
+ ;;
+ *)
+ echo "Invalid option: $1"
+ echo "Use -h|--help to get help"
+ exit 1
+ ;;
+esac
+exit 0