Files
spark-store/extras/spark-store
shenmo 012c589fba fix(spark-store): 调整zenity提示框宽度并添加银河麒麟说明
增加zenity提示框的宽度以避免文本显示不全,并针对银河麒麟用户添加APM网页版商店的说明
2026-04-05 11:09:44 +08:00

46 lines
1.7 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/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
# 检查是否存在 apt 指令
if ! command -v apt >/dev/null 2>&1; then
echo "未检测到 apt 指令"
ARGS="$ARGS --no-spark"
fi
# 注意:已移除原先针对 arm64 + wayland 添加 --disable-gpu 的逻辑,
# 现在 arm64 设备无论是否使用 wayland 均不再添加此参数。
# 执行程序(不使用 exec以便捕获退出状态
/opt/spark-store/bin/spark-store $ARGS "$@"
exit_code=$?
# 若程序退出码非0使用 zenity 弹出友好提示
if [ $exit_code -ne 0 ]; then
if command -v zenity >/dev/null 2>&1; then
zenity --warning --width=600 --text="检测到您可能无法正确打开商店,可手动回退到旧版。\n在终端中执行 sudo aptss install spark-store-legacy -y 即可降级。\n\n对于银河麒麟您可以尝试 APM 网页版商店 https://amber-pm.spark-app.store/"
else
# 降级方案:若 zenity 不可用,至少输出错误信息到终端
echo "警告: 程序异常退出(退出码 $exit_code),但无法显示图形提示。您可以尝试手动降级:" >&2
echo "sudo aptss install spark-store-legacy -y" >&2
echo "或访问 APM 网页版商店: https://amber-pm.spark-app.store/" >&2
fi
fi
exit $exit_code