修复每次都提示首次安装ACE的问题

This commit is contained in:
shenmo 2025-08-27 11:20:58 +00:00
parent d7f90c80bd
commit 514848c09f
2 changed files with 59 additions and 14 deletions

View File

@ -200,19 +200,41 @@ function ensure_aptss_exist() {
}
export -f ensure_aptss_exist
# 确保ACE环境存在
# 确保ACE环境存在
function ensure_ace_env() {
local ace_env_pkg="${1}"
local ace_cmd=""
echo "ACE环境$ace_env_pkg正在尝试安装..."
zenity --info --text="首次使用$ace_env_pkg环境重启或注销桌面后才能在启动器中展示不影响应用启动。安装将在后台继续。" --title="ACE环境安装" &
if ! aptss install -y "$ace_env_pkg"; then
echo "安装$ace_env_pkg失败"
return 1
# 根据配置找到对应命令
for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do
if [ "${ace_entry#*:}" = "$ace_env_pkg" ]; then
ace_cmd="${ace_entry%%:*}"
break
fi
return 0
done
# 如果命令存在,则说明环境已可用
if command -v "$ace_cmd" &>/dev/null; then
return 0
fi
echo "ACE环境 $ace_env_pkg 未安装,正在尝试安装..."
zenity --info --text="首次使用 $ace_env_pkg 环境,重启或注销桌面后才能在启动器中展示,不影响应用启动。安装将在后台继续。" --title="ACE环境安装" &
if ! aptss install -y "$ace_env_pkg"; then
echo "安装 $ace_env_pkg 失败"
return 1
fi
# 再次确认命令
if command -v "$ace_cmd" &>/dev/null; then
return 0
else
echo "ACE环境 $ace_env_pkg 安装后未检测到命令 $ace_cmd"
return 1
fi
}
export user=$(who | awk '{print $1}' | head -n 1)
# 在桌面创建快捷方式
function create_desktop_file() {

View File

@ -200,18 +200,41 @@ function ensure_aptss_exist() {
}
export -f ensure_aptss_exist
# 确保ACE环境存在
# 确保ACE环境存在
function ensure_ace_env() {
local ace_env_pkg="${1}"
echo "ACE环境$ace_env_pkg正在尝试安装..."
zenity --info --text="首次使用$ace_env_pkg环境重启或注销桌面后才能在启动器中展示不影响应用启动。安装将在后台继续。" --title="ACE环境安装" &
if ! aptss install -y "$ace_env_pkg"; then
echo "安装$ace_env_pkg失败"
return 1
local ace_cmd=""
# 根据配置找到对应命令
for ace_entry in "${ACE_ENVIRONMENTS[@]}"; do
if [ "${ace_entry#*:}" = "$ace_env_pkg" ]; then
ace_cmd="${ace_entry%%:*}"
break
fi
return 0
done
# 如果命令存在,则说明环境已可用
if command -v "$ace_cmd" &>/dev/null; then
return 0
fi
echo "ACE环境 $ace_env_pkg 未安装,正在尝试安装..."
zenity --info --text="首次使用 $ace_env_pkg 环境,重启或注销桌面后才能在启动器中展示,不影响应用启动。安装将在后台继续。" --title="ACE环境安装" &
if ! aptss install -y "$ace_env_pkg"; then
echo "安装 $ace_env_pkg 失败"
return 1
fi
# 再次确认命令
if command -v "$ace_cmd" &>/dev/null; then
return 0
else
echo "ACE环境 $ace_env_pkg 安装后未检测到命令 $ace_cmd"
return 1
fi
}
export user=$(who | awk '{print $1}' | head -n 1)
# 在桌面创建快捷方式
function create_desktop_file() {