diff options
author | ssfdust | 2017-10-12 17:13:06 +0800 |
---|---|---|
committer | ssfdust | 2017-10-12 17:13:06 +0800 |
commit | 0583aacb9d4db2cff45efb1af340bf17c624c24b (patch) | |
tree | 878b52dd0a51ebcf767263a9bf4d6f031c46fbd8 /run.sh | |
download | aur-0583aacb9d4db2cff45efb1af340bf17c624c24b.tar.gz |
upload to archlinux git server
Diffstat (limited to 'run.sh')
-rw-r--r-- | run.sh | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/run.sh b/run.sh new file mode 100644 index 000000000000..d9e5cb123670 --- /dev/null +++ b/run.sh @@ -0,0 +1,104 @@ +#!/bin/sh + +# Copyright (C) 2016 Deepin, Inc. +# +# Author: Li LongYu <lilongyu@linuxdeepin.com> +# Peng Hao <penghao@linuxdeepin.com> + +# wszqkzqk <wszqkzqk@gmail.com> + +WINEPREFIX="$HOME/.deepinwine/Deepin-TIM" +APPDIR="/opt/deepinwine/apps/Deepin-TIM" +APPVER="1.1.5" +TIMVER="1.1.5" +APPTAR="files.7z" +PACKAGENAME="com.qq.tim" + +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 + env WINEPREFIX=$WINEPREFIX wine $APPDIR/TIM$TIMVER.exe + touch $WINEPREFIX/reinstalled + else + bash "$WINEPREFIX/drive_c/deepin/EnvInit.sh" + 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 + 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 +} + +if [ -z $1 ]; then + RunApp + exit 0 +fi +case $1 in + "-r" | "--reset") + ResetApp + ;; + "-e" | "--remove") + RemoveApp + ;; + "-h" | "--help") + HelpApp + ;; + *) + echo "Invalid option: $1" + echo "Use -h|--help to get help" + exit 1 + ;; +esac +exit 0 |