- phserver.sh 检测 Kylin V10(NAME==Kylin/VERSION_ID==v10)同样走 ablrun - phserver.sh 每次拉起 sunshine 前调用 refresh-xauth.sh --wait 45,自愈开机 Xauthority 竞态 - abl_portable others/ 补 libwayland-client 1.21 与 libffi 3.3(Kylin V10 缺符号,见 README) - 删除 sunshine-0.23.1.AppImage:实测其 /api/pin 恒 false,配对不可用,已统一 2025.924 Co-Authored-By: Claude <noreply@anthropic.com>
59 lines
1.9 KiB
Bash
Executable File
59 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Get the absolute path of the script directory
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
APPIMAGE="${SCRIPT_DIR}/sunshine.AppImage"
|
|
|
|
# Check if AppImage file exists
|
|
if [ ! -f "${APPIMAGE}" ]; then
|
|
echo "Error: sunshine.AppImage not found"
|
|
echo "Path: ${APPIMAGE}"
|
|
exit 1
|
|
fi
|
|
|
|
# Ensure AppImage has execute permission
|
|
chmod +x "${APPIMAGE}"
|
|
|
|
# 每次拉起 sunshine 前刷新 /root/.Xauthority(最多等 45 秒登录就绪):
|
|
# 自愈开机竞态——服务 ExecStartPre 时机可能早于用户登录,cookie 是上次会话的,
|
|
# 会导致 sunshine capture 初始化失败、串流不可用。脚本不存在/失败不阻断启动。
|
|
REFRESH_XAUTH="${SCRIPT_DIR}/../refresh-xauth.sh"
|
|
if [ -f "${REFRESH_XAUTH}" ]; then
|
|
"${REFRESH_XAUTH}" --wait 45 || true
|
|
fi
|
|
|
|
# Read system information
|
|
if [ -f /etc/os-release ]; then
|
|
source /etc/os-release
|
|
|
|
# Detect if it's UOS V20 or Kylin V10(两者 glibc 偏老,需 ablrun 提供兼容 libc)
|
|
if [[ "${NAME}" == "uos" && "${VERSION_ID}" == "20" ]] || [[ "${NAME}" == "Kylin" && "${VERSION_ID}" == "v10" ]]; then
|
|
echo "Detected ${NAME} ${VERSION_ID}, running with ablrun..."
|
|
|
|
# 定义 ablrun 的完整路径
|
|
ABLRUN="$(dirname "${BASH_SOURCE[0]}")/abl_portable/usr/bin/ablrun"
|
|
# 检查 ablrun 是否可用
|
|
if [[ -x "${ABLRUN}" ]]; then
|
|
"${ABLRUN}" "${APPIMAGE}" "$@"
|
|
else
|
|
echo "Warning: ablrun not found at ${ABLRUN}, trying direct execution..."
|
|
"${APPIMAGE}" "$@"
|
|
fi
|
|
else
|
|
echo "Detected system: ${NAME} ${VERSION_ID}"
|
|
echo "Running sunshine.AppImage directly..."
|
|
"${APPIMAGE}" "$@"
|
|
fi
|
|
else
|
|
echo "Warning: Cannot read /etc/os-release, running AppImage directly..."
|
|
"${APPIMAGE}" "$@"
|
|
fi
|
|
|
|
# Capture exit status
|
|
EXIT_CODE=$?
|
|
if [ ${EXIT_CODE} -ne 0 ]; then
|
|
echo "Program exited abnormally, exit code: ${EXIT_CODE}"
|
|
fi
|
|
|
|
exit ${EXIT_CODE}
|