Rust CA

by agracie
3 deployments · 1 still active · last rev. 5 days ago

Compatible with: Debian 9
						#!/bin/bash
#
#<UDF name="pubkey" Label="SSH pubkey (installed for root and sudo user)?" example="ssh-rsa ..." />
#<UDF name="gslt" label="Steam token" example="Steam gameserver token. Needed to list as public server" default="" />
#<UDF name="globalchat" label="global chat" default="true" />
#<UDF name="pve" label="pve" default="false" />
#<UDF name="falldamage" label="falldamage" default="true" />
#<UDF name="description" label="description" default="Powered by Linode!" />
#<UDF name="maxplayers" label="maxplayers" default="50" />
#<UDF name="worldsize" label="worldsize" default="3000" />
#<UDF name="seed" label="seed" default="50000" />
#<UDF name="level" label="level" example=" Barren, Craggy Island, Hapis, Savas Island" default="Procedural Map" />


source <ssinclude StackScriptID="349139">
source <ssinclude StackScriptID="370022">

exec 1> >(tee -a "/var/log/stackscript.log") 2>&1

GAMESERVER="rustserver"

set_hostname
apt_setup_update

if [[ "$PUBKEY" != "" ]]; then
  add_pubkey
fi

# CSGO specific dependencies
debconf-set-selections <<< "postfix postfix/main_mailer_type string 'No Configuration'"
debconf-set-selections <<< "postfix postfix/mailname string `hostname`"
dpkg --add-architecture i386
apt update
sudo apt -q -y install mailutils postfix curl \
wget file bzip2 gzip unzip bsdmainutils python \
util-linux ca-certificates binutils bc jq tmux \
lib32gcc1 libstdc++6 libstdc++6:i386 lib32z1

# Install linuxGSM
linuxgsm_install

# Install CSGO
game_install

# Setup crons and create systemd service file
service_config

#Game Config Options

sed -i s/server\.url/#server\.url/ /home/rustserver/serverfiles/server/rustserver/cfg/server.cfg
sed -i s/#server\.globalchat true/server\.globalchat $GLOBALCHAT/ /home/rustserver/serverfiles/server/rustserver/cfg/server.cfg
sed -i s/#server\.pve false/server\.pve $PVE/ /home/rustserver/serverfiles/server/rustserver/cfg/server.cfg
sed -i s/#falldamage\.enabled true/#falldamage\.enabled $FALLDAMAGE/ /home/rustserver/serverfiles/server/rustserver/cfg/server.cfg
sed -i s/server\.description.*/sever\.description $DESCRIPTION/ /home/rustserver/serverfiles/server/rustserver/cfg/server.cfg
echo "server.maxplayers $MAXPLAYERS" >> /home/rustserver/serverfiles/server/rustserver/cfg/server.cfg
echo "server.worldsize $WORLDSIZE" >> /home/rustserver/serverfiles/server/rustserver/cfg/server.cfg
echo "server.seed $SEED" >> /home/rustserver/serverfiles/server/rustserver/cfg/server.cfg
echo "server.level $LEVEL" >> /home/rustserver/serverfiles/server/rustserver/cfg/server.cfg


# Start the service and setup firewall
ufw_install
ufw allow 28015
ufw allow 28016
ufw enable
fail2ban_install
systemctl start "$GAMESERVER".service
systemctl enable "$GAMESERVER".service
stackscript_cleanup