2019-12-02 09:04:10 +08:00
#!/bin/bash
# steamcmd Base Installation Script
#
# Server Files: /mnt/server
2021-11-27 14:28:42 +08:00
# Image to install with is 'ghcr.io/parkervcp/installers:debian'
2020-07-11 20:47:43 +08:00
##
#
# Variables
# STEAM_USER, STEAM_PASS, STEAM_AUTH - Steam user setup. If a user has 2fa enabled it will most likely fail due to timeout. Leave blank for anon install.
# WINDOWS_INSTALL - if it's a windows server you want to install set to 1
# SRCDS_APPID - steam app id ffound here - https://developer.valvesoftware.com/wiki/Dedicated_Servers_List
2021-03-30 09:41:16 +08:00
# INSTALL_FLAGS - when a server has extra glas for things like beta installs or updates.
2020-07-11 20:47:43 +08:00
#
##
2019-12-02 09:04:10 +08:00
apt -y update
2021-11-27 14:28:42 +08:00
apt -y --no-install-recommends install curl lib32gcc-s1 ca-certificates
2019-12-02 09:04:10 +08:00
## just in case someone removed the defaults.
2021-03-30 09:41:16 +08:00
if [ [ " ${ STEAM_USER } " = = "" ] ] || [ [ " ${ STEAM_PASS } " = = "" ] ] ; then
2019-12-15 23:08:23 +08:00
echo -e "steam user is not set.\n"
echo -e "Using anonymous user.\n"
2019-12-02 09:04:10 +08:00
STEAM_USER = anonymous
STEAM_PASS = ""
STEAM_AUTH = ""
2019-12-15 23:08:23 +08:00
else
echo -e " user set to ${ STEAM_USER } "
2019-12-02 09:04:10 +08:00
fi
## download and install steamcmd
cd /tmp
mkdir -p /mnt/server/steamcmd
2019-12-08 23:18:25 +08:00
curl -sSL -o steamcmd.tar.gz https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
2019-12-02 09:04:10 +08:00
tar -xzvf steamcmd.tar.gz -C /mnt/server/steamcmd
2021-06-10 04:44:22 +08:00
mkdir -p /mnt/server/steamapps # Fix steamcmd disk write error when this folder is missing
2019-12-02 09:04:10 +08:00
cd /mnt/server/steamcmd
# SteamCMD fails otherwise for some reason, even running as root.
# This is changed at the end of the install process anyways.
chown -R root:root /mnt
export HOME = /mnt/server
## install game using steamcmd
2021-11-27 14:28:42 +08:00
./steamcmd.sh +force_install_dir /mnt/server +login ${ STEAM_USER } ${ STEAM_PASS } ${ STEAM_AUTH } $( [ [ " ${ WINDOWS_INSTALL } " = = "1" ] ] && printf %s '+@sSteamCmdForcePlatformType windows' ) +app_update ${ SRCDS_APPID } ${ INSTALL_FLAGS } validate +quit ## other flags may be needed depending on install. looking at you cs 1.6
2019-12-02 09:04:10 +08:00
## set up 32 bit libraries
mkdir -p /mnt/server/.steam/sdk32
cp -v linux32/steamclient.so ../.steam/sdk32/steamclient.so
## set up 64 bit libraries
mkdir -p /mnt/server/.steam/sdk64
2021-06-10 04:44:22 +08:00
cp -v linux64/steamclient.so ../.steam/sdk64/steamclient.so