67 changed files with 1469 additions and 1348 deletions
@ -1,23 +0,0 @@ |
|||
#!/bin/bash |
|||
# LGSM check_steamuser.sh function |
|||
# Author: Daniel Gibbs |
|||
# Website: http://gameservermanagers.com |
|||
lgsm_version="271215" |
|||
|
|||
if [ "${steamuser}" == "username" ]; then |
|||
fn_printfailnl "Steam login not set. Update steamuser." |
|||
echo " * Change steamuser=\"username\" to a valid steam login." |
|||
if [ -d ${scriptlogdir} ]; then |
|||
fn_scriptlog "edit ${selfname}. change steamuser=\"username\" to a valid steam login." |
|||
exit 1 |
|||
fi |
|||
fi |
|||
if [ -z "${steamuser}" ]; then |
|||
fn_printwarnnl "Steam login not set. Using anonymous login." |
|||
if [ -d "${scriptlogdir}" ]; then |
|||
fn_scriptlog "Steam login not set. Using anonymous login." |
|||
fi |
|||
steamuser="anonymous" |
|||
steampass="" |
|||
sleep 2 |
|||
fi |
@ -1,11 +1,11 @@ |
|||
#!/bin/bash |
|||
# LGSM check_systemdir.sh function |
|||
# LGSM check_system_dir.sh function |
|||
# Author: Daniel Gibbs |
|||
# Website: http://gameservermanagers.com |
|||
lgsm_version="271215" |
|||
|
|||
if [ ! -d "${systemdir}" ]; then |
|||
fn_printfailnl "Cannot access ${systemdir}: No such directory" |
|||
fn_print_fail_nl "Cannot access ${systemdir}: No such directory" |
|||
if [ -d "${scriptlogdir}" ]; then |
|||
fn_scriptlog "Cannot access ${systemdir}: No such directory." |
|||
fi |
@ -0,0 +1,202 @@ |
|||
#!/bin/bash |
|||
# LGSM core_dl.sh function |
|||
# Author: Daniel Gibbs |
|||
# Website: http://gameservermanagers.com |
|||
lgsm_version="050216" |
|||
|
|||
# Description: Deals with all downloads for LGSM. |
|||
|
|||
# fileurl: The URL of the file: http://example.com/dl/File.tar.bz2 |
|||
# filedir: location the file is to be saved: /home/server/lgsm/tmp |
|||
# filename: name of file (this can be different from the url name): file.tar.bz2 |
|||
# executecmd: Optional, set to "executecmd" to make file executable using chmod +x |
|||
# run: Optional, set to run to execute the file |
|||
# force: Optional, force re-download of file even if exists |
|||
# md5: Optional, Checks file against an md5 sum |
|||
# |
|||
# Downloads can be defined in code like so: |
|||
# fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}" |
|||
# fn_fetch_file "http://example.com/file.tar.bz2" "/some/dir" "file.tar.bz2" "executecmd" "run" "force" "10cd7353aa9d758a075c600a6dd193fd" |
|||
|
|||
fn_dl_md5(){ |
|||
# Runs MD5 Check if available |
|||
if [ "${md5}" != "0" ]&&[ "${md5}" != "nomd5" ]; then |
|||
echo -ne "verifying ${filename} with MD5..." |
|||
sleep 1 |
|||
local md5sumcmd=$(md5sum "${filedir}/${filename}"|awk '{print $1;}') |
|||
if [ "${md5sumcmd}" != "${md5}" ]; then |
|||
fn_print_fail_eol_nl |
|||
echo "${filename} returned MD5 checksum: ${md5sumcmd}" |
|||
echo "expected MD5 checksum: ${md5}" |
|||
fn_scriptlog "verifying ${filename} with MD5: FAIL" |
|||
fn_scriptlog "${filename} returned MD5 checksum: ${md5sumcmd}" |
|||
fn_scriptlog "expected MD5 checksum: ${md5}" |
|||
exit 1 |
|||
else |
|||
fn_print_ok_eol_nl |
|||
fn_scriptlog "verifying ${filename} with MD5: OK" |
|||
fn_scriptlog "${filename} returned MD5 checksum: ${md5sumcmd}" |
|||
fn_scriptlog "expected MD5 checksum: ${md5}" |
|||
fi |
|||
fi |
|||
} |
|||
|
|||
# Extracts bzip2 or gzip files |
|||
# Extracts can be defined in code like so: |
|||
# fn_dl_extract "${filedir}" "${filename}" "${extractdir}" |
|||
# fn_dl_extract "/home/gameserver/lgsm/tmp" "file.tar.bz2" "/home/gamserver/serverfiles" |
|||
fn_dl_extract(){ |
|||
filedir="${1}" |
|||
filename="${2}" |
|||
extractdir="${3}" |
|||
# extracts archives |
|||
echo -ne "extracting ${filename}..." |
|||
fn_scriptlog "extracting download" |
|||
mime=$(file -b --mime-type "${filedir}/${filename}") |
|||
|
|||
if [ "${mime}" == "application/gzip" ]; then |
|||
tarcmd=$(tar -zxf "${filedir}/${filename}" -C "${extractdir}") |
|||
elif [ "${mime}" == "application/x-bzip2" ]; then |
|||
tarcmd=$(tar -jxf "${filedir}/${filename}" -C "${extractdir}") |
|||
fi |
|||
local exitcode=$? |
|||
if [ ${exitcode} -ne 0 ]; then |
|||
fn_print_fail_eol_nl |
|||
fn_scriptlog "extracting download: FAIL" |
|||
echo "${tarcmd}" | tee -a "${scriptlog}" |
|||
exit ${exitcode} |
|||
else |
|||
fn_print_ok_eol_nl |
|||
fi |
|||
} |
|||
|
|||
# Trap to remove file download if canceled before completed |
|||
fn_fetch_trap() { |
|||
echo "" |
|||
echo -ne "downloading ${filename}: " |
|||
fn_print_canceled_eol_nl |
|||
fn_scriptlog "downloading ${filename}: CANCELED" |
|||
sleep 1 |
|||
rm -f "${filedir}/${filename}" | tee -a "${scriptlog}" |
|||
echo -ne "downloading ${filename}: " |
|||
fn_print_removed_eol_nl |
|||
fn_scriptlog "downloading ${filename}: REMOVED" |
|||
exit |
|||
} |
|||
|
|||
fn_fetch_file(){ |
|||
fileurl="${1}" |
|||
filedir="${2}" |
|||
filename="${3}" |
|||
executecmd="${4:-0}" |
|||
run="${5:-0}" |
|||
force="${6:-0}" |
|||
md5="${7:-0}" |
|||
|
|||
# If the file is missing, then download |
|||
if [ ! -f "${filedir}/${filename}" ]; then |
|||
if [ ! -d "${filedir}" ]; then |
|||
mkdir -p "${filedir}" |
|||
fi |
|||
|
|||
# Check curl exists and use available path |
|||
curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl $(echo $PATH | sed "s/\([:]\|\$\)/\/curl /g")" |
|||
for curlcmd in ${curlpaths} |
|||
do |
|||
if [ -x "${curlcmd}" ]; then |
|||
break |
|||
fi |
|||
done |
|||
# If curl exists download file |
|||
if [ "$(basename ${curlcmd})" == "curl" ]; then |
|||
# trap to remove part downloaded files |
|||
trap fn_fetch_trap INT |
|||
# if larger file shows progress bar |
|||
if [ ${filename##*.} == "bz2" ]; then |
|||
echo -ne "downloading ${filename}..." |
|||
sleep 1 |
|||
curlcmd=$(${curlcmd} --progress-bar --fail -o "${filedir}/${filename}" "${fileurl}") |
|||
echo -ne "downloading ${filename}..." |
|||
else |
|||
echo -ne " fetching ${filename}...\c" |
|||
curlcmd=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${fileurl}" 2>&1) |
|||
fi |
|||
local exitcode=$? |
|||
if [ ${exitcode} -ne 0 ]; then |
|||
fn_print_fail_eol_nl |
|||
if [ -f "${scriptlog}" ]; then |
|||
fn_scriptlog "downloading ${filename}: FAIL" |
|||
fi |
|||
echo "${curlcmd}" | tee -a "${scriptlog}" |
|||
echo -e "${fileurl}\n" | tee -a "${scriptlog}" |
|||
exit ${exitcode} |
|||
else |
|||
fn_print_ok_eol_nl |
|||
if [ -f "${scriptlog}" ]; then |
|||
fn_scriptlog "downloading ${filename}: OK" |
|||
fi |
|||
fi |
|||
# remove trap |
|||
trap - INT |
|||
else |
|||
fn_print_fail_eol_nl |
|||
echo "Curl is not installed!" |
|||
echo -e "" |
|||
exit 1 |
|||
fi |
|||
# make file executecmd if executecmd is set |
|||
if [ "${executecmd}" == "executecmd" ]; then |
|||
chmod +x "${filedir}/${filename}" |
|||
fi |
|||
fi |
|||
|
|||
if [ -f "${filedir}/${filename}" ]; then |
|||
fn_dl_md5 |
|||
# run file if run is set |
|||
if [ "${run}" == "run" ]; then |
|||
source "${filedir}/${filename}" |
|||
fi |
|||
fi |
|||
} |
|||
|
|||
|
|||
|
|||
# fileurl: The directory the file is located in teh GitHub repo |
|||
# filedir: name of file |
|||
# filename: location file to be saved |
|||
# executecmd: set to "executecmd" to make file executecmd |
|||
# run: Optional, set to run to execute the file |
|||
# force: force download of file even if exists |
|||
# md5: Checks fail against an md5 sum |
|||
|
|||
|
|||
# Fetches files from the github repo |
|||
fn_fetch_file_github(){ |
|||
github_file_url_dir="${1}" |
|||
github_file_url_name="${2}" |
|||
githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" |
|||
fileurl="${githuburl}" |
|||
filedir="${3}" |
|||
filename="${github_file_url_name}" |
|||
executecmd="${4:-0}" |
|||
run="${5:-0}" |
|||
force="${6:-0}" |
|||
md5="${7:-0}" |
|||
fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}" |
|||
} |
|||
|
|||
|
|||
# Fetches functions |
|||
fn_fetch_function(){ |
|||
github_file_url_dir="functions" # github dir containing the file |
|||
github_file_url_name="${functionfile}" # name of the github file |
|||
githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" |
|||
fileurl="${githuburl}" |
|||
filedir="${functionsdir}" |
|||
filename="${github_file_url_name}" |
|||
executecmd="executecmd" |
|||
run="run" |
|||
force="noforce" |
|||
md5="nomd5" |
|||
fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}" |
|||
} |
@ -1,22 +1,22 @@ |
|||
#!/bin/bash |
|||
# LGSM update_functions.sh function |
|||
# LGSM fn_update_functions.sh function |
|||
# Author: Daniel Gibbs |
|||
# Website: http://gameservermanagers.com |
|||
lgsm_version="230116" |
|||
|
|||
# Description: LEGACY FUNCTION Deletes the functions dir to allow re-downloading of functions from GitHub. |
|||
|
|||
fn_printdots "Updating functions" |
|||
fn_print_dots "Updating functions" |
|||
fn_scriptlog "Updating functions" |
|||
sleep 1 |
|||
echo -ne "\n" |
|||
rm -rfv "${rootdir}/functions/"* |
|||
exitcode=$? |
|||
if [ "${exitcode}" == "0" ]; then |
|||
fn_printok "Updating functions" |
|||
fn_print_ok "Updating functions" |
|||
fn_scriptlog "Success! Updating functions" |
|||
else |
|||
fn_printfail "Updating functions" |
|||
fn_print_fail "Updating functions" |
|||
fn_scriptlog "Failure! Updating functions" |
|||
fi |
|||
echo -ne "\n" |
@ -1,54 +0,0 @@ |
|||
#!/bin/bash |
|||
# LGSM install_dl_ut2k4.sh function |
|||
# Author: Daniel Gibbs |
|||
# Website: http://gameservermanagers.com |
|||
lgsm_version="271215" |
|||
|
|||
echo "" |
|||
echo "Downloading Server Files" |
|||
echo "=================================" |
|||
sleep 1 |
|||
cd "${filesdir}" |
|||
if [ ! -f dedicatedserver3339-bonuspack.zip ]; then |
|||
wget http://gameservermanagers.com/files/ut2004/dedicatedserver3339-bonuspack.zip |
|||
else |
|||
echo "dedicatedserver3339-bonuspack.zip already downloaded!" |
|||
fi |
|||
echo "Running MD5 checksum to verify the file" |
|||
sleep 1 |
|||
echo "MD5 checksum: d3f28c5245c4c02802d48e4f0ffd3e34" |
|||
md5check=$(md5sum dedicatedserver3339-bonuspack.zip|awk '{print $1;}') |
|||
echo "File returned: ${md5check}" |
|||
if [ "${md5check}" != "d3f28c5245c4c02802d48e4f0ffd3e34" ]; then |
|||
echo "MD5 checksum: FAILED!" |
|||
read -p "Retry download? [y/N]" yn |
|||
case $yn in |
|||
[Yy]* ) rm -fv dedicatedserver3339-bonuspack.zip; install_dl_ut2k4.sh;; |
|||
[Nn]* ) echo Exiting; exit;; |
|||
* ) echo "Please answer yes or no.";; |
|||
esac |
|||
else |
|||
echo "MD5 checksum: PASSED" |
|||
fi |
|||
if [ ! -f ut2004-lnxpatch3369-2.tar.bz2 ]; then |
|||
wget http://gameservermanagers.com/files/ut2004/ut2004-lnxpatch3369-2.tar.bz2 |
|||
else |
|||
echo "ut2004-lnxpatch3369-2.tar.bz2 already downloaded!" |
|||
fi |
|||
echo "Running MD5 checksum to verify the file" |
|||
sleep 1 |
|||
echo "MD5 checksum: 0fa447e05fe5a38e0e32adf171be405e" |
|||
md5check=$(md5sum ut2004-lnxpatch3369-2.tar.bz2|awk '{print $1;}') |
|||
echo "File returned: ${md5check}" |
|||
if [ "${md5check}" != "0fa447e05fe5a38e0e32adf171be405e" ]; then |
|||
echo "MD5 checksum: FAILED!" |
|||
read -p "Retry download? [y/N]" yn |
|||
case $yn in |
|||
[Yy]* ) rm -fv ut2004-lnxpatch3369-2.tar.bz2; install_dl_ut2k4.sh;; |
|||
[Nn]* ) echo Exiting; exit;; |
|||
* ) echo "Please answer yes or no.";; |
|||
esac |
|||
else |
|||
echo "MD5 checksum: PASSED" |
|||
fi |
|||
echo "" |
@ -1,54 +0,0 @@ |
|||
#!/bin/bash |
|||
# LGSM install_dl_ut99.sh function |
|||
# Author: Daniel Gibbs |
|||
# Website: http://gameservermanagers.com |
|||
lgsm_version="271215" |
|||
|
|||
echo "" |
|||
echo "Downloading Server Files" |
|||
echo "=================================" |
|||
sleep 1 |
|||
cd "${filesdir}" |
|||
if [ ! -f ut-server-436.tar.gz ]; then |
|||
wget http://gameservermanagers.com/files/ut99/ut-server-436.tar.gz |
|||
else |
|||
echo "ut-server-436.tar.gz already downloaded!" |
|||
fi |
|||
echo "Running MD5 checksum to verify the file" |
|||
sleep 1 |
|||
echo "MD5 checksum: 10cd7353aa9d758a075c600a6dd193fd" |
|||
md5check=$(md5sum ut-server-436.tar.gz|awk '{print $1;}') |
|||
echo "File returned: ${md5check}" |
|||
if [ "${md5check}" != "10cd7353aa9d758a075c600a6dd193fd" ]; then |
|||
echo "MD5 checksum: FAILED!" |
|||
read -p "Retry download? [y/N]" yn |
|||
case $yn in |
|||
[Yy]* ) rm -fv ut-server-436.tar.gz; fn_filesdl;; |
|||
[Nn]* ) echo Exiting; exit;; |
|||
* ) echo "Please answer yes or no.";; |
|||
esac |
|||
else |
|||
echo "MD5 checksum: PASSED" |
|||
fi |
|||
if [ ! -f UTPGPatch451.tar.bz2 ]; then |
|||
wget http://gameservermanagers.com/files/ut99/UTPGPatch451.tar.bz2 |
|||
else |
|||
echo "UTPGPatch451.tar.bz2 already downloaded!" |
|||
fi |
|||
echo "Running MD5 checksum to verify the file" |
|||
sleep 1 |
|||
echo "MD5 checksum: 77a735a78b1eb819042338859900b83b" |
|||
md5check=$(md5sum UTPGPatch451.tar.bz2|awk '{print $1;}') |
|||
echo "File returned: ${md5check}" |
|||
if [ "${md5check}" != "77a735a78b1eb819042338859900b83b" ]; then |
|||
echo "MD5 checksum: FAILED!" |
|||
read -p "Retry download? [y/N]" yn |
|||
case $yn in |
|||
[Yy]* ) rm -fv UTPGPatch451.tar.bz2; fn_filesdl;; |
|||
[Nn]* ) echo Exiting; exit;; |
|||
* ) echo "Please answer yes or no.";; |
|||
esac |
|||
else |
|||
echo "MD5 checksum: PASSED" |
|||
fi |
|||
echo "" |
@ -1,42 +0,0 @@ |
|||
#!/bin/bash |
|||
# LGSM install_ut2k4.sh function |
|||
# Author: Daniel Gibbs |
|||
# Website: http://gameservermanagers.com |
|||
lgsm_version="271215" |
|||
|
|||
echo "" |
|||
echo "Installing ${gamename} Server" |
|||
echo "=================================" |
|||
sleep 1 |
|||
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]* ) install_retry.sh;; |
|||
* ) 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 "" |
@ -1,42 +0,0 @@ |
|||
#!/bin/bash |
|||
# LGSM install_ut99.sh function |
|||
# Author: Daniel Gibbs |
|||
# Website: http://gameservermanagers.com |
|||
lgsm_version="271215" |
|||
|
|||
echo "" |
|||
echo "Installing ${gamename} Server" |
|||
echo "=================================" |
|||
sleep 1 |
|||
cd "${filesdir}" |
|||
echo "Extracting ut-server-436.tar.gz" |
|||
sleep 1 |
|||
tar -zxvf ut-server-436.tar.gz ut-server/ --strip-components=1 |
|||
echo "Extracting UTPGPatch451.tar.bz2" |
|||
sleep 1 |
|||
tar -jxvf UTPGPatch451.tar.bz2 |
|||
while true; do |
|||
read -p "Was the install successful? [y/N]" yn |
|||
case $yn in |
|||
[Yy]* ) break;; |
|||
[Nn]* ) install_retry.sh;; |
|||
* ) echo "Please answer yes or no.";; |
|||
esac |
|||
done |
|||
while true; do |
|||
read -p "Remove ut-server-436.tar.gz? [y/N]" yn |
|||
case $yn in |
|||
[Yy]* ) rm -fv ut-server-436.tar.gz; break;; |
|||
[Nn]* ) break;; |
|||
* ) echo "Please answer yes or no.";; |
|||
esac |
|||
done |
|||
while true; do |
|||
read -p "Remove UTPGPatch451.tar.bz2? [y/N]" yn |
|||
case $yn in |
|||
[Yy]* ) rm -fv UTPGPatch451.tar.bz2; break;; |
|||
[Nn]* ) break;; |
|||
* ) echo "Please answer yes or no.";; |
|||
esac |
|||
done |
|||
echo "" |
Loading…
Reference in new issue