Skip to content

Commit

Permalink
att bootstrap fetch module
Browse files Browse the repository at this point in the history
  • Loading branch information
dgibbs64 committed Sep 29, 2024
1 parent 329d779 commit 4c181d4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lgsm/modules/core_modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ core_legacy.sh() {
core_exit.sh() {
modulefile="${FUNCNAME[0]}"
fn_fetch_module
exitcode=$?
if [ "${exitcode}" -ne 0 ]; then
echo "fn_fetch_module failed, using fn_bootstrap_fetch_module instead."
fn_bootstrap_fetch_module
fi
}

core_getopt.sh() {
Expand Down
24 changes: 24 additions & 0 deletions linuxgsm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,30 @@ fn_bootstrap_fetch_trap() {
core_exit.sh
}

# Fetches modules from the Git repo during first download.
fn_bootstrap_fetch_module() {
github_file_url_dir="lgsm/modules"
github_file_url_name="${modulefile}"
# 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}"
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}"
fi
remote_fileurl_name="GitHub"
remote_fileurl_backup_name="Bitbucket"
local_filedir="${modulesdir}"
local_filename="${github_file_url_name}"
chmodx="chmodx"
run="run"
forcedl="noforce"
hash="nohash"
# Passes vars to the file download module.
fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}"
}

fn_bootstrap_fetch_file() {
remote_fileurl="${1}"
remote_fileurl_backup="${2}"
Expand Down

0 comments on commit 4c181d4

Please sign in to comment.