Răsfoiți Sursa

remove requirement for backup url as now tested first

Daniel Gibbs 3 ani în urmă
părinte
comite
cf7e9d9d99
1 a modificat fișierele cu 15 adăugiri și 10 ștergeri
  1. 15 10
      linuxgsm.sh

+ 15 - 10
linuxgsm.sh

@@ -84,12 +84,10 @@ fn_repo_selector() {
 		echo -e "${githubbranch} branch does not exist. Defaulting to master branch."
 		githubbranch="master"
 	fi
-
 }
 
 # Fetches the core module required before passed off to core_dl.sh.
 core_modules.sh() {
-	fn_repo_selector
 	modulefile="${FUNCNAME[0]}"
 	fn_bootstrap_fetch_file_github "lgsm/modules" "core_modules.sh" "${modulesdir}" "chmodx" "run" "noforcedl" "nomd5"
 }
@@ -196,18 +194,25 @@ fn_bootstrap_fetch_file() {
 }
 
 fn_bootstrap_fetch_file_github() {
+	fn_repo_selector
 	github_file_url_dir="${1}"
 	github_file_url_name="${2}"
+
 	# By default modules will be downloaded from the version release to prevent potential version mixing. Only update-lgsm will allow an update.
-	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}"
+	if [ "${remotereponame}" == "GitHub" ]; then
+		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}"
+		else
+			remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+		fi
+	elif [ "${remotereponame}" == "BitBucket" ]; then
+		if [ "${githubbranch}" == "master" ] && [ "${githubuser}" == "GameServerManagers" ] && [ "${commandname}" != "UPDATE-LGSM" ]; then
+			remote_fileurl="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}"
+		else
+			remote_fileurl="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+		fi
 	fi
 	remote_fileurl_name="GitHub"
-	remote_fileurl_backup_name="Bitbucket"
 	local_filedir="${3}"
 	local_filename="${github_file_url_name}"
 	chmodx="${4:-0}"
@@ -215,7 +220,7 @@ fn_bootstrap_fetch_file_github() {
 	forcedl="${6:-0}"
 	md5="${7:-0}"
 	# Passes vars to the file download module.
-	fn_bootstrap_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
+	fn_bootstrap_fetch_file "${remote_fileurl}" "" "${remote_fileurl_name}" "" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
 }
 
 # Installer menu.