#!/usr/bin/env bash # install-linux.sh — install ps5upload-engine as a systemd user service # that starts on login and restarts on failure. # # Usage: # ./scripts/autolaunch/install-linux.sh [--ps5-addr HOST:PORT] # # Requirements: systemd (user session), cargo already installed. # The engine binary is built from engine/ via cargo. set -euo pipefail REPO_DIR="$(cd "$(dirname "$0")/../.." && pwd)" PS5_ADDR="${PS5_ADDR:-192.168.137.2:9113}" # Engine listens on 19113 by default; matches the hard-coded URL the # desktop client probes when it spawns the engine as a sidecar, and # the env var name the engine reads (`PS5UPLOAD_ENGINE_PORT`). PS5UPLOAD_ENGINE_PORT="${PS5UPLOAD_ENGINE_PORT:-19113}" SERVICE_NAME="ps5upload-engine" UNIT_DIR="${HOME}/.config/systemd/user" for arg in "$@"; do case "$arg" in --ps5-addr=*) PS5_ADDR="${arg#--ps5-addr=}" ;; --engine-port=*) PS5UPLOAD_ENGINE_PORT="${arg#--engine-port=}" ;; esac done echo "==> Building engine release binary..." cargo build --release -p ps5upload-engine --manifest-path "${REPO_DIR}/engine/Cargo.toml" ENGINE_BIN="${REPO_DIR}/engine/target/release/ps5upload-engine" echo "==> Installing systemd user unit..." mkdir -p "${UNIT_DIR}" cat > "${UNIT_DIR}/${SERVICE_NAME}.service" <