-
-
Save Kattoor/7485c1ad3bfd6255f099d02b8b0f8d2d to your computer and use it in GitHub Desktop.
Automated Task Force Elite community server setup for Linux machines
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 | |
{ | |
sudo killall --user tfe | |
sudo userdel tfe | |
sudo rm -rf /home/tfe | |
} &> /dev/null | |
printf "Installing lib32gcc1... " | |
{ | |
apt-get install lib32gcc1 | |
} &> /dev/null | |
printf "done\n" | |
printf "Creating user tfe with password $1... " | |
{ | |
sudo adduser tfe --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password | |
echo "tfe:$1" | sudo chpasswd | |
} &> /dev/null | |
sleep 0.2 | |
printf "done\n" | |
sudo -i -u tfe bash << 'EOF' | |
mkdir /home/tfe/TFEServerTools | |
cd TFEServerTools | |
printf "Downloading Steam... " | |
{ | |
wget -q -O - https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz | tar xzv | |
} &> /dev/null | |
printf "done\n" | |
printf "Downloading server tools..." | |
echo "./steamcmd.sh +login anonymous +force_install_dir servertools +app_update 1170680 validate" > updateserver.sh | |
chmod +x updateserver.sh | |
script -c 'echo "exit" | ./updateserver.sh' | awk \ | |
'/%] Downloading update \(/ {printf "\33[2K\rDownloading server tools... %s", substr($0, index($0, $2), index($0, $3) - index($0, $2) - 2)} /\[100%\] Download/ {printf "\33[2K\rDownloading server tools... done\r\nUpdating server tools..."} /Update state \(0x/ {printf "\33[2K\rUpdating server tools... %s%", substr($0, index($0, $6), index($0, $7) - index($0, $6) - 2)} /Success! App / { printf "\33[2K\rUpdating server tools... done\r\n"}' | |
EOF | |
sudo -i -u tfe bash << 'EOF' | |
printf "Setting up config files... " | |
cd /home/tfe/TFEServerTools/servertools/CommunityTool | |
printf "done\n" | |
echo "" | ./Setup.sh | awk '/Username: / {print "=====================================\n| Username: " $2 ", password: " $5 " |\n====================================="}' | |
printf "Creating server shell scripts... " | |
printf "#!/bin/bash\n'../jre/bin/java' -jar MS.jar" > MS/MS.sh | |
chmod +x MS/MS.sh | |
printf "#!/bin/bash\n'../jre/bin/java' -jar DSC.jar" > DSC/DSC.sh | |
chmod +x DSC/DSC.sh | |
printf "#!/bin/bash\n'jre/bin/java' -jar Helper.jar" > Helper.sh | |
chmod +x Helper.sh | |
printf "done\n" | |
printf "Running server shell scripts... 1/3" | |
cd MS | |
{ | |
echo "" | nohup ./MS.sh & | |
} &> /dev/null | |
sleep 2 | |
printf "\33[2K\rRunning server shell scripts... 2/3" | |
cd ../DSC | |
{ | |
echo "" | nohup ./DSC.sh & | |
} &> /dev/null | |
sleep 2 | |
printf "\33[2K\rRunning server shell scripts... 3/3" | |
cd .. | |
{ | |
echo "" | nohup ./Helper.sh & | |
} &> /dev/null | |
printf "\33[2K\rRunning server shell scripts... done\n" | |
ps aux | awk '/^tfe.*\.jar$/ { print "Process " $NF " running with PID " $2}' | |
printf "Finished!\n" | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment