#! /bin/bash set -uxe update_cssds() { cd $STEAMCMD ./steamcmd.sh +runscript "$HOME/etc/update_cssds.txt" echo "--------------------------------------------------------------" echo "CSS DS is up to date" echo "--------------------------------------------------------------" } update_tf2ds() { cd $STEAMCMD ./steamcmd.sh +runscript "$HOME/etc/update_tf2ds.txt" echo "--------------------------------------------------------------" echo "TF2 DS is up to date" echo "--------------------------------------------------------------" } install_metamod() { # is the metamod folder missing? if [ ! -d "$CSSDS/addons/metamod" ]; then LATESTMM=$(wget -qO- https://mms.alliedmods.net/mmsdrop/"${METAMOD_VERSION}"/mmsource-latest-linux) wget -qO- https://mms.alliedmods.net/mmsdrop/"${METAMOD_VERSION}"/"${LATESTMM}" | tar xvzf - -C "$CSSDS" echo "--------------------------------------------------------------" echo "Installed MetaMod $METAMOD_VERSION" echo "--------------------------------------------------------------" fi } install_sourcemod() { # Are we in a sourcemod container and is the sourcemod folder missing? if [ ! -d "$CSSDS/addons/sourcemod" ]; then LATESTSM=$(wget -qO- https://sm.alliedmods.net/smdrop/"${SOURCEMOD_VERSION}"/sourcemod-latest-linux) wget -qO- https://sm.alliedmods.net/smdrop/"${SOURCEMOD_VERSION}"/"${LATESTSM}" | tar xvzf - -C "$CSSDS" echo "--------------------------------------------------------------" echo "Installed SourceMod $SOURCEMOD_VERSION" echo "--------------------------------------------------------------" fi } copy_64bit() { cp -a "$TF2DS/bin/linux64/libsteam_api.so" \ "$CSSDS/bin/linux64/." cp -a "$TF2DS/srcds_linux64" "$TF2DS/srcds_run_64" \ "$CSSDS/." } symlink_binaries() { cd "$CSSDS/bin/linux64" for file in *_srv.so; do echo "Symlinking \"$file\" to \"${file/_srv/}" ln -s "$file" "${file/_srv/}" done } steamclient_binary() { echo "Looking for steamclient.so and symlinking it..." local _steamclient64bit=$(find "$HOME" -type f -name 'steamclient.so' | grep "linux64" | head -n 1) if [ ! -n $_steamclient64bit ]; then echo "Could not locate 64-bit steamclient.so binary. Exiting..." exit 1 fi mkdir -p "$HOME/.steam/sdk64/" # srcds_linux64 looks for steamclient.so in this directory ln -nfs "$_steamclient64bit" "$HOME/.steam/sdk64/steamclient.so" ln -nfs "$_steamclient64bit" "$CSSDS/bin/linux64/steamclient.so" } run_cssds() { echo "ready to run" cd "$CSSDS" ./srcds_run_64 -game cstrike +map de_dust2 -debug } main() { update_cssds update_tf2ds copy_64bit symlink_binaries steamclient_binary install_metamod install_sourcemod run_cssds } main