diff options
author | Codist | 2020-12-29 20:24:41 +0800 |
---|---|---|
committer | Codist | 2020-12-29 20:24:41 +0800 |
commit | 011ada8d48c55b4f5e50abadfb42c52d42dedde4 (patch) | |
tree | 94fb7a96e313dab0ab41c5f79e209bf7bed21519 /run.sh | |
parent | a1dcd483a125889da341239686a67e2b8d9cd3b8 (diff) | |
download | aur-011ada8d48c55b4f5e50abadfb42c52d42dedde4.tar.gz |
Upgrade QQ to 9.4.2.27655
Signed-off-by: Codist <countstarlight@gmail.com>
Diffstat (limited to 'run.sh')
-rwxr-xr-x[-rw-r--r--] | run.sh | 236 |
1 files changed, 101 insertions, 135 deletions
@@ -6,96 +6,50 @@ # Peng Hao <penghao@linuxdeepin.com> # Codist <countstarlight@gmail.com> -# taotieren <admin@taotieren.com> -WINEPREFIX="$HOME/.deepinwine/com.qq.im.deepin" -APPDIR="/opt/apps/com.qq.im.deepin/files" -APPVER="9.3.2deepin14" -QQ_INSTALLER="PCQQ2020" -QQ_VER="9.4.1.27572" -APPTAR="files.7z" -PACKAGENAME="com.qq.im" -WINE_CMD="wine" -HelpApp() -{ - echo " Extra Commands:" - echo " -r/--reset Reset app to fix errors" - echo " -e/--remove Remove deployed app files" - echo " -d/--deepin Switch to 'deepin-wine5'" - echo " -h/--help Show program help info" -} -CallApp() -{ - if [ ! -f $WINEPREFIX/reinstalled ] - then - touch $WINEPREFIX/reinstalled - env WINEPREFIX=$WINEPREFIX $WINE_CMD $APPDIR/$QQ_INSTALLER-$QQ_VER.exe & - else - #Support use native file dialog - export ATTACH_FILE_DIALOG=1 +version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; } - env WINEPREFIX="$WINEPREFIX" $WINE_CMD "c:\\Program Files\\Tencent\\QQ\\Bin\\QQ.exe" & - fi -} -ExtractApp() +extract_archive() { - 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 - #sed -i "s/deepin-wine/wine/" $1/drive_c/deepin/EnvInit.sh -} -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 $1 -} - -CreateBottle() -{ - if [ -d "$WINEPREFIX" ]; then - UpdateApp - else - DeployApp + 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 } +BOTTLENAME="Deepin-QQ" +APPVER="9.3.2deepin14" +WINEPREFIX="$HOME/.deepinwine/$BOTTLENAME" +QQ_VER="9.4.2.27655" +EXEC_PATH="c:/Program Files/Tencent/QQ/Bin/QQ.exe" +START_SHELL_PATH="$HOME/.deepinwine/deepin-wine-helper/run_v3.sh" +QQ_INSTALLER="PCQQ2020" +QQ_INSTALLER_PATH="c:/Program Files/Tencent/$QQ_INSTALLER-$QQ_VER.exe" +export MIME_TYPE="" +export DEB_PACKAGE_NAME="com.qq.im.deepin" +#export APPRUN_CMD="wine" +export PATCH_LOADER_ENV="" +export FILEDLG_PLUGIN="/opt/apps/$DEB_PACKAGE_NAME/files/gtkGetFileNameDlg" + +export SPECIFY_SHELL_DIR=`dirname $START_SHELL_PATH` + +ARCHIVE_FILE_DIR="/opt/apps/$DEB_PACKAGE_NAME/files" + msg() { ECHO_LEVEL=("\033[1;32m==> " "\033[1;31m==> ERROR: ") @@ -104,74 +58,86 @@ msg() SwitchToDeepinWine() { - PACKAGE_MANAGER="yay" - 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 - exit 1 - else - $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 ..." + PACKAGE_MANAGER="yay" + 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 + exit 1 + else + $PACKAGE_MANAGER="yaourt" + fi + fi + for p in ${DEEPIN_WINE_DEPENDS}; do + if pacman -Qs $p > /dev/null ; then + msg 0 "$p is installed, skip ..." + else + msg 0 "Installing dependency: $p ..." + $PACKAGE_MANAGER -S $p + fi + done + msg 0 "Redeploying app ..." + extract_archive "$ARCHIVE_FILE_DIR/helper_archive.7z" "$ARCHIVE_FILE_DIR/helper_archive.md5sum" "$SPECIFY_SHELL_DIR" + $START_SHELL_PATH $BOTTLENAME $APPVER "$EXEC_PATH" -r + msg 0 "Reversing the patch ..." patch -p1 -R -d ${WINEPREFIX} < $APPDIR/reg.patch - msg 0 "Creating flag file '$WINEPREFIX/deepin' ..." - touch -f $WINEPREFIX/deepin - msg 0 "Done." + echo "5" > $WINEPREFIX/deepin + rm -f $WINEPREFIX/reinstalled + msg 0 "Done." + exit 0 +} + +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 "$QQ_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" } -# Init if [ -f "$WINEPREFIX/deepin" ]; then - WINE_CMD="deepin-wine5" - 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 & - fi + 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 - ;; "-h" | "--help") HelpApp ;; *) - echo "Invalid option: $1" - echo "Use -h|--help to get help" - exit 1 + Run "$@" ;; esac exit 0 |