#!/bin/sh
#
# Reaper's Sky - one-shot server installer.
#
# Fetches deploy.sh + mods.json from the repo into a temp dir, then runs
# deploy.sh with bash. Keeps it runnable via a single pipe:
#
#   curl -sSL <this-raw-url> | sh
#
# Needs: curl, bash, python3 (apt-installed by deploy.sh on Debian 13).
set -eu

BASE="https://git.reaperofveriod.nl/ReaperOfVeriod/Reaper-s-Sky/raw/branch/main/server"
TMP="$(mktemp -d)"

cleanup() { rm -rf "$TMP"; }
trap cleanup EXIT INT TERM

cd "$TMP"
curl -fsSL -o deploy.sh "$BASE/deploy.sh"
curl -fsSL -o mods.json "$BASE/mods.json"
exec bash deploy.sh "$@"