Daniel Gibbs 9 лет назад
Родитель
Сommit
287475b491

+ 3 - 2
lgsm/config-default/config-lgsm/arkserver/_default.cfg

@@ -77,9 +77,10 @@ servercfgfullpath="${servercfgdir}/${servercfg}"
 backupdir="${rootdir}/backups"
 
 ## Logging Directories
+logdir="${logdir}"
 gamelogdir="${systemdir}/Saved/Logs"
-scriptlogdir="${rootdir}/log/script"
-consolelogdir="${rootdir}/log/console"
+scriptlogdir="${logdir}/script"
+consolelogdir="${logdir}/console"
 scriptlog="${scriptlogdir}/${servicename}-script.log"
 consolelog="${consolelogdir}/${servicename}-console.log"
 emaillog="${scriptlogdir}/${servicename}-email.log"

+ 2 - 2
lgsm/config-default/config-lgsm/arma3server/_default.cfg

@@ -89,8 +89,8 @@ backupdir="${rootdir}/backups"
 
 ## Logging Directories
 #gamelogdir="" # No server logs available
-scriptlogdir="${rootdir}/log/script"
-consolelogdir="${rootdir}/log/console"
+scriptlogdir="${logdir}/script"
+consolelogdir="${logdir}/console"
 scriptlog="${scriptlogdir}/${servicename}-script.log"
 consolelog="${consolelogdir}/${servicename}-console.log"
 emaillog="${scriptlogdir}/${servicename}-email.log"

+ 2 - 2
lgsm/config-default/config-lgsm/csgoserver/_default.cfg

@@ -102,8 +102,8 @@ backupdir="${rootdir}/backups"
 
 ## Logging Directories
 gamelogdir="${systemdir}/logs"
-scriptlogdir="${rootdir}/log/script"
-consolelogdir="${rootdir}/log/console"
+scriptlogdir="${logdir}/script"
+consolelogdir="${logdir}/console"
 scriptlog="${scriptlogdir}/${servicename}-script.log"
 consolelog="${consolelogdir}/${servicename}-console.log"
 emaillog="${scriptlogdir}/${servicename}-email.log"

+ 3 - 3
lgsm/config-default/config-lgsm/sdtdserver/_default.cfg

@@ -77,9 +77,9 @@ servercfgfullpath="${servercfgdir}/${servercfg}"
 backupdir="${rootdir}/backups"
 
 ## Logging Directories
-gamelogdir="${rootdir}/log/server"
-scriptlogdir="${rootdir}/log/script"
-consolelogdir="${rootdir}/log/console"
+gamelogdir="${logdir}/server"
+scriptlogdir="${logdir}/script"
+consolelogdir="${logdir}/console"
 gamelog="${gamelogdir}/${servicename}-game.log"
 scriptlog="${scriptlogdir}/${servicename}-script.log"
 consolelog="${consolelogdir}/${servicename}-console.log"

+ 1 - 14
lgsm/functions/check_steamcmd.sh

