Daniel Gibbs 10 лет назад
Родитель
Сommit
65e5e75971
2 измененных файлов с 27 добавлено и 25 удалено
  1. 19 14
      functions/fn_check_steamcmd
  2. 8 11
      functions/fn_install_steamcmd

+ 19 - 14
functions/fn_check_steamcmd

@@ -12,22 +12,27 @@ if [ "${gamename}" == "Unreal Tournament 99" ]||[ "${gamename}" == "Unreal Tourn
 elif [ "${modulename}" == "Starting" ]||[ "${modulename}" == "Update" ]; then
 elif [ "${modulename}" == "Starting" ]||[ "${modulename}" == "Update" ]; then
 	# Checks if SteamCMD exists when starting or updating a server.
 	# Checks if SteamCMD exists when starting or updating a server.
 	# Re-installs if missing.
 	# Re-installs if missing.
-	if [ ! -f ${rootdir}/steamcmd/steamcmd.sh ]; then
-		fn_details_config
-		fn_printwarn "SteamCMD is missing"
+	steamcmddir="${rootdir}/steamcmd"
+	if [ ! -f "${steamcmddir}/steamcmd.sh" ]; then
+		fn_printwarnnl "SteamCMD is missing"
 		fn_scriptlog "SteamCMD is missing"
 		fn_scriptlog "SteamCMD is missing"
 		sleep 1
 		sleep 1
-		echo -en "\n"
-		mkdir -pv "${rootdir}/steamcmd"
-		cd "${rootdir}/steamcmd"
+		if [ ! -d "${steamcmddir}" ]; then
+			mkdir -v "${steamcmddir}"
+		fi
+		curl=$(curl --fail -o "${steamcmddir}/steamcmd_linux.tar.gz" "http://media.steampowered.com/client/steamcmd_linux.tar.gz" 2>&1)
+		exitcode=$?
 		echo -e "downloading steamcmd_linux.tar.gz...\c"
 		echo -e "downloading steamcmd_linux.tar.gz...\c"
-		wget -N /dev/null http://media.steampowered.com/client/steamcmd_linux.tar.gz 2>&1 | grep -F HTTP | cut -c45-| uniq
-		tar --verbose -zxf steamcmd_linux.tar.gz
-		rm -v steamcmd_linux.tar.gz
-		chmod +x steamcmd.sh
-		fn_scriptlog "Re-installed SteamCMD"
-		fn_printdots "${servername}"
-		sleep 1
+		if [ $exitcode -eq 0 ]; then
+			fn_printokeol
+		else
+			fn_printfaileol
+			echo "${curl}"
+			echo -e "${githuburl}\n"
+			exit $exitcode
+		fi
+		tar --verbose -zxf "${steamcmddir}/steamcmd_linux.tar.gz" -C "${steamcmddir}"
+		rm -v "${steamcmddir}/steamcmd_linux.tar.gz"
+		chmod +x "${steamcmddir}/steamcmd.sh"
 	fi
 	fi
-	cd "${rootdir}"
 fi
 fi

+ 8 - 11
functions/fn_install_steamcmd

@@ -10,13 +10,11 @@ echo ""
 echo "Installing SteamCMD"
 echo "Installing SteamCMD"
 echo "================================="
 echo "================================="
 steamcmddir="${rootdir}/steamcmd"
 steamcmddir="${rootdir}/steamcmd"
-if [ ! -d "${steamcmddir}" ]; then
-	mkdir -v "${steamcmddir}"
-fi	
-sleep 1
-cd "${steamcmddir}"
-if [ ! -f steamcmd.sh ]; then
-	curl=$(curl --fail -o "${rootdir}/steamcmd/steamcmd_linux.tar.gz" "http://media.steampowered.com/client/steamcmd_linux.tar.gz" 2>&1)
+if [ ! -f "${steamcmddir}/steamcmd.sh" ]; then
+	if [ ! -d "${steamcmddir}" ]; then
+		mkdir -v "${steamcmddir}"
+	fi
+	curl=$(curl --fail -o "${steamcmddir}/steamcmd_linux.tar.gz" "http://media.steampowered.com/client/steamcmd_linux.tar.gz" 2>&1)
 	exitcode=$?
 	exitcode=$?
 	echo -e "downloading steamcmd_linux.tar.gz...\c"
 	echo -e "downloading steamcmd_linux.tar.gz...\c"
 	if [ $exitcode -eq 0 ]; then
 	if [ $exitcode -eq 0 ]; then
@@ -27,10 +25,9 @@ if [ ! -f steamcmd.sh ]; then
 		echo -e "${githuburl}\n"
 		echo -e "${githuburl}\n"
 		exit $exitcode
 		exit $exitcode
 	fi
 	fi
-	tar --verbose -zxf steamcmd_linux.tar.gz
-	rm -v steamcmd_linux.tar.gz
-	chmod +x steamcmd.sh
-	sleep 1
+	tar --verbose -zxf "${steamcmddir}/steamcmd_linux.tar.gz" -C "${steamcmddir}"
+	rm -v "${steamcmddir}/steamcmd_linux.tar.gz"
+	chmod +x "${steamcmddir}/steamcmd.sh"
 else
 else
 	echo "SteamCMD already installed!"
 	echo "SteamCMD already installed!"
 fi
 fi