Ark CA

by agracie
4 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="sessionname" Label="sessionname" default="Ark Server" />
#<UDF name="motd" Label="motd" default="Powered by Linode!" />
#<UDF name="xpmultiplier" Label="xpmultiplier"default="2" />
#<UDF name="hardcore" Label="hardcore" default="False" />
#<UDF name="serverpassword" Label="serverpassword" default="" />
#<UDF name="serverpve" Label="serverpve" default="False" />

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

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

GAMESERVER="arkserver"

set_hostname
apt_setup_update

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

# ARK 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

# Install linuxGSM
linuxgsm_install

# Install ARK
game_install

# Setup crons and create systemd service file
service_config

#Game Config Options

sed -i s/XPMultiplier=.*/XPMultiplier="$XPMULTIPLIER"/ /home/arkserver/serverfiles/ShooterGame/Saved/Config/LinuxServer/GameUserSettings.ini
sed -i s/ServerPassword=.*/ServerPassword="$SERVERPASSWORD"/ /home/arkserver/serverfiles/ShooterGame/Saved/Config/LinuxServer/GameUserSettings.ini
sed -i s/ServerHardcore=.*/ServerHardcore="$SERVERPASSWORD"/ /home/arkserver/serverfiles/ShooterGame/Saved/Config/LinuxServer/GameUserSettings.ini
sed -i s/ServerPVE=.*/ServerPVE="$SERVERPVE"/ /home/arkserver/serverfiles/ShooterGame/Saved/Config/LinuxServer/GameUserSettings.ini
sed -i s/Message=.*/Message="$MOTD"/ /home/arkserver/serverfiles/ShooterGame/Saved/Config/LinuxServer/GameUserSettings.ini
sed -i s/SessionName=.*/SessionName="$SESSIONNAME"/ /home/arkserver/serverfiles/ShooterGame/Saved/Config/LinuxServer/GameUserSettings.ini

# Start the service and setup firewall
ufw_install
ufw allow 27015/udp
ufw allow 7777:7778/udp
ufw allow 27020/tcp
ufw enable
fail2ban_install
systemctl start "$GAMESERVER".service
systemctl enable "$GAMESERVER".service
stackscript_cleanup