summarylogtreecommitdiffstats
path: root/run.sh
diff options
context:
space:
mode:
authorspecter1192020-02-11 16:18:03 +0800
committerspecter1192020-02-11 16:18:03 +0800
commita42041e02e53762e2b5e7c1a89c9e77fa91f8814 (patch)
tree6ee8b2699861b3a1b661f4b0d3acea20b1b988eb /run.sh
parent1774e0fab9770b671be15082825173f7923feab2 (diff)
downloadaur-a42041e02e53762e2b5e7c1a89c9e77fa91f8814.tar.gz
update 2.8.10.2010deepin0, just make it work
Diffstat (limited to 'run.sh')
-rwxr-xr-xrun.sh119
1 files changed, 111 insertions, 8 deletions
diff --git a/run.sh b/run.sh
index 6cbeb1e5e9e8..6fbe27a0544b 100755
--- a/run.sh
+++ b/run.sh
@@ -1,15 +1,118 @@
+#!/bin/sh
+
WINEPREFIX="$HOME/.deepinwine/Deepin-WXWork"
APPDIR="/opt/deepinwine/apps/Deepin-WXWork"
APPVER="2.4.16.1347deepin0-1"
APPTAR="files.7z"
PACKAGENAME="deepin.com.wxwork"
+WINE_CMD="wine"
-if [ ! -d "$WINEPREFIX" ]; then
- mkdir -p $WINEPREFIX
- 7z x "$APPDIR/$APPTAR" -o"$WINEPREFIX"
- mv "$WINEPREFIX/drive_c/users/"{@current_user@,$USER}
- sed -i "s#@current_user@#$USER#" $WINEPREFIX/*.reg
-fi
+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()
+{
+ if [ ! -f "$WINEPREFIX/reinstalled" ]
+ then
+ touch $WINEPREFIX/reinstalled
+ env WINEPREFIX="$WINEPREFIX" $WINE_CMD $APPDIR/TIM$APPVER.exe
+ else
+ #disable Tencent MiniBrowser
+ #_DeleteRegistry "HKCU\\Software\\Tencent\\MiniBrowser"
+
+ #Support use native file dialog
+ export ATTACH_FILE_DIALOG=1
+
+ env WINEPREFIX="$WINEPREFIX" WINEDEBUG=-msvcrt $WINE_CMD "c:\\Program Files\\WXWork\\WXWork.exe" &
-export WINEPREFIX
-LANG=zh_CN.UTF-8 wine "$WINEPREFIX/drive_c/Program Files/WXWork/WXWork.exe"
+ fi
+}
+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 \ No newline at end of file