#!/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 if [[ "${name}" == "uos" ]] && [[ "${VERSION_ID}" == "20" ]]; then echo "Detected UOS V20, running with ablrun..." # 检查 ablrun 是否可用 if command -v ablrun &> /dev/null; then ablrun "${APPIMAGE}" "$@" else echo "Warning: ablrun command not available, 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}