aboutsummarylogtreecommitdiffstats
path: root/run.sh
diff options
context:
space:
mode:
authorCodist2020-11-26 00:50:58 +0800
committerCodist2020-11-26 00:50:58 +0800
commit6cd54d3b09030519f984cc65a97242d98dae61c5 (patch)
tree0d2b8659132db9ce5fb1c8f20d78f09ff0cf947b /run.sh
parentedd35c34c276b46e111f6bb8e18073c5dc824cba (diff)
downloadaur-6cd54d3b09030519f984cc65a97242d98dae61c5.tar.gz
Upgrade deepin base package to 2.9.5.41deepin7 and add deepin-wine5 support.
Signed-off-by: Codist <countstarlight@gmail.com>
Diffstat (limited to 'run.sh')
-rwxr-xr-xrun.sh197
1 files changed, 75 insertions, 122 deletions
diff --git a/run.sh b/run.sh
index 7cf2eb477be8..dba4575cfe37 100755
--- a/run.sh
+++ b/run.sh
@@ -7,102 +7,48 @@
# Codist <countstarlight@gmail.com>
-WINEPREFIX="$HOME/.deepinwine/Deepin-WeChat"
-APPDIR="/opt/deepinwine/apps/Deepin-WeChat"
-APPVER="2.6.8.65deepin0"
-WECHAT_INSTALLER="WeChatSetup"
-WECHAT_VER="3.0.0.57"
-APPTAR="files.7z"
-PACKAGENAME="com.wechat"
-WINE_CMD="wine"
+version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; }
-HelpApp()
+extract_archive()
{
- echo " Extra Commands:"
- echo " -r/--reset Reset app to fix errors"
- echo " -e/--remove Remove deployed app files"
- echo " -d/--deepin Switch to 'deepin-wine'"
- echo " -h/--help Show program help info"
+ archive=$1
+ version_file=$2
+ dest_dir=$3
+ if [ -f "$archive" ] && [ -n "$dest_dir" ] && [ "$dest_dir" != "." ];then
+ archive_version=`cat $version_file`
+ if [ -d "$dest_dir" ];then
+ if [ -f "$dest_dir/VERSION" ];then
+ dest_version=`cat $dest_dir/VERSION`
+ if version_gt "$archive_version" "$dest_version" || [ -z "$dest_version" ];then
+ 7z x "$archive" -o/"$dest_dir" -aoa
+ echo "$archive_version" > "$dest_dir/VERSION"
+ fi
+ fi
+ else
+ mkdir -p $dest_dir
+ 7z x "$archive" -o/"$dest_dir" -aoa
+ echo "$archive_version" > "$dest_dir/VERSION"
+ fi
+ fi
}
-CallApp()
-{
- if [ ! -f "$WINEPREFIX/reinstalled" ]
- then
- touch $WINEPREFIX/reinstalled
- # stop the previous version of 'shadow.exe'
- pkill -f "shadow.exe"
- env WINEDLLOVERRIDES="winemenubuilder.exe=d" WINEPREFIX="$WINEPREFIX" $WINE_CMD $APPDIR/$WECHAT_INSTALLER-$WECHAT_VER.exe &
- else
- #Support use native file dialog
- export ATTACH_FILE_DIALOG=1
- env WINEPREFIX="$WINEPREFIX" WINEDEBUG=-msvcrt $WINE_CMD "c:\\Program Files\\Tencent\\WeChat\\WeChat.exe" &
- fi
+BOTTLENAME="Deepin-WeChat"
+APPVER="2.9.5.41deepin7"
+WINEPREFIX="$HOME/.deepinwine/$BOTTLENAME"
+WECHAT_VER="3.0.0.57"
+EXEC_PATH="c:/Program Files/Tencent/WeChat/WeChat.exe"
+START_SHELL_PATH="$HOME/.deepinwine/deepin-wine-helper/run_v3.sh"
+WECHAT_INSTALLER="WeChatSetup"
+WECHAT_INSTALLER_PATH="c:/Program Files/Tencent/$WECHAT_INSTALLER-$WECHAT_VER.exe"
+export MIME_TYPE=""
+export DEB_PACKAGE_NAME="com.qq.weixin.deepin"
+#export APPRUN_CMD="wine"
+export PATCH_LOADER_ENV=""
+export FILEDLG_PLUGIN="/opt/apps/$DEB_PACKAGE_NAME/files/gtkGetFileNameDlg"
- if [ "$WINE_CMD" = "wine" ]; then
- # run 'shadow.exe' if process not exist
- if [[ -z "$(ps -e | grep -o 'shadow.exe')" ]]; then
- env WINEPREFIX="$WINEPREFIX" WINEDEBUG=-msvcrt $WINE_CMD "c:\\shadow.exe" &
- fi
- 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
-}
+export SPECIFY_SHELL_DIR=`dirname $START_SHELL_PATH`
-CreateBottle()
-{
- if [ -d "$WINEPREFIX" ]; then
- UpdateApp
- else
- DeployApp
- fi
-}
+ARCHIVE_FILE_DIR="/opt/apps/$DEB_PACKAGE_NAME/files"
msg()
{
@@ -113,7 +59,7 @@ msg()
SwitchToDeepinWine()
{
PACKAGE_MANAGER="yay"
- DEEPIN_WINE_DEPENDS="deepin-wine"
+ DEEPIN_WINE_DEPENDS="deepin-wine5"
if ! [ -x "$(command -v yay)" ]; then
if ! [ -x "$(command -v yaourt)" ]; then
msg 1 "Need to install 'yay' or 'yaourt' first." >&2
@@ -122,56 +68,63 @@ SwitchToDeepinWine()
$PACKAGE_MANAGER="yaourt"
fi
fi
- if [[ -z "$(ps -e | grep -o gsd-xsettings)" ]]; then
- DEEPIN_WINE_DEPENDS="${DEEPIN_WINE_DEPENDS} xsettingsd"
- fi
- if [ "$XDG_CURRENT_DESKTOP" = "Deepin" ]; then
- DEEPIN_WINE_DEPENDS="${DEEPIN_WINE_DEPENDS} lib32-freetype2-infinality-ultimate"
- fi
msg 0 "Installing dependencies: ${DEEPIN_WINE_DEPENDS} ..."
$PACKAGE_MANAGER -S ${DEEPIN_WINE_DEPENDS} --needed
msg 0 "Redeploying app ..."
- if [ -d "$WINEPREFIX" ]; then
- RemoveApp
- fi
- DeployApp
- msg 0 "Reversing the patch ..."
- patch -p1 -R -d ${WINEPREFIX} < $APPDIR/reg.patch
- msg 0 "Creating flag file '$WINEPREFIX/deepin' ..."
+ $START_SHELL_PATH $BOTTLENAME $APPVER "$EXEC_PATH" -r
touch -f $WINEPREFIX/deepin
+ echo "5" > $WINEPREFIX/deepin
msg 0 "Done."
}
-# Init
+Run()
+{
+ extract_archive "$ARCHIVE_FILE_DIR/helper_archive.7z" "$ARCHIVE_FILE_DIR/helper_archive.md5sum" "$SPECIFY_SHELL_DIR"
+
+ if [ -n "$PATCH_LOADER_ENV" ] && [ -n "$EXEC_PATH" ];then
+ export $PATCH_LOADER_ENV
+ fi
+
+ if [ -n "$EXEC_PATH" ];then
+ if [ ! -f "$WINEPREFIX/reinstalled" ];then
+ touch $WINEPREFIX/reinstalled
+ env WINEDLLOVERRIDES="winemenubuilder.exe=d" $START_SHELL_PATH $BOTTLENAME $APPVER "$WECHAT_INSTALLER_PATH" "$@"
+ else
+ $START_SHELL_PATH $BOTTLENAME $APPVER "$EXEC_PATH" "$@"
+ fi
+ else
+ $START_SHELL_PATH $BOTTLENAME $APPVER "uninstaller.exe" "$@"
+ fi
+}
+
+HelpApp()
+{
+ echo " Extra Commands:"
+ echo " -d/--deepin Switch to 'deepin-wine'"
+ echo " -h/--help Show program help info"
+}
+
if [ -f "$WINEPREFIX/deepin" ]; then
- WINE_CMD="deepin-wine"
- if [[ -z "$(ps -e | grep -o gsd-xsettings)" ]] && [[ -z "$(ps -e | grep -o xsettingsd)" ]]; then
- if [[ ! -f "$HOME/.xsettingsd" ]] && [[ ! -f "$HOME/.config/xsettingsd/xsettingsd.conf" ]] && [[ ! -f "/etc/xsettingsd/xsettingsd.conf" ]]; then
- mkdir -p "$HOME/.config/xsettingsd" && touch "$HOME/.config/xsettingsd/xsettingsd.conf"
- fi
- /usr/bin/xsettingsd &
+ if [ "$(cat $WINEPREFIX/deepin)" = "5" ]; then
+ export APPRUN_CMD="deepin-wine5"
+ else
+ rm $WINEPREFIX/deepin
+ export APPRUN_CMD="wine"
fi
+else
+ export APPRUN_CMD="wine"
fi
if [ -z $1 ]; then
- RunApp
+ Run "$@"
exit 0
fi
case $1 in
- "-r" | "--reset")
- ResetApp
- ;;
- "-c" | "--create")
- CreateBottle
- ;;
- "-e" | "--remove")
- RemoveApp
- ;;
"-d" | "--deepin")
SwitchToDeepinWine
;;
"-u" | "--uri")
- RunApp $2
+ Run "$@"
;;
"-h" | "--help")
HelpApp