diff options
Diffstat (limited to 'run.sh')
-rwxr-xr-x | run.sh | 100 |
1 files changed, 44 insertions, 56 deletions
@@ -25,7 +25,7 @@ export APPRUN_CMD="deepin-wine6-stable" DISABLE_ATTACH_FILE_DIALOG="" EXPORT_ENVS="" -export SPECIFY_SHELL_DIR=`dirname $START_SHELL_PATH` +export SPECIFY_SHELL_DIR=$(dirname $START_SHELL_PATH) ARCHIVE_FILE_DIR="/opt/apps/$DEB_PACKAGE_NAME/files" @@ -35,22 +35,19 @@ export LD_LIBRARY_PATH=/opt/apps/$DEB_PACKAGE_NAME/files/lib32 export WINEPREDLL="$ARCHIVE_FILE_DIR/dlls" -msg() -{ - ECHO_LEVEL=("\033[1;32m==> " "\033[1;31m==> ERROR: ") - echo -e "${ECHO_LEVEL[$1]}\033[1;37m$2\033[0m" +msg() { + ECHO_LEVEL=("\033[1;32m==> " "\033[1;31m==> ERROR: ") + echo -e "${ECHO_LEVEL[$1]}\033[1;37m$2\033[0m" } -OpenWinecfg() -{ +OpenWinecfg() { msg 0 "Launching winecfg with $APPRUN_CMD in $WINEPREFIX ..." env WINEPREFIX=$WINEPREFIX $APPRUN_CMD winecfg } -DeployApp() -{ +DeployApp() { # backup fonts - if [ -d "$WECHAT_FONTS" ];then + if [ -d "$WECHAT_FONTS" ]; then msg 0 "Backing up fonts ..." mkdir -p $HOME/.deepinwine/.wechat_tmp cp $WECHAT_FONTS/* $HOME/.deepinwine/.wechat_tmp/ @@ -64,81 +61,72 @@ DeployApp() env WINEDLLOVERRIDES="winemenubuilder.exe=d" $START_SHELL_PATH $BOTTLENAME $APPVER "$WECHAT_INSTALLER_PATH" "$@" # restore fonts - if [ -d "$HOME/.deepinwine/.wechat_tmp" ];then + if [ -d "$HOME/.deepinwine/.wechat_tmp" ]; then msg 0 "Restoring fonts ..." cp -n $HOME/.deepinwine/.wechat_tmp/* $WECHAT_FONTS/ rm -rf "$HOME/.deepinwine/.wechat_tmp" fi touch $WINEPREFIX/reinstalled msg 0 "Creating $WINEPREFIX/PACKAGE_VERSION ..." - cat /opt/apps/$DEB_PACKAGE_NAME/files/files.md5sum > $WINEPREFIX/PACKAGE_VERSION + cat /opt/apps/$DEB_PACKAGE_NAME/files/files.md5sum >$WINEPREFIX/PACKAGE_VERSION } -WakeApp() -{ +WakeApp() { env WINEPREDLL="$ARCHIVE_FILE_DIR/dlls" \ - WINEDLLPATH=/opt/$APPRUN_CMD/lib:/opt/$APPRUN_CMD/lib64 \ - WINEPREFIX=$WINEPREFIX $APPRUN_CMD /opt/deepinwine/tools/sendkeys.exe w + WINEDLLPATH=/opt/$APPRUN_CMD/lib:/opt/$APPRUN_CMD/lib64 \ + WINEPREFIX=$WINEPREFIX $APPRUN_CMD /opt/deepinwine/tools/sendkeys.exe w } -Run() -{ - if [ -z "$DISABLE_ATTACH_FILE_DIALOG" ];then +Run() { + if [ -z "$DISABLE_ATTACH_FILE_DIALOG" ]; then export ATTACH_FILE_DIALOG=1 fi - if [ -n "$EXPORT_ENVS" ];then + if [ -n "$EXPORT_ENVS" ]; then export $EXPORT_ENVS fi - if [ -n "$EXEC_PATH" ];then - if [ ! -f "$WINEPREFIX/reinstalled" ];then + if [ -n "$EXEC_PATH" ]; then + if [ ! -f "$WINEPREFIX/reinstalled" ] || [ ! -f "$EXEC_FILE" ]; then DeployApp + exit 0 + fi + + if [ -z "${EXEC_PATH##*.lnk*}" ]; then + msg 0 "Launching $EXEC_PATH lnk file ..." + $START_SHELL_PATH $BOTTLENAME $APPVER "C:/windows/command/start.exe" "/Unix" "$EXEC_PATH" "$@" else - # missing exec file - if [ ! -f "$EXEC_FILE" ];then - msg 1 "Missing $EXEC_FILE, re-deploying ..." - DeployApp - exit 0 - fi - - if [ -z "${EXEC_PATH##*.lnk*}" ];then - msg 0 "Launching $EXEC_PATH lnk file ..." - $START_SHELL_PATH $BOTTLENAME $APPVER "C:/windows/command/start.exe" "/Unix" "$EXEC_PATH" "$@" - else - msg 0 "Launching $EXEC_PATH ..." - $START_SHELL_PATH $BOTTLENAME $APPVER "$EXEC_PATH" "$@" - fi + msg 0 "Launching $EXEC_PATH ..." + $START_SHELL_PATH $BOTTLENAME $APPVER "$EXEC_PATH" "$@" fi else $START_SHELL_PATH $BOTTLENAME $APPVER "uninstaller.exe" "$@" fi } -HelpApp() -{ - echo " Extra Commands:" - echo " winecfg Open winecfg" - echo " -w/--wake Wake up background program" - echo " -h/--help Show program help info" +HelpApp() { + echo " Extra Commands:" + echo " winecfg Open winecfg" + echo " -w/--wake Wake up background program" + echo " -h/--help Show program help info" } if [ -z $1 ]; then - Run "$@" - exit 0 + Run "$@" + exit 0 fi case $1 in - "winecfg") - OpenWinecfg - ;; - "-w" | "--wake") - WakeApp - ;; - "-h" | "--help") - HelpApp - ;; - *) - Run "$@" - ;; +"winecfg") + OpenWinecfg + ;; +"-w" | "--wake") + WakeApp + ;; +"-h" | "--help") + HelpApp + ;; +*) + Run "$@" + ;; esac exit 0 |