diff options
author | Codist | 2020-11-26 20:08:25 +0800 |
---|---|---|
committer | Codist | 2020-11-26 20:08:25 +0800 |
commit | abda6933c7c2e50c3d5f84c18345a62f13f03f43 (patch) | |
tree | b4582fe1ecffbe2629061fab75856b7fc6b8897d /run.sh | |
parent | 6cd54d3b09030519f984cc65a97242d98dae61c5 (diff) | |
download | aur-abda6933c7c2e50c3d5f84c18345a62f13f03f43.tar.gz |
optimized switch to deepin-wine
Signed-off-by: Codist <countstarlight@gmail.com>
Diffstat (limited to 'run.sh')
-rwxr-xr-x | run.sh | 50 |
1 files changed, 26 insertions, 24 deletions
@@ -58,23 +58,30 @@ 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 - msg 0 "Installing dependencies: ${DEEPIN_WINE_DEPENDS} ..." - $PACKAGE_MANAGER -S ${DEEPIN_WINE_DEPENDS} --needed - msg 0 "Redeploying app ..." - $START_SHELL_PATH $BOTTLENAME $APPVER "$EXEC_PATH" -r - touch -f $WINEPREFIX/deepin - echo "5" > $WINEPREFIX/deepin - msg 0 "Done." + 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 ..." + $START_SHELL_PATH $BOTTLENAME $APPVER "$EXEC_PATH" -r + echo "5" > $WINEPREFIX/deepin + rm -f $WINEPREFIX/reinstalled + msg 0 "Done." + exit 0 } Run() @@ -110,7 +117,7 @@ if [ -f "$WINEPREFIX/deepin" ]; then else rm $WINEPREFIX/deepin export APPRUN_CMD="wine" - fi + fi else export APPRUN_CMD="wine" fi @@ -123,16 +130,11 @@ case $1 in "-d" | "--deepin") SwitchToDeepinWine ;; - "-u" | "--uri") - Run "$@" - ;; "-h" | "--help") HelpApp ;; *) - echo "Invalid option: $1" - echo "Use -h|--help to get help" - exit 1 + Run "$@" ;; esac exit 0 |