forked from LiamAEdwards/SS14-Docker-Linux-Server
30 lines
836 B
Bash
30 lines
836 B
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
|
|
chmod +x "$SERVER_PATH"
|
|
exec "$SERVER_PATH" "$@"
|