Skip to content

Instantly share code, notes, and snippets.

@kythyria
Created July 25, 2018 00:46
Show Gist options
  • Save kythyria/4981bb9ed33ce0f451d8c53098b23eb4 to your computer and use it in GitHub Desktop.
Save kythyria/4981bb9ed33ce0f451d8c53098b23eb4 to your computer and use it in GitHub Desktop.
set +x
steam_user="anonymous"
steam_pass=""
steam_workshopcollection=""
server_hostname="LinuxGSM"
rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
steamcmddir="${rootdir}/steamcmd"
serverfiles="${rootdir}/serverfiles"
servercfgdir="${serverfiles}/left4dead2/cfg"
mkdir -p "${steamcmddir}"
curl -o - --progress-bar http://media.steampowered.com/client/steamcmd_linux.tar.gz | tar xvvz
./steamcmd.sh +login "${steam_user}" "${steam_pass}" +force_install_dir "${serverfiles}" +app_update "222860" +quit
./steamcmd.sh +login "${steam_user}" "${steam_pass}" +force_install_dir "${serverfiles}" +app_update "222860" validate +quit
random=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 8 | xargs)
cat >"${servercfgdir}/server.cfg" <<SERVER_CONFIG
// Hostname for server.
hostname "${server_hostname}"
// RCON - remote console password.
rcon_password "admin${random}"
// Server password - for private servers.
sv_password ""
// Server Logging
log on
sv_logbans 1
sv_logecho 1
sv_logfile 1
sv_log_onefile 0
SERVER_CONFIG
if [ -n "$steam_workshopcollection" ] then;
curl -o steam_workshop_downloader.py 'https://github.com/Geam/steam_workshop_downloader/raw/master/workshop.py'
chmod +x steam_workshop_downloader.py
./steam_workshop_downloader.py -o "${server_addondir}" "${steam_workshopcollection}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment