Files
SunshineDeps/linux-x64/phserver/phserver.sh

51 lines
1.4 KiB
Bash
Raw Normal View History

2025-10-28 17:23:14 +08:00
#!/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}"
# Read system information
if [ -f /etc/os-release ]; then
source /etc/os-release
# Detect if it's UOS V20
2025-11-04 12:49:37 +08:00
if [[ "${NAME}" == "uos" ]] && [[ "${VERSION_ID}" == "20" ]]; then
2025-10-28 17:23:14 +08:00
echo "Detected UOS V20, running with ablrun..."
2025-11-06 14:07:40 +08:00
bash# 定义 ablrun 的完整路径
ABLRUN="$(dirname "${BASH_SOURCE[0]}")/abl_portable/usr/bin/ablrun"
2025-10-28 17:23:14 +08:00
# 检查 ablrun 是否可用
2025-11-06 14:07:40 +08:00
if [[ -x "${ABLRUN}" ]]; then
"${ABLRUN}" "${APPIMAGE}" "$@"
2025-10-28 17:23:14 +08:00
else
2025-11-06 14:07:40 +08:00
echo "Warning: ablrun not found at ${ABLRUN}, trying direct execution..."
2025-10-28 17:23:14 +08:00
"${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}