mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-04-26 01:10:16 +08:00
refactor: update tray icon handling and add APM installation checks
- Removed the deprecated `--no-spark` argument from launch configuration. - Enhanced tray icon management by introducing a new function to resolve icon paths based on application packaging status. - Implemented APM installation checks in the install manager, prompting users to install APM if not available, with appropriate dialog messages and handling for installation success or failure. - Added a new shell script for executing the Spark Store with environment checks for container and architecture compatibility.
This commit is contained in:
@@ -55,10 +55,39 @@ case "$command_type" in
|
||||
echo "操作已取消"
|
||||
exit 0
|
||||
fi
|
||||
elif [[ "$2" == "install" ]]; then
|
||||
packages="${@:3}"
|
||||
# 确认框通用参数
|
||||
title="确认安装"
|
||||
text="正在准备安装: $packages\n\n若这是您下达的安装指令,请选择确认继续安装"
|
||||
|
||||
# 优先尝试 garma,其次 zenity
|
||||
if command -v garma &> /dev/null; then
|
||||
garma --question --title="$title" --text="$text" \
|
||||
--ok-label="确认安装" --cancel-label="取消" --width=400
|
||||
confirmed=$?
|
||||
elif command -v zenity &> /dev/null; then
|
||||
zenity --question --title="$title" --text="$text" \
|
||||
--ok-label="确认安装" --cancel-label="取消" --width=400
|
||||
confirmed=$?
|
||||
else
|
||||
echo "错误:未找到 garma 或 zenity,无法显示确认对话框。安装操作已拒绝。"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 根据确认结果执行
|
||||
if [[ $confirmed -eq 0 ]]; then
|
||||
/usr/bin/aptss "${@:2}" -y 2>&1
|
||||
exit_code=$?
|
||||
else
|
||||
echo "操作已取消"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
else
|
||||
# 非 remove 命令,直接执行 aptss
|
||||
/usr/bin/aptss "${@:2}" 2>&1
|
||||
exit_code=$?
|
||||
# 非 remove 命令,拒绝执行
|
||||
echo "拒绝执行 aptss 白名单外的指令"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
|
||||
28
extras/spark-store
Executable file
28
extras/spark-store
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 基础参数,始终添加 --no-sandbox
|
||||
ARGS="--no-sandbox"
|
||||
|
||||
# 检查是否在容器中运行
|
||||
# 方法1: 检查 root 路径
|
||||
ROOT_PATH=$(readlink -f /proc/self/root)
|
||||
if [ "$ROOT_PATH" != "/" ]; then
|
||||
echo "检测到容器环境 (root path: $ROOT_PATH)"
|
||||
ARGS="$ARGS --no-apm"
|
||||
fi
|
||||
|
||||
# 方法2: 检查 IS_ACE_ENV 环境变量
|
||||
if [ "$IS_ACE_ENV" = "1" ]; then
|
||||
echo "检测到 ACE 容器环境"
|
||||
ARGS="$ARGS --no-apm"
|
||||
fi
|
||||
|
||||
# 检查是否为 arm64 且为 wayland session
|
||||
ARCH=$(uname -m)
|
||||
if [ "$ARCH" = "aarch64" ] && [ "$XDG_SESSION_TYPE" = "wayland" ]; then
|
||||
echo "检测到 arm64 架构和 Wayland 会话"
|
||||
ARGS="$ARGS --disable-gpu"
|
||||
fi
|
||||
|
||||
# 执行程序
|
||||
/opt/spark-store/bin/spark-store $ARGS "$@"
|
||||
Reference in New Issue
Block a user