Browse Source

Migrated updated functions

Daniel Gibbs 11 năm trước cách đây
mục cha
commit
ddd77c8ea7
1 tập tin đã thay đổi với 42 bổ sung82 xóa
  1. 42 82
      CounterStrikeSource/cssserver

+ 42 - 82
CounterStrikeSource/cssserver

@@ -3,7 +3,7 @@
 # Server Management Script
 # Author: Daniel Gibbs
 # Website: http://danielgibbs.co.uk
-# Version: 061014
+# Version: 121114
 
 #### Variables ####
 
@@ -200,46 +200,11 @@ fi
 }
 
 fn_debugserver(){
-fn_rootcheck
-fn_syscheck
-fn_autoip
-fn_distro
-fn_uptime
-fn_load
-fn_parms
-echo ""
-echo "${gamename} Debug"
-echo "============================"
-echo ""
-echo -e "Distro: ${os}"
-echo -e "Arch: ${arch}"
-echo -e "Kernel: ${kernel}"
-echo -e "Hostname: $HOSTNAME"
-echo ""
-echo "Start parameters:"
-echo ${parms}
-echo ""
-echo -e "Use for identifying server issues only!"
-echo -e "Press CTRL+c to drop out of debug mode"
-echo -e "\e[0;31mWARNING!\e[0;39m If ${servicename} is already running it will be stopped"
-echo ""
-while true; do
-	read -p "Continue? [y/N]" yn
-	case $yn in
-	[Yy]* ) break;;
-	[Nn]* ) echo Exiting; return 1;;
-	* ) echo "Please answer yes or no.";;
-esac
-done
-fn_stopserver
-fn_printdots "Starting debug mode ${servicename}: ${servername}"
-sleep 1
-fn_printok "Starting debug mode ${servicename}: ${servername}"
-sleep 1
-fn_scriptlog "Started debug mode ${servername}"
-echo -en "\n"
-cd "${executabledir}"
-${executable} ${parms} -debug
+if [ ! -f functions/fn_debugserver ]; then
+	functionfile="fn_debugserver"
+	fn_fninstall
+fi
+source functions/fn_debugserver
 }
 
 fn_console(){
@@ -644,44 +609,41 @@ echo -en "\n"
 }
 
 fn_details(){
-fn_autoip
-servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
-rcon=$(grep -s rcon_password "${servercfgfullpath}"|sed 's/rcon_password //g'|sed 's/"//g')
-pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l)
-echo ""
-echo "${gamename} Server Details"
-echo "============================"
-echo "Server name: ${servername}"
-echo "Server IP: ${ip}:${port}"
-echo "RCON password: ${rcon}"
-echo "Config file: ${servercfgfullpath}"
-echo ""
-echo "${servername} Ports"
-echo "============================"
-echo "Ports the server is currently using."
-echo ""
-echo "DIRECTION	DESCRIPTION		PORT"
-echo "INBOUND		Game/RCON port		${port}"
-if [ ! -z ${sourcetvport} ]; then
-	echo "INBOUND		SourceTV port		${sourcetvport}"
+if [ ! -f functions/fn_details ]; then
+	functionfile="fn_details"
+	fn_fninstall
 fi
-echo "OUTBOUND	Client port		${clientport}"
-echo ""
-echo "You can change ports by editing the"
-echo "start parameters in ${selfname}."
-echo ""
-if [ "${pid}" == "0" ]; then
-	echo -e "Status:\e[0;31m OFFLINE\e[0;39m"
-else
-	echo -e "Status:\e[0;32m ONLINE\e[0;39m"
+source functions/fn_details
+}
+
+fn_fninstall(){
+cd ${rootdir}	
+if [ ! -d "functions" ]; then
+	mkdir functions
 fi
 echo ""
+echo "Downloading ${functionfile}"
+echo "================================="
+cd functions
+wget -nv -N https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/functions/${functionfile}
+chmod +x ${functionfile}
+cd ${rootdir}
+sleep 1
+echo ""
 }
 
 #
 ## Installer
 #
 
+fn_glibcfix(){
+if [ ! -f functions/fn_glibcfix ]; then
+	functionfile="fn_glibcfix"
+	fn_fninstall
+fi	
+source functions/fn_glibcfix
+}
+
 fn_header(){
 clear
 echo "================================="
@@ -735,14 +697,11 @@ echo ""
 }
 
 fn_steamfix(){
-echo "Applying steamclient.so fix"
-echo "================================="
-sleep 1
-mkdir -pv "${HOME}/.steam"
-mkdir -pv "${HOME}/.steam/sdk32"
-cp -v "${rootdir}/steamcmd/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamclient.so"
-sleep 1
-echo ""
+if [ ! -f functions/fn_steamfix ]; then
+	functionfile="fn_steamfix"
+	fn_fninstall
+fi	
+source functions/fn_steamfix
 }
 
 fn_loginstall(){
@@ -821,6 +780,7 @@ fn_steaminstall
 fn_steamfix
 fn_loginstall
 fn_getquery
+fn_glibcfix
 echo "Configuring ${gamename} Server"
 echo "================================="
 	sleep 1
@@ -834,16 +794,16 @@ echo "================================="
 	echo "Creating ${servicename}.cfg config file."
 	touch "${servercfgfullpath}"
 	{
-		echo -e "// server name"
+		echo -e "// Server Name"
 		echo -e "hostname \"${servername}\""
 		echo -e ""
-		echo -e "// rcon passsword"
+		echo -e "// RCON Password"
 		echo -e "rcon_password \"${rconpass}\""
 		echo -e ""
-		echo -e "// Server password"
+		echo -e "// Server Password"
 		echo -e "sv_password \"\""
 		echo -e ""
-		echo -e "// server logging"
+		echo -e "// Server Logging"
 		echo -e "log on"
 		echo -e "sv_logbans 1"
 		echo -e "sv_logecho 1"