Last active
July 9, 2016 15:56
-
-
Save mitchellhuang/4557661 to your computer and use it in GitHub Desktop.
SRCDS/TF2 install on Ubuntu 12.04/12.10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# TF2/SRCDS install script by huangbong | |
# Last updated: 2013-01-18 | |
# https://gist.github.com/4557661/ | |
######################### | |
# Settings - edit this! | |
######################### | |
USER="username" # user that will be running the SRCDS instance (not root) | |
INSTALL_DIR="/tf2" # the directory where you want everything installed | |
NAME="coolservername" # the shortname of you server | |
PARAMS="-game tf -autoupdate -maxplayers 18 -console +map cp_badlands" # tf2 game parameters | |
# Don't edit anything else below unless you know what you're doing | |
function block_announce() { | |
if [ $# -eq 2 ] | |
then echo -e "$(tput setaf $1)$2$(tput sgr0)" | |
else echo -e "$(tput setaf 3)$1$(tput sgr0)" | |
fi | |
} | |
function announce() { | |
lineofequals="===========================" | |
if [ $# -eq 2 ] | |
then echo -e "$lineofequals\n$(tput setaf $1)$2$(tput sgr0)\n$lineofequals" | |
else echo -e "$lineofequals\n$(tput setaf 4)$1$(tput sgr0)\n$lineofequals" | |
fi | |
} | |
function user() { | |
sudo -u $USER $1 | |
} | |
set -e | |
block_announce "TF2/SRCDS install script by huangbong | |
Last updated: 2013-01-18 | |
https://gist.github.com/4557661/ | |
It is recommended to run this program in a screen or nohup. | |
Make sure you have edited the settings before starting the install. | |
Minimum install requirements: | |
- 512MB RAM | |
- 2GHz process | |
- Ubuntu 12.04 or higher" | |
echo | |
read -p "Press [Enter] to start the install " | |
if [[ $UID -ne 0 ]]; then | |
echo "$0 must be run as root or with sudo" | |
exit 1 | |
fi | |
announce "Updating system" | |
apt-get -y update | |
announce "Upgrading system" | |
apt-get -y upgrade | |
announce "Installing ia32-libs" | |
apt-get -y install ia32-libs | |
if [ ! -d "$INSTALL_DIR" ]; then | |
announce "Making tf2 directory" | |
mkdir $INSTALL_DIR | |
chown $USER:$USER $INSTALL_DIR | |
fi | |
cd "$INSTALL_DIR" | |
announce "Getting HLDS update tool..." | |
user "wget http://www.steampowered.com/download/hldsupdatetool.bin" | |
user "chmod +x hldsupdatetool.bin" | |
user "./hldsupdatetool.bin" | |
announce "Updating Steam... this may take a long time (up to 10 minutes) | |
Go get a coffee while you're waiting" | |
user "./steam" | |
user "./steam" | |
announce "Installing TF2" | |
user "mkdir $NAME" | |
user "./steam -command update -game tf -dir $NAME" | |
announce "Symlinking steam bin" | |
cd "$NAME/orangebox" | |
user "ln -s ../../steam ." | |
announce "Installing example server.cfg and rates.cfg to $INSTALL_DIR/$NAME/orangebox/tf/cfg/" | |
sudo -u $USER echo "hostname a new tf2 server | |
rcon_password example | |
exec rates.cfg" | tee "$INSTALL_DIR/$NAME/orangebox/tf/cfg/server.cfg" | |
sudo -u $USER echo "sv_minrate 35000 | |
sv_maxrate 70000 | |
sv_minupdaterate 33 | |
sv_maxupdaterate 67 | |
sv_mincmdrate 33 | |
sv_maxcmdrate 67" | tee "$INSTALL_DIR/$NAME/orangebox/tf/cfg/rates.cfg" | |
# announce "Installing srcds init script" | |
# still working on this | |
announce "Install complete" | |
block_announce "Run TF2/SRCDS with /etc/init.d/srcds (start|stop|restart|status) | |
The TF2/SRCDS install folder is at: $INSTALL_DIR/$NAME/orangebox/tf | |
An example server.cfg has been installed to cfg/server.cfg with a rates.cfg too" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment