#!/bin/bash set -eo pipefail VOLUME_HOME="/home/steam/volumes" # # STEAM/INSTALL GAME # # If STEAM_USER or STEAM_PASSWORD is not set if [ -z "$STEAM_USER" ] || [ -z "$STEAM_PASSWORD" ]; then echo "STEAM_USER or STEAM_PASSWORD is not set. Its recommended to create a new steam user for the server." exit 1 fi # Update or install Arma 3 echo "Updating or installing Arma 3..." # https://developer.valvesoftware.com/wiki/SteamCMD /home/steam/steamcmd/steamcmd.sh +force_install_dir /home/steam/server +login "$STEAM_USER" "$STEAM_PASSWORD" +app_update 233780 +quit # # PREPARE GAME # # Check if config file exists if [ ! -f "$VOLUME_HOME/config/config.cfg" ]; then echo "Config file not found, creating..." # TODO: Create config file touch "$VOLUME_HOME/config/config.cfg" fi # https://community.bistudio.com/wiki/Arma_3:_Startup_Parameters#Server_Options SERVER_ARGS="-name server -config=$VOLUME_HOME/config/config.cfg -profiles=$VOLUME_HOME/config/profiles" if [ -n "$LIMIT_FPS" ]; then SERVER_ARGS="${SERVER_ARGS} -limitFPS=${LIMIT_FPS}" fi if [ -n "$PORT" ]; then SERVER_ARGS="${SERVER_ARGS} -port=${PORT}" fi # # PREAPRE MODS # MOD_LINK_DIR="/home/steam/server/mods" mkdir -p "$MOD_LINK_DIR" rm -f "$MOD_LINK_DIR"/* MODS_TO_LOAD="" for mod_id in $(curl -s "https://steamcommunity.com/sharedfiles/filedetails/?id=$WORKSHOP_COLLECTION" | grep -E 'id="sharedfile_[0-9]+"' | sed 's/.*id="sharedfile_\([0-9]\+\)".*/\1/') do # Check if directory exists if [ ! -d "$VOLUME_HOME/mods/$mod_id" ]; then echo "Could not find mod directory for $mod_id" echo "Try to download it first" exit 1 fi ln -s "$VOLUME_HOME/mods/$mod_id" "$MOD_LINK_DIR/$mod_id" MODS_TO_LOAD="${MODS_TO_LOAD}mods/${mod_id};" done if [ -n "$MODS_TO_LOAD" ]; then SERVER_ARGS="${SERVER_ARGS} -mod=${MODS_TO_LOAD::-1}" fi # # LINK MISSIONS # rm -r /home/steam/server/mpmissions ln -s "$VOLUME_HOME/missions" "/home/steam/server/mpmissions" # SERVER_ARGS="${SERVER_ARGS} -serverMod=${SERVER_MODS}" # # RUN GAME # echo "Starting server with args: " echo "$SERVER_ARGS" # Start the server echo "Starting the server..." /home/steam/server/arma3server_x64 ${SERVER_ARGS}