@@ -39,7 +39,6 @@ fn_check_steamcmd_user(){
 fn_check_steamcmd_sh(){
 	# Checks if SteamCMD exists when starting or updating a server.
 	# Installs if missing.
-	steamcmddir="${rootdir}/steamcmd"
 	if [ ! -f "${steamcmddir}/steamcmd.sh" ]; then
 		if [ "${function_selfname}" == "command_install.sh" ]; then
 			fn_install_steamcmd
@@ -55,17 +54,5 @@ fn_check_steamcmd_sh(){
 	fi
 }
 
-fn_check_steamcmd_guard(){
-	if [ "${function_selfname}" == "command_update.sh" ]||[ "${function_selfname}" == "command_validate.sh" ]; then
-		# Checks that SteamCMD is working correctly and will prompt Steam Guard if required.
-		"${steamcmddir}"/steamcmd.sh +login "${steamuser}" "${steampass}" +quit
-		if [ $? -ne 0 ]; then
-			fn_print_failure_nl "Error running SteamCMD"
-		fi
-	fi
-}
-
 fn_check_steamcmd_user
-fn_check_steamcmd_sh
-# stdbuf has now replaced unbuffer. This should not longer be required.
-#fn_check_steamcmd_guard
+fn_check_steamcmd_sh

+ 2 - 3
lgsm/functions/command_install_resources_mta.sh

@@ -12,9 +12,8 @@ fn_install_resources(){
 	echo ""
 	echo "Installing Default Resources"
 	echo "================================="
-	fileurl="http://mirror.mtasa.com/mtasa/resources/mtasa-resources-latest.zip"; filedir="${tmpdir}"; filename="multitheftauto_resources.zip"; executecmd="noexecute" run="norun"; force="noforce"; md5="nomd5"
-	fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
-	fn_dl_extract "${filedir}" "${filename}" "${resourcesdir}"
+	fn_fetch_file "http://mirror.mtasa.com/mtasa/resources/mtasa-resources-latest.zip" "${tmpdir}" "mtasa-resources-latest.zip" "noexecute" "norun" "noforce" "nomd5"
+	fn_dl_extract "${tmpdir}" "mtasa-resources-latest.zip" "${resourcesdir}"
 	echo "Default Resources Installed."
 }
 

+ 1 - 1
lgsm/functions/command_start.sh

@@ -46,7 +46,7 @@ fn_start_teamspeak3(){
 	if [ "${status}" == "0" ]; then
 		fn_print_fail_nl "Unable to start ${servername}"
 		fn_script_log_fatal "Unable to start ${servername}"
-		echo -e "	Check log files: ${rootdir}/log"
+		echo -e "	Check log files: ${logdir}"
 		core_exit.sh
 	else
 		fn_print_ok_nl "${servername}"

+ 1 - 2
lgsm/functions/command_validate.sh

@@ -18,8 +18,7 @@ fn_validation(){
 	fn_script_log_info "Validating files: SteamCMD"
 	sleep 1
 
-	cd "${rootdir}/steamcmd"
-
+	cd "${steamcmddir}"
 	# Detects if unbuffer command is available for 32 bit distributions only.
 	info_distro.sh
 	if [ $(command -v stdbuf) ]&&[ "${arch}" != "x86_64" ]; then

+ 3 - 1
lgsm/functions/core_dl.sh

@@ -55,7 +55,9 @@ fn_dl_extract(){
 	# extracts archives
 	echo -ne "extracting ${local_filename}..."
 	mime=$(file -b --mime-type "${local_filedir}/${local_filename}")
-
+	if [ ! -d "${extractdir}" ]; then
+		mkdir "${extractdir}"
+	fi
 	if [ "${mime}" == "application/gzip" ]||[ "${mime}" == "application/x-gzip" ]; then
 		extractcmd=$(tar -zxf "${local_filedir}/${local_filename}" -C "${extractdir}")
 	elif [ "${mime}" == "application/x-bzip2" ]; then

+ 3 - 3
lgsm/functions/fix_steamcmd.sh

@@ -13,7 +13,7 @@ if [ ! -f "${HOME}/.steam/sdk32/steamclient.so" ]; then
 	fixname="steamclient.so general"
 	fn_fix_msg_start
 	mkdir -pv "${HOME}/.steam/sdk32" >> "${scriptlog}"
-	cp -v "${rootdir}/steamcmd/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamclient.so" >> "${scriptlog}"
+	cp -v "${steamcmddir}/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamclient.so" >> "${scriptlog}"
 	fn_fix_msg_end
 fi
 
@@ -31,13 +31,13 @@ elif [ "${gamename}" == "Hurtworld" ]; then
 	if [ ! -f "${serverfiles}/Hurtworld_Data/Plugins/x86/steamclient.so" ]; then
 		fixname="steamclient.so x86"
 		fn_fix_msg_start
-		cp -v "${rootdir}/steamcmd/linux32/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86/steamclient.so" >> "${scriptlog}"
+		cp -v "${steamcmddir}/linux32/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86/steamclient.so" >> "${scriptlog}"
 		fn_fix_msg_end
 	fi
 	if [ ! -f "${serverfiles}/Hurtworld_Data/Plugins/x86_64/steamclient.so" ]; then
 		fixname="steamclient.so x86_64"
 		fn_fix_msg_start
-		cp -v "${rootdir}/steamcmd/linux32/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86_64/steamclient.so" >> "${scriptlog}"
+		cp -v "${steamcmddir}/linux32/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86_64/steamclient.so" >> "${scriptlog}"
 		fn_fix_msg_end
 	fi
 elif [ "${gamename}" == "Tower Unite" ]; then

+ 5 - 5
lgsm/functions/install_logs.sh

@@ -15,7 +15,7 @@ if [ "${checklogs}" != "1" ]; then
 fi
 sleep 1
 # Create script and console log directories
-mkdir -v "${rootdir}/log"
+mkdir -v "${logdir}"
 mkdir -v "${scriptlogdir}"
 touch "${scriptlog}"
 if [ -n "${consolelogdir}" ]; then
@@ -30,15 +30,15 @@ fi
 
 # Symlink gamelogdir to lgsm logs if variable exists
 if [ -n "${gamelogdir}" ]; then
-	if [ ! -h "${rootdir}/log/server" ]; then
-		ln -nfsv "${gamelogdir}" "${rootdir}/log/server"
+	if [ ! -h "${logdir}/server" ]; then
+		ln -nfsv "${gamelogdir}" "${logdir}/server"
 	fi
 fi
 
 # If server uses SteamCMD create a symbolic link to the Steam logs
 if [ -d "${rootdir}/Steam/logs" ]; then
-	if [ ! -h "${rootdir}/log/steamcmd" ]; then
-		ln -nfsv "${rootdir}/Steam/logs" "${rootdir}/log/steamcmd"
+	if [ ! -h "${logdir}/steamcmd" ]; then
+		ln -nfsv "${rootdir}/Steam/logs" "${logdir}/steamcmd"
 	fi
 fi
 sleep 1

+ 4 - 5
lgsm/functions/install_mta_resources.sh

@@ -14,20 +14,19 @@ fn_install_libmysqlclient16(){
 	echo "Checking if libmysqlclient16 is installed"
 	echo "================================="
 	sleep 1
-	if [ ! -f /usr/lib/libmysqlclient.so.16 ]; then
+	if [ ! -f "/usr/lib/libmysqlclient.so.16" ]; then
 		fn_print_warn_nl "libmysqlclient16 not installed. Installing.."
 		sleep 1
 		sudo -v > /dev/null 2>&1
 		if [ $? -eq 0 ]; then
-    	fileurl="https://nightly.mtasa.com/files/modules/64/libmysqlclient.so.16"; filedir="${tmpdir}"; filename="libmysqlclient.so.16"; executecmd="executecmd" run="norun"; force="noforce"; md5="6c188e0f8fb5d7a29f4bc413b9fed6c2"
-    	fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
-			sudo mv ${tmpdir}/${filename} /usr/lib/${filename}
+			fn_fetch_file "https://nightly.mtasa.com/files/modules/64/libmysqlclient.so.16" "${filedir}" "libmysqlclient.so.16" "executecmd" "norun" "noforce" "6c188e0f8fb5d7a29f4bc413b9fed6c2"
+			sudo mv "${tmpdir}/libmysqlclient.so.16" "/usr/lib/libmysqlclient.so.16"
 		else
 			fn_print_fail_nl "Failed to install libmysqlclient16, $(whoami) does not have sudo access. Download it manually and place it in /usr/lib"
 			sleep 1
 		fi
 	else
-  	echo "libmysqlclient16 already installed."
+		echo "libmysqlclient16 already installed."
 	fi
 }
 

+ 2 - 2
lgsm/functions/install_server_files.sh

@@ -48,7 +48,7 @@ fn_install_server_files_steamcmd(){
 	counter="0"
 	while [ "${counter}" == "0" ]||[ "${exitcode}" != "0" ]; do
 		counter=$((counter+1))
-		cd "${rootdir}/steamcmd"
+		cd "${steamcmddir}"
 		if [ "${counter}" -le "10" ]; then
 			# Attempt 1-4: Standard attempt
 			# Attempt 5-6: Validate attempt
@@ -66,7 +66,7 @@ fn_install_server_files_steamcmd(){
 				find ${serverfiles} -type d -print0 | grep -Ez '[^/]{30}$' | xargs -0 rm -rf
 			fi
 			if [ "${counter}" -ge "9" ]; then
-				rm -rf "${rootdir}/steamcmd"
+				rm -rf "${steamcmddir}"
 				check_steamcmd.sh
 			fi
 

+ 1 - 1
lgsm/functions/logs.sh

@@ -37,7 +37,7 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; th
 	sourcemodlogdir="${systemdir}/addons/sourcemod/logs"
 	ulxlogdir="${systemdir}/data/ulx_logs"
 	darkrplogdir="${systemdir}/data/darkrp_logs"
-	legacyserverlogdir="${rootdir}/log/server"
+	legacyserverlogdir="${logdir}/server"
 	# Setting up counting variables
 	scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" ; legacycount="0"
 	sleep 1

+ 0 - 5
lgsm/functions/monitor_gsquery.sh

@@ -9,11 +9,6 @@ local commandname="MONITOR"
 local commandaction="Monitor"
 local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
-# Forces legacy servers to use gsquery
-if [ -z "${gsquery}" ]; then
-	gsquery="yes"
-fi
-
 if [ "${gsquery}" == "yes" ]; then
 
 	# Downloads gsquery.py if missing

+ 2 - 3
lgsm/functions/update_mta.sh

@@ -10,11 +10,10 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
 fn_update_mta_dl(){
 	fn_fetch_file "http://linux.mtasa.com/dl/${numversion}/multitheftauto_linux_x64-${fullversion}.tar.gz" "${tmpdir}" "multitheftauto_linux_x64-${fullversion}.tar.gz"
-  mkdir "${tmpdir}/multitheftauto_linux_x64-${fullversion}"
-	fn_dl_extract "${tmpdir}" "multitheftauto_linux_x64-${fullversion}.tar.gz" "${tmpdir}/multitheftauto_linux_x64-${fullversion}"
+	fn_dl_extract "${tmpdir}" "multitheftauto_linux_x64-${fullversion}.tar.gz" "${tmpdir}"
 	echo -e "copying to ${serverfiles}...\c"
 	fn_script_log "Copying to ${serverfiles}"
-	cp -R "${tmpdir}/multitheftauto_linux_x64-${fullversion}/multitheftauto_linux_x64-${fullversion}/"* "${serverfiles}"
+	cp -R "${tmpdir}/multitheftauto_linux_x64-${fullversion}/"* "${serverfiles}"
 	local exitcode=$?
 	if [ "${exitcode}" == "0" ]; then
 		fn_print_ok_eol_nl

+ 4 - 2
lgsm/functions/update_steamcmd.sh

@@ -17,7 +17,7 @@ fn_update_steamcmd_dl(){
 	fn_print_ok_nl "SteamCMD"
 	fn_script_log_info "Starting SteamCMD"
 
-	cd "${rootdir}/steamcmd"
+	cd "${steamcmddir}"
 
 	# Detects if unbuffer command is available for 32 bit distributions only.
 	info_distro.sh
@@ -25,6 +25,7 @@ fn_update_steamcmd_dl(){
 		unbuffer="stdbuf -i0 -o0 -e0"
 	fi
 
+	cd "${steamcmddir}"
 	if [ "${engine}" == "goldsource" ]; then
 		${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" ${branch} +quit | tee -a "${scriptlog}"
 	else
@@ -146,7 +147,7 @@ fn_update_steamcmd_check(){
 	currentbuild=$(grep buildid "${appmanifestfile}" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\  -f3)
 
 	# Removes appinfo.vdf as a fix for not always getting up to date version info from SteamCMD
-	cd "${rootdir}/steamcmd"
+
 	if [ -f "${HOME}/Steam/appcache/appinfo.vdf" ]; then
 		rm -f "${HOME}/Steam/appcache/appinfo.vdf"
 	fi
@@ -160,6 +161,7 @@ fn_update_steamcmd_check(){
 	fi
 
 	# Gets availablebuild info
+	cd "${steamcmddir}"
 	availablebuild=$(./steamcmd.sh +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" +app_info_print "${appid}" +quit | sed -n '/branch/,$p' | grep -m 1 buildid | tr -cd '[:digit:]')
 	if [ -z "${availablebuild}" ]; then
 		fn_print_fail "Checking for update: SteamCMD"

+ 1 - 0
linuxgsm.sh

@@ -22,6 +22,7 @@ shortname="core"
 servername="core"
 gamename="core"
 lockselfname=".${servicename}.lock"
+steamcmddir="${rootdir}/steamcmd"
 lgsmdir="${rootdir}/lgsm"
 functionsdir="${lgsmdir}/functions"
 libdir="${lgsmdir}/lib"