#!/bin/bash
# LGSM fn_install_ut2k4 function
# Author: Daniel Gibbs
# Website: http://gameservermanagers.com
# Version: 210115

echo "Installing ${gamename} Server"
echo "================================="
sleep 1
mkdir -pv "${filesdir}"
cd "${filesdir}"
echo "Extracting dedicatedserver3339-bonuspack.zip"
sleep 1
unzip dedicatedserver3339-bonuspack.zip
echo "Extracting ut2004-lnxpatch3369-2.tar.bz2"
sleep 1
tar -xvjf ut2004-lnxpatch3369-2.tar.bz2 UT2004-Patch/ --strip-components=1
while true; do
	read -p "Was the install successful? [y/N]" yn
	case $yn in
	[Yy]* ) break;;
	[Nn]* ) fn_install_retry;;
	* ) echo "Please answer yes or no.";;
esac
done
while true; do
	read -p "Remove ut2004-lnxpatch3369-2.tar.bz2? [y/N]" yn
	case $yn in
	[Yy]* ) rm -fv ut2004-lnxpatch3369-2.tar.bz2; break;;
	[Nn]* ) break;;
	* ) echo "Please answer yes or no.";;
	esac
done
while true; do
	read -p "Remove dedicatedserver3339-bonuspack.zip? [y/N]" yn
	case $yn in
	[Yy]* ) rm -fv dedicatedserver3339-bonuspack.zip; break;;
	[Nn]* ) break;;
	* ) echo "Please answer yes or no.";;
	esac
done
echo ""