Procházet zdrojové kódy

Merge branch 'develop' into feature/config

Daniel Gibbs před 9 roky
rodič
revize
390feb9bc3

+ 1 - 0
README.md

@@ -3,6 +3,7 @@
 
 [![Build Status](https://travis-ci.org/GameServerManagers/LinuxGSM.svg?branch=master)](https://travis-ci.org/GameServerManagers/LinuxGSM)
 [![Under Development](https://badge.waffle.io/GameServerManagers/LinuxGSM.svg?label=Under%20Development&title=Under%20Development)](http://waffle.io/GameServerManagers/LinuxGSM)
+[![Discord](https://discordapp.com/api/guilds/127498813903601664/widget.png?style=shield)](https://gameservermanagers.com/discord)
 
 The Linux Game Server Managers are command line tools for quick, simple deployment and management of various dedicated game servers and voice alert servers.
 

+ 24 - 2
lgsm/functions/alert_pushbullet.sh

@@ -8,10 +8,32 @@ local commandname="ALERT"
 local commandaction="Alert"
 local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
+# converts text to ascii then passes to curl. allowing special characters to be sent e.g %
+# http://stackoverflow.com/a/10660730
+fn_rawurlencode() {
+  local string="${1}"
+  local strlen=${#string}
+  local encoded=""
+  local pos c o
+
+  for (( pos=0 ; pos<strlen ; pos++ )); do
+     c=${string:$pos:1}
+     case "$c" in
+        [-_.~a-zA-Z0-9] ) o="${c}" ;;
+        * )               printf -v o '%%%02x' "'$c"
+     esac
+     encoded+="${o}"
+  done
+  echo "${encoded}"    # You can either set a return variable (FASTER)
+  REPLY="${encoded}"   #+or echo the result (EASIER)... or both... :p
+}
+
+pbalertbody=$(fn_rawurlencode "${alertbody}"; echo ${REPLY})
+pbalertsubject=$(fn_rawurlencode "${alertsubject}"; echo ${REPLY})
+
 fn_print_dots "Sending Pushbullet alert"
 sleep 1
-
-pushbulletsend=$(${curlpath} --silent -u """${pushbullettoken}"":" -d channel_tag="${channeltag}" -d type="note" -d body="${alertbody}" -d title="${alertsubject}" 'https://api.pushbullet.com/v2/pushes'|grep -o invalid_access_token|uniq)
+pushbulletsend=$(curl --silent -u """${pushbullettoken}"":" -d channel_tag="${channeltag}" -d type="note" -d body="${pbalertbody}" -d title="${pbalertsubject}" 'https://api.pushbullet.com/v2/pushes'|grep -o invalid_access_token|uniq)
 
 if [ "${pushbulletsend}" == "invalid_access_token" ]; then
 	fn_print_fail_nl "Sending Pushbullet alert: invalid_access_token"

+ 15 - 15
lgsm/functions/check_deps.sh

@@ -18,10 +18,10 @@ fn_deps_detector(){
 		depstatus=0
 		deptocheck="${javaversion}"
 		unset javacheck
-	elif [ -n "$(command -v apt-get)" ]; then
+	elif [ -n "$(command -v apt-get 2>/dev/null)" ]; then
 		dpkg-query -W -f='${Status}' ${deptocheck} 2>/dev/null | grep -q -P '^install ok installed$'
 		depstatus=$?
-	elif [ -n "$(command -v yum)" ]; then
+	elif [ -n "$(command -v yum 2>/dev/null)" ]; then
 		yum -q list installed ${deptocheck} > /dev/null 2>&1
 		depstatus=$?
 	fi
@@ -56,15 +56,15 @@ fn_deps_email(){
 				array_deps_required+=( exim4 )
 			elif [ -d /etc/sendmail ]; then
 				array_deps_required+=( sendmail )
-			elif [ -n "$(command -v dpkg-query)" ]; then
+			elif [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then
 				array_deps_required+=( mailutils postfix )
-			elif [ -n "$(command -v yum)" ]; then
+			elif [ -n "$(command -v yum 2>/dev/null)" ]; then
 				array_deps_required+=( mailx postfix )
 			fi
 		else
-			if [ -n "$(command -v dpkg-query)" ]; then
+			if [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then
 				array_deps_required+=( mailutils postfix )
-			elif [ -n "$(command -v yum)" ]; then
+			elif [ -n "$(command -v yum 2>/dev/null)" ]; then
 				array_deps_required+=( mailx postfix )
 			fi
 		fi
@@ -89,10 +89,10 @@ fn_found_missing_deps(){
 			echo -en "...\r"
 			sleep 1
 			echo -en "   \r"
-			if [ -n "$(command -v dpkg-query)" ]; then
+			if [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then
 				cmd="sudo dpkg --add-architecture i386; sudo apt-get update; sudo apt-get -y install ${array_deps_missing[@]}"
 				eval ${cmd}
-			elif [ -n "$(command -v yum)" ]; then
+			elif [ -n "$(command -v yum 2>/dev/null)" ]; then
 				cmd="sudo yum -y install ${array_deps_missing[@]}"
 				eval ${cmd}
 			fi
@@ -107,9 +107,9 @@ fn_found_missing_deps(){
 			echo ""
 			fn_print_warning_nl "$(whoami) does not have sudo access. Manually install dependencies."
 			fn_script_log_warn "$(whoami) does not have sudo access. Manually install dependencies."
-			if [ -n "$(command -v dpkg-query)" ]; then
+			if [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then
 				echo "	sudo dpkg --add-architecture i386; sudo apt-get update; sudo apt-get install ${array_deps_missing[@]}"
-			elif [ -n "$(command -v yum)" ]; then
+			elif [ -n "$(command -v yum 2>/dev/null)" ]; then
 				echo "	sudo yum install ${array_deps_missing[@]}"
 			fi
 			echo ""
@@ -140,16 +140,16 @@ if [ "${function_selfname}" == "command_install.sh" ]; then
 fi
 
 # Check will only run if using apt-get or yum
-if [ -n "$(command -v dpkg-query)" ]; then
+if [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then
 	# Generate array of missing deps
 	array_deps_missing=()
 
 	# LinuxGSM requirements
-	array_deps_required=( curl wget ca-certificates file bsdmainutils util-linux python bzip2 gzip unzip )
+	array_deps_required=( curl wget ca-certificates file bsdmainutils util-linux python bzip2 gzip unzip binutils )
 
 	# All servers except ts3 require tmux
 	if [ "${gamename}" != "TeamSpeak 3" ]; then
-		if [ "$(command -v tmux)" ]||[ "$(which tmux 2>/dev/null)" ]||[ -f "/usr/bin/tmux" ]||[ -f "/bin/tmux" ]; then
+		if [ "$(command -v tmux 2>/dev/null)" ]||[ "$(which tmux 2>/dev/null)" ]||[ -f "/usr/bin/tmux" ]||[ -f "/bin/tmux" ]; then
 			tmuxcheck=1 # Added for users compiling tmux from source to bypass check.
 		else
 			array_deps_required+=( tmux )
@@ -219,7 +219,7 @@ if [ -n "$(command -v dpkg-query)" ]; then
 	fn_deps_email
 	fn_check_loop
 
-elif [ -n "$(command -v yum)" ]; then
+elif [ -n "$(command -v yum 2>/dev/null)" ]; then
 	# Generate array of missing deps
 	array_deps_missing=()
 
@@ -232,7 +232,7 @@ elif [ -n "$(command -v yum)" ]; then
 
 	# All servers except ts3 require tmux
 	if [ "${gamename}" != "TeamSpeak 3" ]; then
-		if [ "$(command -v tmux)" ]||[ "$(which tmux 2>/dev/null)" ]||[ -f "/usr/bin/tmux" ]||[ -f "/bin/tmux" ]; then
+		if [ "$(command -v tmux 2>/dev/null)" ]||[ "$(which tmux 2>/dev/null)" ]||[ -f "/usr/bin/tmux" ]||[ -f "/bin/tmux" ]; then
 			tmuxcheck=1 # Added for users compiling tmux from source to bypass check.
 		else
 			array_deps_required+=( tmux )

+ 35 - 50
lgsm/functions/command_dev_detect_deps.sh

@@ -8,63 +8,49 @@ local commandname="DEPS-DETECT"
 local commandaction="Deps-Detect"
 local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
-check.sh
-cd "${executabledir}"
-if [ "${executable}" ==  "./hlds_run" ]; then
-	executable=hlds_linux
-elif [ "${executable}" ==  "./srcds_run" ]||[ "${executable}" ==  "./dabds.sh" ]||[ "${executable}" ==  "./srcds_run.sh" ]; then
-	executable=srcds_linux
-elif [ "${executable}" ==  "./server_linux32" ]; then
-	executable=libSpark_Core.so
-elif [ "${executable}" ==  "./runSam3_DedicatedServer.sh" ]; then
-	executable=Sam3_DedicatedServer
-elif [ "${executable}" ==  "./7DaysToDie.sh" ]; then
-	executable=7DaysToDie.x86
-elif [ "${executable}" ==  "./ucc-bin" ]; then
-
-	if [ -f "${executabledir}/ucc-bin-real" ]; then
-		executable=ucc-bin-real
-	elif [ -f "${executabledir}/ut2004-bin" ]; then
-		executable=ut2004-bin
-	else
-		executable=ut-bin
-	fi
-
-elif [ "${executable}" ==  "./ts3server_startscript.sh" ]; then
-	executable=ts3server_linux_amd64
-fi
-
-if [ "$(command -v eu-readelf)" ]; then
+echo "================================="
+echo "Dependencies Checker"
+echo "================================="
+echo "Checking directory: "
+echo "${filesdir}"
+if [ "$(command -v eu-readelf 2>/dev/null)" ]; then
 	readelf=eu-readelf
-elif [ "$(command -v readelf)" ]; then
+elif [ "$(command -v readelf 2>/dev/null)" ]; then
 	readelf=readelf
 else
 	echo "readelf/eu-readelf not installed"
 fi
+files=$(find ${filesdir} | wc -l)
+find "${filesdir}" -type f -print0 |
+while IFS= read -r -d $'\0' line; do
+	if [ "${readelf}" == "eu-readelf" ];then
+		${readelf} -d "${line}" 2>/dev/null|grep NEEDED|awk '{ print $4 }'|sed 's/\[//g;s/\]//g' >> "${tmpdir}/.depdetect_readelf"
+	else
+		${readelf} -d "${line}" 2>/dev/null|grep NEEDED|awk '{ print $5 }'|sed 's/\[//g;s/\]//g' >> "${tmpdir}/.depdetect_readelf"
+	fi
+	echo -n "${i} / ${files}" $'\r'
+	((i++))
+done
 
-${readelf} -d ${executable} |grep NEEDED|awk '{ print $5 }'|sed 's/\[//g'|sed 's/\]//g' > "${tmpdir}/.depdetect_readelf"
-
+sort "${tmpdir}/.depdetect_readelf" |uniq >"${tmpdir}/.depdetect_readelf_uniq"
 
-echo "yum install " > "${tmpdir}/.depdetect_centos_list_uniq"
-echo "apt-get install " > "${tmpdir}/.depdetect_ubuntu_list_uniq"
-echo "apt-get install " > "${tmpdir}/.depdetect_debian_list_uniq"
 while read lib; do
-	sharedlib=${lib}
-	if [ "${lib}" == "libm.so.6" ]||[ "${lib}" == "libc.so.6" ]||[ "${lib}" == "libpthread.so.0" ]||[ "${lib}" == "libdl.so.2" ]||[ "${lib}" == "libnsl.so.1" ]||[ "${lib}" == "libgcc_s.so.1" ]||[ "${lib}" == "librt.so.1" ]||[ "${lib}" == "ld-linux.so.2" ]; then
+	if [ "${lib}" == "libm.so.6" ]||[ "${lib}" == "libc.so.6" ]||[ "${lib}" == "libtcmalloc_minimal.so.4" ]||[ "${lib}" == "libpthread.so.0" ]||[ "${lib}" == "libdl.so.2" ]||[ "${lib}" == "libnsl.so.1" ]||[ "${lib}" == "libgcc_s.so.1" ]||[ "${lib}" == "librt.so.1" ]||[ "${lib}" == "ld-linux.so.2" ]; then
 		echo "glibc.i686" >> "${tmpdir}/.depdetect_centos_list"
 		echo "lib32gcc1" >> "${tmpdir}/.depdetect_ubuntu_list"
 		echo "lib32gcc1" >> "${tmpdir}/.depdetect_debian_list"
-
 	elif [ "${lib}" == "libstdc++.so.6" ]; then
 		echo "libstdc++.i686" >> "${tmpdir}/.depdetect_centos_list"
 		echo "libstdc++6:i386" >> "${tmpdir}/.depdetect_ubuntu_list"
 		echo "libstdc++6:i386" >> "${tmpdir}/.depdetect_debian_list"
-
 	elif [ "${lib}" == "libstdc++.so.5" ]; then
 		echo "compat-libstdc++-33.i686" >> "${tmpdir}/.depdetect_centos_list"
 		echo "libstdc++5:i386" >> "${tmpdir}/.depdetect_ubuntu_list"
 		echo "libstdc++5:i386" >> "${tmpdir}/.depdetect_debian_list"
-
+	elif [ "${lib}" == "libcurl-gnutls.so.4" ]; then
+		echo "libcurl.i686" >> "${tmpdir}/.depdetect_centos_list"
+		echo "libcurl4-gnutls-dev:i386" >> "${tmpdir}/.depdetect_ubuntu_list"
+		echo "libcurl4-gnutls-dev:i386" >> "${tmpdir}/.depdetect_debian_list"
 	elif [ "${lib}" == "libspeex.so.1" ]||[ "${lib}" == "libspeexdsp.so.1" ]; then
 		echo "speex.i686" >> "${tmpdir}/.depdetect_centos_list"
 		echo "speex:i386" >> "${tmpdir}/.depdetect_ubuntu_list"
@@ -80,14 +66,17 @@ while read lib; do
 		echo "libtbb2" >> "${tmpdir}/.depdetect_ubuntu_list"
 		echo "libtbb2" >> "${tmpdir}/.depdetect_debian_list"
 
-	elif [ "${lib}" == "libtier0.so" ]||[ "${lib}" == "Core.so" ]||[ "${lib}" == "Editor.so" ]||[ "${lib}" == "Engine.so" ]||[ "${lib}" == "liblua.so" ]||[ "${lib}" == "libsteam_api.so" ]||[ "${lib}" == "ld-linux-x86-64.so.2" ]||[ "${lib}" == "libPhysX3_x86.so" ]||[ "${lib}" == "libPhysX3Common_x86.so" ]||[ "${lib}" == "libPhysX3Cooking_x86.so" ]; then
+	elif [ "${lib}" == "libtier0.so" ]||[ "${lib}" == "libtier0_srv.so" ]||[ "${lib}" == "libvstdlib_srv.so" ]||[ "${lib}" == "Core.so" ]||[ "${lib}" == "libvstdlib.so" ]||[ "${lib}" == "libtier0_s.so" ]||[ "${lib}" == "Editor.so" ]||[ "${lib}" == "Engine.so" ]||[ "${lib}" == "liblua.so" ]||[ "${lib}" == "libsteam_api.so" ]||[ "${lib}" == "ld-linux-x86-64.so.2" ]||[ "${lib}" == "libPhysX3_x86.so" ]||[ "${lib}" == "libPhysX3Common_x86.so" ]||[ "${lib}" == "libPhysX3Cooking_x86.so" ]; then
 		# Known shared libs what dont requires dependencies
 		:
 	else
 		unknownlib=1
 		echo "${lib}" >> "${tmpdir}/.depdetect_unknown"
 	fi
-done < "${tmpdir}/.depdetect_readelf"
+
+done < "${tmpdir}/.depdetect_readelf_uniq"
+
+
 sort "${tmpdir}/.depdetect_centos_list" | uniq >> "${tmpdir}/.depdetect_centos_list_uniq"
 sort "${tmpdir}/.depdetect_ubuntu_list" | uniq >> "${tmpdir}/.depdetect_ubuntu_list_uniq"
 sort "${tmpdir}/.depdetect_debian_list" | uniq >> "${tmpdir}/.depdetect_debian_list_uniq"
@@ -95,10 +84,10 @@ if [ "${unknownlib}" == "1" ]; then
 	sort "${tmpdir}/.depdetect_unknown" | uniq >> "${tmpdir}/.depdetect_unknown_uniq"
 fi
 
-awk -vORS=' ' '{ print $1, $2 }' "${tmpdir}/.depdetect_centos_list_uniq" > "${tmpdir}/.depdetect_centos_line"
-awk -vORS=' ' '{ print $1, $2 }' "${tmpdir}/.depdetect_ubuntu_list_uniq" > "${tmpdir}/.depdetect_ubuntu_line"
-awk -vORS=' ' '{ print $1, $2 }' "${tmpdir}/.depdetect_debian_list_uniq" > "${tmpdir}/.depdetect_debian_line"
-
+awk -vORS='' '{ print $1,$2 }' "${tmpdir}/.depdetect_centos_list_uniq" > "${tmpdir}/.depdetect_centos_line"
+awk -vORS='' '{ print $1,$2 }' "${tmpdir}/.depdetect_ubuntu_list_uniq" > "${tmpdir}/.depdetect_ubuntu_line"
+awk -vORS='' '{ print $1,$2 }' "${tmpdir}/.depdetect_debian_list_uniq" > "${tmpdir}/.depdetect_debian_line"
+echo ""
 echo ""
 echo "Required Dependencies"
 echo "================================="
@@ -128,10 +117,6 @@ echo ""
 echo "Required Librarys"
 echo "================================="
 sort "${tmpdir}/.depdetect_readelf" |uniq
-echo ""
-echo "ldd"
-echo "================================="
-ldd ${executable}
 echo -en "\n"
 rm -f "${tmpdir}/.depdetect_centos_line"
 rm -f "${tmpdir}/.depdetect_centos_list"
@@ -146,8 +131,8 @@ rm -f "${tmpdir}/.depdetect_ubuntu_list"
 rm -f "${tmpdir}/.depdetect_ubuntu_list_uniq"
 
 rm -f "${tmpdir}/.depdetect_readelf"
-
+rm -f "${tmpdir}/.depdetect_readelf_uniq"
 rm -f "${tmpdir}/.depdetect_unknown"
 rm -f "${tmpdir}/.depdetect_unknown_uniq"
 
-core_exit.sh
+core_exit.sh

+ 10 - 3
lgsm/functions/command_dev_detect_glibc.sh

@@ -1,5 +1,5 @@
 #!/bin/bash
-# command_dev_detect_glibc.sh function
+# LinuxGSM command_dev_detect_glibc.sh function
 # Author: Daniel Gibbs
 # Website: https://gameservermanagers.com
 # Description: Automatically detects the version of GLIBC that is required.
@@ -31,12 +31,19 @@ echo ""
 files=$(find ${serverfiles} | wc -l)
 find ${serverfiles} -type f -print0 |
 while IFS= read -r -d $'\0' line; do
-	objdump -T $line 2>/dev/null|grep -oP "GLIBC[^ ]+" >>"${tmpdir}/detect_glibc.tmp"
-	echo -n "$i / $files" $'\r'
+	glibcversion=$(objdump -T "${line}" 2>/dev/null|grep -oP "GLIBC[^ ]+" |grep -v GLIBCXX|sort|uniq|sort -r --version-sort| head -n 1)
+	if [ "${glibcversion}" ];then
+		echo "${glibcversion}: ${line}" >>"${tmpdir}/detect_glibc_files.tmp"
+	fi
+	objdump -T "${line}" 2>/dev/null|grep -oP "GLIBC[^ ]+" >>"${tmpdir}/detect_glibc.tmp"
+	echo -n "${i} / ${files}" $'\r'
 	((i++))
 done
 echo ""
+cat "${tmpdir}/detect_glibc_files.tmp"
+echo ""
 cat "${tmpdir}/detect_glibc.tmp"|sort|uniq|sort -r --version-sort
 rm "${tmpdir}/detect_glibc.tmp"
+rm "${tmpdir}/detect_glibc_files.tmp"
 
 core_exit.sh

+ 1 - 1
lgsm/functions/command_fastdl.sh

@@ -23,7 +23,7 @@ luafastdlfile="lgsm_cl_force_fastdl.lua"
 luafastdlfullpath="${luasvautorundir}/${luafastdlfile}"
 
 # Check if bzip2 is installed
-if [ -z "$(command -v bzip2)" ]; then
+if [ -z "$(command -v bzip2 2>/dev/null)" ]; then
 	fn_print_fail "bzip2 is not installed"
 	fn_script_log_fatal "bzip2 is not installed"
 	core_exit.sh

+ 18 - 5
lgsm/functions/command_start.sh

@@ -31,8 +31,9 @@ fn_start_teamspeak3(){
 		fn_script_log_error "${servername} is already running"
 		core_exit.sh
 	fi
-
-	mv "${scriptlog}" "${scriptlogdate}"
+	if [ -f "${scriptlog}" ]; then
+		mv "${scriptlog}" "${scriptlogdate}"
+	fi
 	# Create lockfile
 	date > "${rootdir}/${lockselfname}"
 	cd "${executabledir}"
@@ -57,6 +58,18 @@ fn_start_teamspeak3(){
 fn_start_tmux(){
 	fn_parms
 
+	# check for tmux size variables
+	if [[ "${servercfgtmuxwidth}" =~ ^[0-9]+$ ]]; then
+		sessionwidth="${servercfgtmuxwidth}"
+	else
+		sessionwidth="80"
+	fi
+	if [[ "${servercfgtmuxheight}" =~ ^[0-9]+$ ]]; then
+		sessionheight="${servercfgtmuxheight}"
+	else
+		sessionheight="23"
+	fi
+
 	# Log rotation
 	check_status.sh
 	if [ "${status}" == "0" ]; then
@@ -81,16 +94,16 @@ fn_start_tmux(){
 	# Create lockfile
 	date > "${rootdir}/${lockselfname}"
 	cd "${executabledir}"
-	tmux new-session -d -s "${servicename}" "${executable} ${parms}" 2> "${scriptlogdir}/.${servicename}-tmux-error.tmp"
+	tmux new-session -d -x "${sessionheight}" -y "${sessionwidth}" -s "${servicename}" "${executable} ${parms}" 2> "${scriptlogdir}/.${servicename}-tmux-error.tmp"
 
 	# tmux pipe-pane not supported in tmux versions < 1.6
-	if [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')" -lt "16" ]; then
+	if [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')" -lt "16" ] 2>/dev/null; then # Tmux compiled from source will not return a number, therefore bypass this check and trash the error
 		echo "Console logging disabled: Tmux => 1.6 required
 		https://gameservermanagers.com/tmux-upgrade
 		Currently installed: $(tmux -V)" > "${consolelog}"
 
 	# Console logging disabled: Bug in tmux 1.8 breaks logging
-	elif [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')" -eq "18" ]; then
+	elif [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')" -eq "18" ] 2>/dev/null; then
 		echo "Console logging disabled: Bug in tmux 1.8 breaks logging
 		https://gameservermanagers.com/tmux-upgrade
 		Currently installed: $(tmux -V)" > "${consolelog}"

+ 1 - 1
lgsm/functions/command_stop.sh

@@ -116,7 +116,7 @@ fn_stop_graceful_sdtd(){
 	sleep 1
 	if [ "${telnetenabled}" == "false" ]; then
 		fn_print_info_nl "Graceful: telnet: DISABLED: Enable in ${servercfg}"
-	elif [ "$(command -v expect)" ]||[ "$(which expect >/dev/null 2>&1)" ]; then
+	elif [ "$(command -v expect 2>/dev/null)" ]||[ "$(which expect >/dev/null 2>&1)" ]; then
 		# Tries to shutdown with both localhost and server IP.
 		for telnetip in 127.0.0.1 ${ip}; do
 			fn_print_dots "Graceful: telnet: ${telnetip}"

+ 10 - 1
lgsm/functions/command_validate.sh

@@ -9,6 +9,7 @@ local commandaction="Validate"
 local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
 fn_validation(){
+	appid="${1}"
 	echo ""
 	echo -e "	* Validating may overwrite some customised files."
 	echo -en "	* https://developer.valvesoftware.com/wiki/SteamCMD#Validate"
@@ -50,10 +51,18 @@ check_status.sh
 if [ "${status}" != "0" ]; then
 	exitbypass=1
 	command_stop.sh
-	fn_validation
+	fn_validation "${appid}"
+	# will also check for second appid
+	if [ "${gamename}" == "Classic Offensive" ]; then
+		fn_validation "${appid_co}"
+	fi
 	exitbypass=1
 	command_start.sh
 else
 	fn_validation
+	# will also check for second appid
+	if [ "${gamename}" == "Classic Offensive" ]; then
+		fn_validation "${appid_co}"
+	fi
 fi
 core_exit.sh

+ 3 - 3
lgsm/functions/fix_glibc.sh

@@ -11,7 +11,7 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 ## i386
 
 # libstdc++.so.6
-local libstdc_servers_array=( "ARMA 3" "Blade Symphony" "Garry's Mod" "GoldenEye: Source" "Just Cause 2" )
+local libstdc_servers_array=( "ARMA 3" "Blade Symphony" "Counter-Strike: Global Offensive" "Garry's Mod" "GoldenEye: Source" "Just Cause 2" "Team Fortress 2" )
 for libstdc_server in "${libstdc_servers_array[@]}"
 do
 	if [ "${gamename}" == "${libstdc_server}" ]; then
@@ -20,7 +20,7 @@ do
 done
 
 # libm.so.6
-local libm_servers_array=( "Black Mesa: Deathmatch" "Codename CURE" "Day of Infamy" "Double Action: Boogaloo" "Empires Mod" "Fistful of Frags" "Garry's Mod" "GoldenEye: Source" "Insurgency" "Natural Selection 2" "NS2: Combat" "No More Room in Hell" )
+local libm_servers_array=( "Black Mesa: Deathmatch" "Codename CURE" "Day of Infamy" "Double Action: Boogaloo" "Empires Mod" "Fistful of Frags" "Garry's Mod" "GoldenEye: Source" "Insurgency" "Natural Selection 2" "NS2: Combat" "No More Room in Hell" "Pirates, Vikings, and Knights II" "Team Fortress 2" )
 for libm_server in "${libm_servers_array[@]}"
 do
 	if [ "${gamename}" == "${libm_server}" ]; then
@@ -29,7 +29,7 @@ do
 done
 
 # libc.so.6
-local libc_servers_array=( "Black Mesa: Deathmatch" "Blade Symphony" "Garry's Mod" "GoldenEye: Source" )
+local libc_servers_array=( "Black Mesa: Deathmatch" "Blade Symphony" "Garry's Mod" "GoldenEye: Source" "Team Fortress 2" )
 for libc_server in "${libc_servers_array[@]}"
 do
 	if [ "${gamename}" == "${libc_server}" ]; then

+ 4 - 1
lgsm/functions/fix_ro.sh

@@ -17,6 +17,9 @@ echo "Applying WebAdmin CharSet fix."
 echo "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1"
 sed -i 's/CharSet="iso-8859-1"/CharSet="utf-8"/g' "${systemdir}/uweb.int"
 sleep 1
+echo "Applying Steam AppID fix."
+sed -i 's/1210/1200/g' "${systemdir}/steam_appid.txt"
+sleep 1
 echo "applying server name fix."
 sleep 1
 echo "forcing server restart..."
@@ -26,4 +29,4 @@ sleep 5
 command_stop.sh
 command_start.sh
 sleep 5
-command_stop.sh
+command_stop.sh

+ 6 - 4
lgsm/functions/info_distro.sh

@@ -37,12 +37,14 @@ glibcversion="$(ldd --version | sed -n '1s/.* //p')"
 
 ## tmux version
 # e.g: tmux 1.6
-if [ -z "$(command -v tmux)" ]; then
+if [ -z "$(command -V tmux 2>/dev/null)" ]; then
 	tmuxv="${red}NOT INSTALLED!${default}"
-elif [ "$(tmux -V|sed "s/tmux //" | sed -n '1 p' | tr -cd '[:digit:]')" -lt "16" ]; then
-	tmuxv="$(tmux -V) (>= 1.6 required for console log)"
 else
-	tmuxv=$(tmux -V)
+	if [ "$(tmux -V|sed "s/tmux //" | sed -n '1 p' | tr -cd '[:digit:]')" -lt "16" ] 2>/dev/null; then
+		tmuxv="$(tmux -V) (>= 1.6 required for console log)"
+	else
+		tmuxv=$(tmux -V)
+	fi
 fi
 
 ## Uptime

+ 10 - 1
lgsm/functions/info_glibc.sh

@@ -38,6 +38,9 @@ elif [ "${gamename}" == "Call of Duty: World at War" ]; then
 elif [ "${gamename}" == "Codename CURE" ]; then
 	glibcrequired="2.15"
 	glibcfix="yes"
+elif [ "${gamename}" == "Counter-Strike: Global Offensive" ]; then
+	glibcrequired="2.15"
+	glibcfix="yes"
 elif [ "${gamename}" == "Day of Infamy" ]; then
 	glibcrequired="2.15"
 	glibcfix="yes"
@@ -71,6 +74,9 @@ elif [ "${gamename}" == "No More Room in Hell" ]; then
 elif [ "${gamename}" == "Project Cars" ]; then
 	glibcrequired="2.4"
 	glibcfix="no"
+elif [ "${gamename}" == "Pirates, Vikings, and Knights II" ]; then
+	glibcrequired="2.15"
+	glibcfix="yes"
 elif [ "${gamename}" == "Quake 2" ]; then
 	glibcrequired="NOT REQUIRED"
 	glibcfix="no"
@@ -110,9 +116,12 @@ elif [ "${engine}" == "realvirtuality" ]; then
 elif [ "${engine}" == "seriousengine35" ]; then
 	glibcrequired="2.13"
 	glibcfix="yes"
-elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
+elif [ "${engine}" == "source" ]; then
 	glibcrequired="2.3.6"
 	glibcfix="no"
+elif [ "${engine}" == "goldsource" ]; then
+	glibcrequired="2.3.4"
+	glibcfix="no"
 elif [ "${engine}" == "spark" ]; then
 	glibcrequired="2.15"
 	glibcfix="yes"

+ 6 - 0
lgsm/functions/install_config.sh

@@ -227,6 +227,12 @@ elif [ "${gamename}" == "Counter-Strike: Global Offensive" ]; then
 	fn_fetch_default_config
 	fn_default_config_remote
 	fn_set_config_vars
+elif [ "${gamename}" == "Classic Offensive" ]; then
+	gamedirname="ClassicOffensive"
+	array_configs+=( server.cfg )
+	fn_fetch_default_config
+	fn_default_config_remote
+	fn_set_config_vars
 elif [ "${gamename}" == "Counter-Strike: Source" ]; then
 	gamedirname="CounterStrikeSource"
 	array_configs+=( server.cfg )

+ 12 - 2
lgsm/functions/install_server_files.sh

@@ -34,7 +34,7 @@ fn_install_server_files(){
 	elif [ "${gamename}" == "Unreal Tournament 99" ]; then
 		remote_fileurl="http://files.gameservermanagers.com/UnrealTournament99/ut99-server-451-ultimate-linux.tar.bz2"; local_filedir="${tmpdir}"; local_filedir="ut99-server-451-ultimate-linux.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="49cb24d0550ff6ddeaba6007045c6edd"
 	elif [ "${gamename}" == "Unreal Tournament" ]; then
-		remote_fileurl="https://s3.amazonaws.com/unrealtournament/UnrealTournament-Server-XAN-3270765-Linux.zip"; local_filedir="${tmpdir}"; local_filedir="UnrealTournament-Server-XAN-3270765-Linux.zip"; chmodx="nochmodx" run="norun"; force="noforce"; md5="8791dc087383061d7f7f9f523237b8b3"
+		fileurl="https://s3.amazonaws.com/unrealtournament/UnrealTournament-Server-XAN-3395761-Linux.zip"; filedir="${tmpdir}"; filename="UnrealTournament-Server-XAN-3395761-Linux.zip";  executecmd="noexecute" run="norun"; force="noforce"; md5="f04ad5b96865b19613303331ff4075eb"
 	elif [ "${gamename}" == "Unreal Tournament 3" ]; then
 		remote_fileurl="http://files.gameservermanagers.com/UnrealTournament3/UT3-linux-server-2.1.tar.bz2"; local_filedir="${tmpdir}"; local_filedir="UT3-linux-server-2.1.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="2527437b46f1b47f20228d27d72395a6"
 	elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
@@ -72,7 +72,7 @@ fn_install_server_files_steamcmd(){
 
 			# Detects if unbuffer command is available for 32 bit distributions only.
 			info_distro.sh
-			if [ $(command -v stdbuf) ]&&[ "${arch}" != "x86_64" ]; then
+			if [ $(command -v stdbuf 2>/dev/null) ]&&[ "${arch}" != "x86_64" ]; then
 				unbuffer="stdbuf -i0 -o0 -e0"
 			fi
 
@@ -83,6 +83,11 @@ fn_install_server_files_steamcmd(){
 				else
 					${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${branch} +quit
 					local exitcode=$?
+
+					if [ "${gamename}" == "Classic Offensive" ]; then
+						${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid_co}" ${branch} +quit
+						local exitcode=$?
+					fi
 				fi
 			elif [ "${counter}" -ge "5" ]; then
 				if [ "${engine}" == "goldsource" ]; then
@@ -91,6 +96,11 @@ fn_install_server_files_steamcmd(){
 				else
 					${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${branch} validate +quit
 					local exitcode=$?
+
+					if [ "${gamename}" == "Classic Offensive" ]; then
+						${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid_co}" ${branch} -validate +quit
+						local exitcode=$?
+					fi
 				fi
 			fi
 		elif [ "${counter}" -ge "11" ]; then

+ 7 - 6
lgsm/functions/mods_list.sh

@@ -15,16 +15,17 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 # Get a proper URL for mods that don't provide a good one (optional)
 fn_script_log_info "Retrieving latest mods URLs"
 # Metamod
-metamodscrapeurl="http://www.gsptalk.com/mirror/sourcemod"
-metamodlatestfile="$(wget "${metamodscrapeurl}/?MD" -q -O -| grep "mmsource" | grep "\-linux" | head -n1 | awk -F '>' '{ print $3 }' | awk -F '<' '{ print $1}')"
-metamoddownloadurl="http://cdn.probablyaserver.com/sourcemod/"
-metamodurl="${metamoddownloadurl}/${metamodlatestfile}"
+metamodmversion="1.10"
+metamodscrapeurl="https://mms.alliedmods.net/mmsdrop/${metamodmversion}/mmsource-latest-linux"
+metamodlatestfile="$(wget "${metamodscrapeurl}" -q -O -)"
+metamoddownloadurl="https://www.metamodsource.net/latest.php?os=linux&version=${metamodmversion}"
+metamodurl="${metamoddownloadurl}"
 # Sourcemod
 sourcemodmversion="1.8"
 sourcemodscrapeurl="https://sm.alliedmods.net/smdrop/${sourcemodmversion}/sourcemod-latest-linux"
 sourcemodlatestfile="$(wget "${sourcemodscrapeurl}" -q -O -)"
-sourcemoddownloadurl="https://sm.alliedmods.net/smdrop/${sourcemodmversion}"
-sourcemodurl="${sourcemoddownloadurl}/${sourcemodlatestfile}"
+sourcemoddownloadurl="https://www.sourcemod.net/latest.php?os=linux&version=${sourcemodmversion}"
+sourcemodurl="${sourcemoddownloadurl}"
 
 # Define mods information (required)
 

+ 9 - 2
lgsm/functions/update_steamcmd.sh

@@ -30,6 +30,9 @@ fn_update_steamcmd_dl(){
 		${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
 		${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${branch} +quit | tee -a "${scriptlog}"
+		if [ "${gamename}" == "Classic Offensive" ]; then
+			${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid_co}" ${branch} +quit | tee -a "${scriptlog}"
+		fi
 	fi
 
 	fix.sh
@@ -137,6 +140,7 @@ fn_update_request_log(){
 }
 
 fn_update_steamcmd_check(){
+	appid="${1}"
 	fn_appmanifest_check
 	# Checks for server update from SteamCMD
 	fn_print_dots "Checking for update: SteamCMD"
@@ -183,7 +187,6 @@ fn_update_steamcmd_check(){
 		sleep 1
 		echo -e "	Current build: ${red}${currentbuild}${default}"
 		echo -e "	Available build: ${green}${availablebuild}${default}"
-		echo -e ""
 		echo -e "	https://steamdb.info/app/${appid}/"
 		sleep 1
 		echo ""
@@ -242,5 +245,9 @@ if [ "${engine}" == "goldsource" ]||[ "${forceupdate}" == "1" ]; then
 	fi
 else
 	fn_update_request_log
-	fn_update_steamcmd_check
+	fn_update_steamcmd_check "${appid}"
+	# will also check for second appid
+	if [ "${gamename}" == "Classic Offensive" ]; then
+		fn_update_steamcmd_check "${appid_co}"
+	fi
 fi

+ 1 - 1
tests/tests_jc2server.sh

@@ -17,7 +17,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 fi
 
-version="170305"
+version="170501"
 
 ##########################
 ######## Settings ########

+ 1 - 1
tests/tests_ts3server.sh

@@ -14,7 +14,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 fi
 
-version="170305"
+version="170501"
 
 ##########################
 ######## Settings ########