Ark - Latest One-Click

by linode
5 deployments · 4 still active · last rev. 1 month ago

Compatible with: Debian 9
						#!/bin/bash
#
#<UDF name="rconpassword" Label="RCON password" />
#<UDF name="pubkey" Label="SSH Key" example="ssh-rsa..." default="" />
#<UDF name="sessionname" Label="Server Name" default="Ark Server" />
#<UDF name="motd" Label="Message of the Day" default="Powered by Linode!" />
#<UDF name="serverpassword" Label="Server Password" default="" />
#<UDF name="hardcore" Label="Hardcore Mode Enabled" oneOf="True,False" default="False" />
#<UDF name="xpmultiplier" Label="XP Multiplier" oneOf="1,1.5,2,5,10,20" default="2" />
#<UDF name="serverpve" Label="Server PvE" oneOf="True,False" default="False" />

source <ssinclude StackScriptID="401711">
source <ssinclude StackScriptID="401712">

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
sed -i s/ServerAdminPassword=.*/ServerAdminPassword="\"$RCONPASSWORD\""/ /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