This commit is contained in:
2024-05-02 01:46:09 +08:00
parent 11e49d7e3d
commit 05f3d707d0
4 changed files with 76 additions and 7 deletions
@@ -13,7 +13,21 @@
source /opt/durapps/transhell/transhell.sh
load_transhell_debug
source $(dirname $0)/log-function.bashimport
#########Preload functions
function get_app_name() {
local app_name_orig=$(grep -m 1 '^Name=' "/usr/share/applications/$1.desktop" | cut -d '=' -f 2)
local app_name_i18n=$(grep -m 1 "^Name\[$LANGUAGE\]\=" "/usr/share/applications/$1.desktop" | cut -d '=' -f 2)
local app_name=""
if [ -z "$app_name_i18n" ]; then
app_name="$app_name_orig"
else
app_name="$app_name_i18n"
fi
echo "$app_name"
}
######### Vars
BOTTLENAME="$1"
WINEPREFIX="$HOME/.deepinwine/$1"
APPDIR="/opt/apps/${DEB_PACKAGE_NAME}/files"
@@ -24,6 +38,13 @@ WINE_CMD="deepin-wine"
#这里会被后续覆盖
LOG_FILE=$0
PUBLIC_DIR="/var/public"
if [ -z "$WINE_WMCLASS" ]; then
export WINE_WMCLASS="$DEB_PACKAGE_NAME"
fi
export WINE_APP_NAME=$(get_app_name ${DEB_PACKAGE_NAME})
if [ -z "$WINE_APP_NAME" ];then
export WINE_APP_NAME=$BOTTLENAME
fi
@@ -44,7 +65,9 @@ fi
if [ $APPRUN_CMD ]; then
WINE_CMD=$APPRUN_CMD
fi
#####################
if [ "$WINE_CMD" = "deepin-wine8-stable" ] && [ "$(arch)" != "x86_64" ];then
WINE_CMD="/opt/durapps/spark-dwine-helper/deepin-wine8-stable-wrapper/deepin-wine8-stable"
@@ -57,7 +80,7 @@ if [ $SPECIFY_SHELL_DIR ]; then
SHELL_DIR=$SPECIFY_SHELL_DIR
fi
##################### Functions
progressbar()
{
WINDOWID="" zenity --progress --title="$1" --text="$2" --pulsate --width=400 --auto-close --no-cancel ||
@@ -296,6 +319,8 @@ fi
}
ExtractApp()
{
local tmp_log=$(mktemp)
mkdir -p "$1"
(${UNPACK_CMD} x "$APPDIR/$APPTAR" -o"$1" -bsp1 -bb1 -bse2 | grep --line-buffered -oP "(\d+(\.\d+)?(?=%))" > $tmp_log)&
@@ -304,7 +329,7 @@ local tmp_log=$(mktemp)
(while kill -0 $cmd_pid 2> /dev/null; do
tail -n 1 "${tmp_log}"
sleep 1
done)| zenity --progress --title="${TRANSHELL_CONTENT_SPARK_WINDOWS_COMPATIBILITY_TOOL}" --text="${TRANSHELL_CONTENT_UNPACKING} $BOTTLENAME..." --width=600 --auto-close --no-cancel
done)| zenity --progress --title="${TRANSHELL_CONTENT_SPARK_WINDOWS_COMPATIBILITY_TOOL}" --text="${TRANSHELL_CONTENT_UNPACKING} $WINE_APP_NAME..." --width=600 --auto-close --no-cancel
rm $tmp_log
@@ -367,6 +392,8 @@ UpdateApp()
}
RunApp()
{
$SHELL_DIR/spark-wine-banner
progpid=$(ps -ef | grep "zenity --progress --title=${BOTTLENAME}" | grep -v grep)
debug_log "run ${BOTTLENAME} progress pid $progpid"
if [ -n "$progpid" ]; then
@@ -432,9 +459,6 @@ fi
debug_log "Run $*"
if [ -z "$WINE_WMCLASS" ]; then
export WINE_WMCLASS="$DEB_PACKAGE_NAME"
fi
#执行lnk文件通过判断第5个参数是否是“/Unix”来判断
if [ "$4" == "/Unix" ];then