支持p7zip-legacy

This commit is contained in:
2024-02-17 09:19:47 +08:00
parent 36827d61b6
commit c5c9ecd31e
3 changed files with 51 additions and 4 deletions

View File

@@ -25,7 +25,7 @@ Version: $version
Architecture: all Architecture: all
Maintainer: shenmo <shenmo@spark-app.store> Maintainer: shenmo <shenmo@spark-app.store>
Installed-Size: $SIZE 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 Section: utils
Priority: extra Priority: extra
Recommends: spark-dwine-helper-settings Recommends: spark-dwine-helper-settings
@@ -85,7 +85,7 @@ Version: $version
Architecture: all Architecture: all
Maintainer: shenmo <shenmo@spark-app.store> Maintainer: shenmo <shenmo@spark-app.store>
Installed-Size: $SIZE 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 Section: utils
Priority: extra Priority: extra
Recommends: spark-dwine-helper-settings Recommends: spark-dwine-helper-settings

View File

@@ -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 <level> ...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" $@; }

View File

@@ -12,6 +12,7 @@
source /opt/durapps/transhell/transhell.sh source /opt/durapps/transhell/transhell.sh
load_transhell_debug load_transhell_debug
source $(dirname $0)/log-function.bashimport
BOTTLENAME="$1" BOTTLENAME="$1"
WINEPREFIX="$HOME/.deepinwine/$1" WINEPREFIX="$HOME/.deepinwine/$1"
@@ -24,6 +25,13 @@ WINE_CMD="deepin-wine"
LOG_FILE=$0 LOG_FILE=$0
PUBLIC_DIR="/var/public" 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=$(dirname $0)
SHELL_DIR=$(realpath "$SHELL_DIR") SHELL_DIR=$(realpath "$SHELL_DIR")
if [ $SPECIFY_SHELL_DIR ]; then if [ $SPECIFY_SHELL_DIR ]; then
@@ -81,7 +89,7 @@ debug_log_to_file()
debug_log() debug_log()
{ {
echo "${1}" log.debug "${1}"
} }
################log相关功能 ################log相关功能
HelpApp() HelpApp()
@@ -257,7 +265,7 @@ ExtractApp()
{ {
local tmp_log=$(mktemp) local tmp_log=$(mktemp)
mkdir -p "$1" 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=$! cmd_pid=$!
(while kill -0 $cmd_pid 2> /dev/null; do (while kill -0 $cmd_pid 2> /dev/null; do