|
|
@@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then
|
|
|
set -x
|
|
|
fi
|
|
|
|
|
|
-version="121215"
|
|
|
+version="200216"
|
|
|
|
|
|
#### Variables ####
|
|
|
|
|
|
@@ -28,6 +28,13 @@ parms="server ${defaultmap}.unr ini=${servercfgfullpath}"
|
|
|
|
|
|
#### Advanced Variables ####
|
|
|
|
|
|
+# Github Branch Select
|
|
|
+# Allows for the use of different function files
|
|
|
+# from a different repo and/or branch.
|
|
|
+githubuser="dgibbs64"
|
|
|
+githubrepo="linuxgsm"
|
|
|
+githubbranch="master"
|
|
|
+
|
|
|
# Server Details
|
|
|
servicename="ut99-server"
|
|
|
gamename="Unreal Tournament 99"
|
|
|
@@ -38,6 +45,8 @@ rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
|
|
|
selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
|
|
|
lockselfname=".${servicename}.lock"
|
|
|
filesdir="${rootdir}/serverfiles"
|
|
|
+lgsmdir="${rootdir}/lgsm"
|
|
|
+functionsdir="${lgsmdir}/functions"
|
|
|
systemdir="${filesdir}/System"
|
|
|
executabledir="${systemdir}"
|
|
|
executable="./ucc-bin"
|
|
|
@@ -60,66 +69,66 @@ emaillog="${scriptlogdir}/${servicename}-email.log"
|
|
|
scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
|
|
|
consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
|
|
|
|
|
|
-# Github Branch Select
|
|
|
-# Allows for the use of different function files
|
|
|
-# from a different repo and/or branch.
|
|
|
-githubuser="dgibbs64"
|
|
|
-githubrepo="linuxgsm"
|
|
|
-githubbranch="master"
|
|
|
-
|
|
|
##### Script #####
|
|
|
# Do not edit
|
|
|
|
|
|
-fn_getgithubfile(){
|
|
|
-filename=$1
|
|
|
-exec=$2
|
|
|
-fileurl=${3:-$filename}
|
|
|
-filepath="${rootdir}/${filename}"
|
|
|
-filedir=$(dirname "${filepath}")
|
|
|
-# If the function file is missing, then download
|
|
|
-if [ ! -f "${filepath}" ]; then
|
|
|
+# Fetches core_dl for file downloads
|
|
|
+fn_fetch_core_dl(){
|
|
|
+github_file_url_dir="functions"
|
|
|
+github_file_url_name="${functionfile}"
|
|
|
+filedir="${functionsdir}"
|
|
|
+filename="${github_file_url_name}"
|
|
|
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
|
|
|
+# If the file is missing, then download
|
|
|
+if [ ! -f "${filedir}/${filename}" ]; then
|
|
|
if [ ! -d "${filedir}" ]; then
|
|
|
- mkdir "${filedir}"
|
|
|
+ mkdir -p "${filedir}"
|
|
|
fi
|
|
|
- githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${fileurl}"
|
|
|
echo -e " fetching ${filename}...\c"
|
|
|
- if [ "$(command -v curl)" ]||[ "$(which curl >/dev/null 2>&1)" ]||[ -f "/usr/bin/curl" ]||[ -f "/bin/curl" ]; then
|
|
|
- :
|
|
|
- else
|
|
|
+ # 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
|
|
|
+ curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
|
|
|
+ if [ $? -ne 0 ]; then
|
|
|
+ echo -e "\e[0;31mFAIL\e[0m\n"
|
|
|
+ echo "${curlfetch}"
|
|
|
+ echo -e "${githuburl}\n"
|
|
|
+ exit 1
|
|
|
+ else
|
|
|
+ echo -e "\e[0;32mOK\e[0m"
|
|
|
+ fi
|
|
|
+ else
|
|
|
echo -e "\e[0;31mFAIL\e[0m\n"
|
|
|
echo "Curl is not installed!"
|
|
|
echo -e ""
|
|
|
- exit
|
|
|
- fi
|
|
|
- curl=$(curl --fail -o "${filepath}" "${githuburl}" 2>&1)
|
|
|
- if [ $? -ne 0 ]; then
|
|
|
- echo -e "\e[0;31mFAIL\e[0m\n"
|
|
|
- echo "${curl}"
|
|
|
- echo -e "${githuburl}\n"
|
|
|
- exit
|
|
|
- else
|
|
|
- echo -e "\e[0;32mOK\e[0m"
|
|
|
- fi
|
|
|
- if [ "${exec}" ]; then
|
|
|
- chmod +x "${filepath}"
|
|
|
+ exit 1
|
|
|
fi
|
|
|
+ chmod +x "${filedir}/${filename}"
|
|
|
fi
|
|
|
-if [ "${exec}" ]; then
|
|
|
- source "${filepath}"
|
|
|
-fi
|
|
|
+source "${filedir}/${filename}"
|
|
|
}
|
|
|
|
|
|
-fn_runfunction(){
|
|
|
- fn_getgithubfile "functions/${functionfile}" 1
|
|
|
+core_dl.sh(){
|
|
|
+# Functions are defined in core_functions.sh.
|
|
|
+functionfile="${FUNCNAME}"
|
|
|
+fn_fetch_core_dl
|
|
|
}
|
|
|
|
|
|
core_functions.sh(){
|
|
|
# Functions are defined in core_functions.sh.
|
|
|
functionfile="${FUNCNAME}"
|
|
|
-fn_runfunction
|
|
|
+fn_fetch_core_dl
|
|
|
}
|
|
|
|
|
|
+core_dl.sh
|
|
|
core_functions.sh
|
|
|
|
|
|
getopt=$1
|
|
|
-core_getopt.sh
|
|
|
+core_getopt.sh
|