Преглед изворни кода

Merge pull request #1665 from GameServerManagers/feature/forcedl

Repaired and used force download functionality
Daniel Gibbs пре 8 година
родитељ
комит
25151eb2e9
3 измењених фајлова са 12 додато и 16 уклоњено
  1. 2 2
      lgsm/functions/core_dl.sh
  2. 1 1
      lgsm/functions/install_config.sh
  3. 9 13
      linuxgsm.sh

+ 2 - 2
lgsm/functions/core_dl.sh

@@ -105,8 +105,8 @@ fn_fetch_file(){
 	forcedl="${6:-0}"
 	md5="${7:-0}"
 
-	# If the file is missing, then download
-	if [ ! -f "${local_filedir}/${local_filename}" ]; then
+	# download file if missing or download forced
+	if [ ! -f "${local_filedir}/${local_filename}" ]||[ "${forcedl}" == "forcedl" ]; then
 		if [ ! -d "${local_filedir}" ]; then
 			mkdir -p "${local_filedir}"
 		fi

+ 1 - 1
lgsm/functions/install_config.sh

@@ -27,7 +27,7 @@ fn_fetch_default_config(){
 	mkdir -p "${lgsmdir}/config-default/config-game"
 	githuburl="https://raw.githubusercontent.com/GameServerManagers/Game-Server-Configs/master"
 	for config in "${array_configs[@]}"; do
-		fn_fetch_file "${githuburl}/${gamedirname}/${config}" "${lgsmdir}/config-default/config-game" "${config}" "nochmodx" "norun" "noforce" "nomd5"
+		fn_fetch_file "${githuburl}/${gamedirname}/${config}" "${lgsmdir}/config-default/config-game" "${config}" "nochmodx" "norun" "forcedl" "nomd5"
 	done
 }
 

+ 9 - 13
linuxgsm.sh

@@ -64,8 +64,8 @@ fn_bootstrap_fetch_file(){
 	run="${5:-0}"
 	forcedl="${6:-0}"
 	md5="${7:-0}"
-	# If the file is missing, then download
-	if [ ! -f "${local_filedir}/${local_filename}" ]; then
+	# download file if missing or download forced
+	if [ ! -f "${local_filedir}/${local_filename}" ]||[ "${forcedl}" == "forcedl" ]; then
 		if [ ! -d "${local_filedir}" ]; then
 			mkdir -p "${local_filedir}"
 		fi
@@ -116,15 +116,15 @@ fn_bootstrap_fetch_file_github(){
 	github_file_url_name="${2}"
 	githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
 
-	remote_remote_fileurl="${githuburl}"
-	local_local_filedir="${3}"
-	local_local_filename="${github_file_url_name}"
+	remote_fileurl="${githuburl}"
+	local_filedir="${3}"
+	local_filename="${github_file_url_name}"
 	chmodx="${4:-0}"
 	run="${5:-0}"
-	forcedldl="${6:-0}"
+	forcedl="${6:-0}"
 	md5="${7:-0}"
 	# Passes vars to the file download function
-	fn_bootstrap_fetch_file "${remote_remote_fileurl}" "${local_local_filedir}" "${local_local_filename}" "${chmodx}" "${run}" "${forcedldl}" "${md5}"
+	fn_bootstrap_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
 }
 
 # Installer menu
@@ -276,12 +276,8 @@ if [ "${shortname}" == "core" ]; then
 	datadir="${tmpdir}/data"
 	serverlist="${datadir}/serverlist.csv"
 
-	# Download the serverlist. This is the complete list of all supported servers.
-
-	if [ -f "${serverlist}" ]; then
-		rm "${serverlist}"
-	fi
-	fn_bootstrap_fetch_file_github "lgsm/data" "serverlist.csv" "${datadir}" "serverlist.csv" "nochmodx" "norun" "noforcedl" "nomd5"
+	# Download the latest serverlist. This is the complete list of all supported servers.
+	fn_bootstrap_fetch_file_github "lgsm/data" "serverlist.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nomd5"
 	if [ ! -f "${serverlist}" ]; then
 		echo "[ FAIL ] serverlist.csv could not be loaded."
 		exit 1