Files
Codex Agent 8633363c22
Some checks failed
Build and publish wylab SS14 server / build-and-push-image (push) Has been cancelled
CI: cache build artifacts and configs
2025-12-14 23:33:08 +01:00

37 lines
1.1 KiB
Bash

#!/bin/bash
# Check if directory is empty
if [ ! "$(ls -A /ss14)" ]; then
# Copy the default files
cp -R /ss14-default/* /ss14/
fi
# Locate the watchdog binary if it exists (older builds)
WATCHDOG_PATH=$(find /ss14 -maxdepth 4 -type f -name "SS14.Watchdog" | head -n 1)
if [ -n "$WATCHDOG_PATH" ]; then
WATCHDOG_DIR=$(dirname "$WATCHDOG_PATH")
cd "$WATCHDOG_DIR" || exit 1
chmod +x "$WATCHDOG_PATH"
exec "$WATCHDOG_PATH" "$@"
fi
# Fallback for new builds where only Robust.Server is shipped
SERVER_PATH=$(find /ss14 -maxdepth 4 -type f -name "Robust.Server" | head -n 1)
if [ -z "$SERVER_PATH" ]; then
echo "No SS14.Watchdog or Robust.Server executable found under /ss14" >&2
exit 1
fi
SERVER_DIR=$(dirname "$SERVER_PATH")
cd "$SERVER_DIR" || exit 1
# Auto-sync build.download_url and build hash from Robust.Cdn manifest.
CONFIG_PATH="$SERVER_DIR/server_config.toml"
if command -v python3 >/dev/null && [ -f "$CONFIG_PATH" ] && [ -f /update_build_metadata.py ]; then
python3 /update_build_metadata.py "$CONFIG_PATH" || echo "[WARN] Unable to update build metadata"
fi
chmod +x "$SERVER_PATH"
exec "$SERVER_PATH" "$@"