|
|
@@ -17,7 +17,7 @@
|
|
|
# fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}"
|
|
|
# fn_fetch_file "http://example.com/file.tar.bz2" "http://example.com/file2.tar.bz2" "file.tar.bz2" "file2.tar.bz2" "/some/dir" "file.tar.bz2" "chmodx" "run" "forcedl" "10cd7353aa9d758a075c600a6dd193fd"
|
|
|
|
|
|
-moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
|
|
|
+functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
|
|
|
|
|
|
fn_dl_steamcmd() {
|
|
|
fn_print_start_nl "${remotelocation}"
|
|
|
@@ -453,13 +453,11 @@ fn_fetch_file() {
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
-# GitHub file download modules.
|
|
|
+# GitHub file download functions.
|
|
|
# Used to simplify downloading specific files from GitHub.
|
|
|
|
|
|
-# github_file_url_dir: the directory of the file in the GitHub: lgsm/modules
|
|
|
-# github_file_url_name: the filename of the file to download from GitHub: core_messages.sh
|
|
|
-# github_file_url_dir: the directory of the file in the GitHub: lgsm/modules
|
|
|
-# github_file_url_name: the filename of the file to download from GitHub: core_messages.sh
|
|
|
+# github_fileurl_dir: the directory of the file in the GitHub: lgsm/functions
|
|
|
+# github_fileurl_name: the filename of the file to download from GitHub: core_messages.sh
|
|
|
# githuburl: the full GitHub url
|
|
|
|
|
|
# remote_fileurl: The URL of the file: http://example.com/dl/File.tar.bz2
|
|
|
@@ -472,58 +470,58 @@ fn_fetch_file() {
|
|
|
|
|
|
# Fetches files from the Git repo.
|
|
|
fn_fetch_file_github() {
|
|
|
- github_file_url_dir="${1}"
|
|
|
- github_file_url_name="${2}"
|
|
|
+ github_fileurl_dir="${1}"
|
|
|
+ github_fileurl_name="${2}"
|
|
|
# For legacy versions - code can be removed at a future date
|
|
|
if [ "${legacymode}" == "1" ]; then
|
|
|
- remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
|
|
|
- remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
|
|
|
+ remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
|
|
|
+ remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
|
|
|
# If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork.
|
|
|
- elif [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManagers" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
|
|
|
- remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}"
|
|
|
- remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
|
|
|
+ elif [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
|
|
|
+ remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}"
|
|
|
+ remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}"
|
|
|
else
|
|
|
- remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
|
|
|
- remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
|
|
|
+ remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
|
|
|
+ remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
|
|
|
fi
|
|
|
remote_fileurl_name="GitHub"
|
|
|
remote_fileurl_backup_name="Bitbucket"
|
|
|
local_filedir="${3}"
|
|
|
- local_filename="${github_file_url_name}"
|
|
|
+ local_filename="${github_fileurl_name}"
|
|
|
chmodx="${4:-0}"
|
|
|
run="${5:-0}"
|
|
|
forcedl="${6:-0}"
|
|
|
hash="${7:-0}"
|
|
|
- # Passes vars to the file download module.
|
|
|
+ # Passes vars to the file download function.
|
|
|
fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}"
|
|
|
}
|
|
|
|
|
|
fn_check_file_github() {
|
|
|
- github_file_url_dir="${1}"
|
|
|
- github_file_url_name="${2}"
|
|
|
- if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManagers" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
|
|
|
- remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}"
|
|
|
- remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
|
|
|
+ github_fileurl_dir="${1}"
|
|
|
+ github_fileurl_name="${2}"
|
|
|
+ if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
|
|
|
+ remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}"
|
|
|
+ remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}"
|
|
|
else
|
|
|
- remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
|
|
|
- remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
|
|
|
+ remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
|
|
|
+ remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
|
|
|
fi
|
|
|
remote_fileurl_name="GitHub"
|
|
|
remote_fileurl_backup_name="Bitbucket"
|
|
|
- fn_check_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${github_file_url_name}"
|
|
|
+ fn_check_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${github_fileurl_name}"
|
|
|
}
|
|
|
|
|
|
# Fetches config files from the Git repo.
|
|
|
fn_fetch_config() {
|
|
|
- github_file_url_dir="${1}"
|
|
|
- github_file_url_name="${2}"
|
|
|
+ github_fileurl_dir="${1}"
|
|
|
+ github_fileurl_name="${2}"
|
|
|
# If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork.
|
|
|
- if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManagers" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
|
|
|
- remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}"
|
|
|
- remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
|
|
|
+ if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
|
|
|
+ remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}"
|
|
|
+ remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}"
|
|
|
else
|
|
|
- remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
|
|
|
- remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
|
|
|
+ remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
|
|
|
+ remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
|
|
|
fi
|
|
|
remote_fileurl_name="GitHub"
|
|
|
remote_fileurl_backup_name="Bitbucket"
|
|
|
@@ -533,55 +531,55 @@ fn_fetch_config() {
|
|
|
run="norun"
|
|
|
forcedl="noforce"
|
|
|
hash="nohash"
|
|
|
- # Passes vars to the file download module.
|
|
|
+ # Passes vars to the file download function.
|
|
|
fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}"
|
|
|
}
|
|
|
|
|
|
# Fetches modules from the Git repo during first download.
|
|
|
-fn_fetch_module() {
|
|
|
- github_file_url_dir="lgsm/modules"
|
|
|
- github_file_url_name="${modulefile}"
|
|
|
+fn_fetch_function() {
|
|
|
+ github_fileurl_dir="lgsm/functions"
|
|
|
+ github_fileurl_name="${functionfile}"
|
|
|
# If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork.
|
|
|
- if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManagers" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
|
|
|
- remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}"
|
|
|
- remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
|
|
|
+ if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
|
|
|
+ remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}"
|
|
|
+ remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}"
|
|
|
else
|
|
|
- remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
|
|
|
- remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
|
|
|
+ remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
|
|
|
+ remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
|
|
|
fi
|
|
|
remote_fileurl_name="GitHub"
|
|
|
remote_fileurl_backup_name="Bitbucket"
|
|
|
- local_filedir="${modulesdir}"
|
|
|
- local_filename="${github_file_url_name}"
|
|
|
+ local_filedir="${functionsdir}"
|
|
|
+ local_filename="${github_fileurl_name}"
|
|
|
chmodx="chmodx"
|
|
|
run="run"
|
|
|
forcedl="noforce"
|
|
|
hash="nohash"
|
|
|
- # Passes vars to the file download module.
|
|
|
+ # Passes vars to the file download function.
|
|
|
fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}"
|
|
|
}
|
|
|
|
|
|
# Fetches modules from the Git repo during update-lgsm.
|
|
|
-fn_update_module() {
|
|
|
- github_file_url_dir="lgsm/modules"
|
|
|
- github_file_url_name="${modulefile}"
|
|
|
+fn_update_function() {
|
|
|
+ github_fileurl_dir="lgsm/functions"
|
|
|
+ github_fileurl_name="${functionfile}"
|
|
|
# If master branch will currently running LinuxGSM version to prevent "version mixing". This is ignored if a fork.
|
|
|
- if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManagers" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
|
|
|
- remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}"
|
|
|
- remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
|
|
|
+ if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManager" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
|
|
|
+ remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_fileurl_dir}/${github_fileurl_name}"
|
|
|
+ remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_fileurl_dir}/${github_fileurl_name}"
|
|
|
else
|
|
|
- remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
|
|
|
- remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
|
|
|
+ remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
|
|
|
+ remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_fileurl_dir}/${github_fileurl_name}"
|
|
|
fi
|
|
|
remote_fileurl_name="GitHub"
|
|
|
remote_fileurl_backup_name="Bitbucket"
|
|
|
- local_filedir="${modulesdir}"
|
|
|
- local_filename="${github_file_url_name}"
|
|
|
+ local_filedir="${functionsdir}"
|
|
|
+ local_filename="${github_fileurl_name}"
|
|
|
chmodx="chmodx"
|
|
|
run="norun"
|
|
|
forcedl="noforce"
|
|
|
hash="nohash"
|
|
|
- # Passes vars to the file download module.
|
|
|
+ # Passes vars to the file download function.
|
|
|
fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}"
|
|
|
|
|
|
}
|
|
|
@@ -620,7 +618,7 @@ fn_dl_latest_release_github() {
|
|
|
fn_print_fail_nl "Cannot get version from GitHub API for ${githubreleaseuser}/${githubreleaserepo}"
|
|
|
fn_script_log_fatal "Cannot get version from GitHub API for ${githubreleaseuser}/${githubreleaserepo}"
|
|
|
else
|
|
|
- # Fetch file from the remote location from the existing module to the ${tmpdir} for now.
|
|
|
+ # Fetch file from the remote location from the existing function to the ${tmpdir} for now.
|
|
|
fn_fetch_file "${githubreleasedownloadlink}" "" "${githubreleasefilename}" "" "${githubreleasedownloadpath}" "${githubreleasefilename}"
|
|
|
fi
|
|
|
fi
|