diff --git a/spark-dwine-helper/build.sh b/spark-dwine-helper/build.sh index 034d877..dc54c43 100755 --- a/spark-dwine-helper/build.sh +++ b/spark-dwine-helper/build.sh @@ -25,7 +25,7 @@ Version: $version Architecture: all Maintainer: shenmo Installed-Size: $SIZE -Depends: zenity, p7zip-full, fonts-noto-cjk,transhell,python3 +Depends: zenity, p7zip-full(<=16.02+dfsg-8) | p7zip-legacy, fonts-noto-cjk,transhell,python3 Section: utils Priority: extra Recommends: spark-dwine-helper-settings @@ -85,7 +85,7 @@ Version: $version Architecture: all Maintainer: shenmo Installed-Size: $SIZE -Depends: zenity, p7zip-full, fonts-noto-cjk,transhell,python3 +Depends: zenity, p7zip-full(<=16.02+dfsg-8) | p7zip-legacy, fonts-noto-cjk,transhell,python3 Section: utils Priority: extra Recommends: spark-dwine-helper-settings diff --git a/spark-dwine-helper/s-wine-helper/deepinwine/tools/log-function.bashimport b/spark-dwine-helper/s-wine-helper/deepinwine/tools/log-function.bashimport new file mode 100644 index 0000000..96c31ae --- /dev/null +++ b/spark-dwine-helper/s-wine-helper/deepinwine/tools/log-function.bashimport @@ -0,0 +1,39 @@ +# ===== Log ===== +# log.info xxx +# log.warn xxx +# log.info xxx +# log.debug xxx +# 带颜色的echo +function log.color_output() { + local color=$1 + shift 1 + + echo >&2 -e "\033[${color}m$@\033[0m" + return 0 +} + +# Log is named without prefix "utils." for convenience +# Usage: log.log ...content +function log.log() { + if [[ $# < 2 ]]; then + return -1 + fi + + local level=$1 + shift 1 + + case $level in + error) log.color_output "0;31" "[ERROR] $@" ;; + warn) log.color_output "1;33" "[WARN] $@" ;; + info) log.color_output "1;37" "[INFO] $@" ;; + debug) log.color_output "1;30" "[DEBUG] $@" ;; + esac + + return 0 +} + +function log.error() { log.log "error" "$@"; } +function log.warn() { log.log "warn" $@; } +function log.info() { log.log "info" $@; } +function log.debug() { log.log "debug" $@; } + diff --git a/spark-dwine-helper/s-wine-helper/deepinwine/tools/spark_run_v4.sh b/spark-dwine-helper/s-wine-helper/deepinwine/tools/spark_run_v4.sh index 23be9b6..a4e72e6 100755 --- a/spark-dwine-helper/s-wine-helper/deepinwine/tools/spark_run_v4.sh +++ b/spark-dwine-helper/s-wine-helper/deepinwine/tools/spark_run_v4.sh @@ -12,6 +12,7 @@ source /opt/durapps/transhell/transhell.sh load_transhell_debug +source $(dirname $0)/log-function.bashimport BOTTLENAME="$1" WINEPREFIX="$HOME/.deepinwine/$1" @@ -24,6 +25,13 @@ WINE_CMD="deepin-wine" LOG_FILE=$0 PUBLIC_DIR="/var/public" +if [ -e /opt/p7zip-legacy/bin/7z ];then +log.debug "Using p7zip-legacy as unpacker" +UNPACK_CMD=/opt/p7zip-legacy/bin/7z +else +UNPACK_CMD=7z +log.debug "Using system 7z as unpacker" +fi SHELL_DIR=$(dirname $0) SHELL_DIR=$(realpath "$SHELL_DIR") if [ $SPECIFY_SHELL_DIR ]; then @@ -81,7 +89,7 @@ debug_log_to_file() debug_log() { - echo "${1}" + log.debug "${1}" } ################log相关功能 HelpApp() @@ -257,7 +265,7 @@ ExtractApp() { local tmp_log=$(mktemp) mkdir -p "$1" - (7z x "$APPDIR/$APPTAR" -o"$1" -bsp1 -bb1 -bse2 | grep --line-buffered -oP "(\d+(\.\d+)?(?=%))" > $tmp_log)& + (${UNPACK_CMD} x "$APPDIR/$APPTAR" -o"$1" -bsp1 -bb1 -bse2 | grep --line-buffered -oP "(\d+(\.\d+)?(?=%))" > $tmp_log)& cmd_pid=$! (while kill -0 $cmd_pid 2> /dev/null; do