将部分绝对路径改为相对路径以方便集成

This commit is contained in:
2024-07-16 14:23:37 +08:00
parent 41e3b3265b
commit 08d12d068e
3 changed files with 11 additions and 7 deletions

View File

@@ -1,5 +1,7 @@
#!/bin/bash
SHELL_DIR=$(dirname $(realpath $0))
# 函数:获取所有应用列表
# 函数:获取所有应用列表
get_apps_list() {
@@ -26,7 +28,7 @@ get_apps_list() {
version="无法读取"
fi
if grep -q "START_SHELL_PATH=\"/opt/deepinwine/tools/spark_run_v4.sh\"" "$run_script"; then
if grep -q "START_SHELL_PATH=\"$SHELL_DIR/../spark_run_v4.sh\"" "$run_script"; then
use_spark="是"
fi
fi
@@ -63,7 +65,7 @@ select_app() {
local app_dir="/opt/apps/$app"
local run_script="$app_dir/files/run.sh"
local use_spark="否"
if grep -q "START_SHELL_PATH=\"/opt/deepinwine/tools/spark_run_v4.sh\"" "$run_script"; then
if grep -q "START_SHELL_PATH=\"$SHELL_DIR/../spark_run_v4.sh\"" "$run_script"; then
use_spark="是"
fi
if [ "$use_spark" == "是" ]; then
@@ -95,7 +97,7 @@ select_non_spark_action(){
local app_dir="/opt/apps/$app"
local run_script="$app_dir/files/run.sh"
local bottle_name=$(grep -oP 'BOTTLENAME="\K[^"]+' "$run_script")
/opt/deepinwine/tools/kill.sh ${bottle_name}
$SHELL_DIR/../kill.sh ${bottle_name}
rm -rf /home/$(whoami)/.deepinwine/${bottle_name}/*
zenity --info --width=300 --text="操作已完成请重启Wine应用查看"
;;
@@ -138,7 +140,7 @@ select_spark_action() {
local app_dir="/opt/apps/$app"
local run_script="$app_dir/files/run.sh"
local bottle_name=$(grep -oP 'BOTTLENAME="\K[^"]+' "$run_script")
/opt/deepinwine/tools/spark_kill.sh ${bottle_name}
$SHELL_DIR/../spark_kill.sh ${bottle_name}
rm -rf /home/$(whoami)/.deepinwine/${bottle_name}/*
zenity --info --width=300 --text="操作已完成请重启Wine应用查看"
;;
@@ -181,7 +183,7 @@ select_scale_action() {
if [ "$scale_factor" == "恢复默认" ];then
rm $HOME/.deepinwine/$bottle_name/scale.txt
else
/opt/apps/store.spark-app.spark-dwine-helper/files/deepinwine/tools/spark-dwine-helper/scale-set-helper/set-wine-scale.sh -s "$scale_factor" "$HOME/.deepinwine/$bottle_name"
$SHELL_DIR/scale-set-helper/set-wine-scale.sh -s "$scale_factor" "$HOME/.deepinwine/$bottle_name"
fi
elif [ "$scale_type" == "全局" ]; then
if [ "$scale_factor" == "恢复默认" ];then

View File

@@ -2,7 +2,9 @@
cd $(dirname $0)
runtime_path=/opt/deepinwine/runtime-i386
SHELL_DIR=$(dirname $(realpath $0))
runtime_path=$SHELL_DIR/../../runtime-i386
echo $runtime_path
if [ -f "$runtime_path/init_runtime.sh" ];then
source "$runtime_path/init_runtime.sh"

View File

@@ -178,7 +178,7 @@ DisableWrite()
########如果有该文件夹则删除,然后再创建一个不允许写入的
is_autostart()
{
AUTOSTART="/opt/deepinwine/tools/autostart"
AUTOSTART="$SHELL_DIR/autostart"
if [ -f "$AUTOSTART.all" ]&&[ -f "/opt/apps/$1/files/run.sh" ];then
return 0
fi