Explorar el Código

changed to using function_selfname over getopt

Daniel Gibbs hace 10 años
padre
commit
6f7aca25b3

+ 9 - 10
functions/check.sh

@@ -19,41 +19,40 @@ array_contains () {
     return $in
 }
 
-
 check_root.sh
 
-if [ "${getopt}" != "install" ]||[ "${getopt}" != "auto-install" ]; then
+if [ "${function_selfname}" != "install" ]||[ "${function_selfname}" != "auto-install" ]; then
 	check_systemdir.sh
 fi
 
-local allowed_commands_array=( backup console debug details map-compressor monitor start stop update validate )
+local allowed_commands_array=( command_backup.sh command_console.sh command_debug.sh command_details.sh command_unreal2_maps.sh command_ut99_maps.sh command_monitor.sh command_start.sh command_stop.sh command_update.sh command_validate.sh )
 for allowed_command in "${allowed_commands_array[@]}"
 do
-	if [ "${allowed_command}" == "${getopt}" ]; then
+	if [ "${allowed_command}" == "${function_selfname}" ]; then
 		check_logs.sh
 	fi
 done
 
-local allowed_commands_array=( debug details monitor start stop )
+local allowed_commands_array=( command_debug.sh command_details.sh command_monitor.sh command_start.sh command_stop.sh )
 for allowed_command in "${allowed_commands_array[@]}"
 do
-	if [ "${allowed_command}" == "${getopt}" ]; then
+	if [ "${allowed_command}" == "${function_selfname}" ]; then
 		check_ip.sh
 	fi
 done
 
-local allowed_commands_array=( debug install start stop update validate )
+local allowed_commands_array=( command_debug.sh command_start.sh command_stop.sh command_update.sh command_validate.sh )
 for allowed_command in "${allowed_commands_array[@]}"
 do
-	if [ "${allowed_command}" == "${getopt}" ]; then
+	if [ "${allowed_command}" == "${function_selfname}" ]; then
 		check_steamcmd.sh
 	fi
 done
 
-local allowed_commands_array=( console start stop )
+local allowed_commands_array=( command_console.sh command_start.sh command_stop.sh )
 for allowed_command in "${allowed_commands_array[@]}"
 do
-	if [ "${allowed_command}" == "${getopt}" ]; then
+	if [ "${allowed_command}" == "${function_selfname}" ]; then
 		check_tmux.sh
 	fi
 done

+ 2 - 0
functions/command_backup.sh

@@ -7,6 +7,8 @@ lgsm_version="271215"
 # Description: Creates a .tar.gz file in the backup directory.
 
 local modulename="Backup"
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+
 check.sh
 backupname="${servicename}-$(date '+%Y-%m-%d-%H%M%S')"
 echo ""

+ 2 - 0
functions/command_console.sh

@@ -7,6 +7,8 @@ lgsm_version="271215"
 # Description: Gives access to the server tmux console.
 
 local modulename="Console"
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+
 check.sh
 echo ""
 echo "${gamename} Console"

+ 2 - 0
functions/command_debug.sh

@@ -7,6 +7,8 @@ lgsm_version="271215"
 # Description: Runs the server without tmux. Runs direct from the terminal.
 
 local modulename="Debug"
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+
 check.sh
 info_distro.sh
 fn_parms

+ 2 - 0
functions/command_details.sh

@@ -6,6 +6,8 @@ lgsm_version="271215"
 
 # Description: Displays server infomation.
 
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+
 # Standard Details
 # This applies to all engines
 

+ 2 - 0
functions/command_dev_debug.sh

@@ -4,6 +4,8 @@
 # Website: http://gameservermanagers.com
 lgsm_version="271215"
 
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+
 if [ -f ".dev-debug" ]; then
 	rm .dev-debug
 	fn_printoknl "Disabled dev-debug"

+ 2 - 0
functions/command_dev_detect_deps.sh

@@ -7,6 +7,8 @@ lgsm_version="271215"
 # Description: Detects dependencies the server binary requires.
 
 local modulename="Backup"
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+
 check.sh
 cd "${executabledir}"
 if [ "${executable}" ==  "./hlds_run" ]; then

+ 2 - 0
functions/command_install.sh

@@ -4,6 +4,8 @@
 # Website: http://gameservermanagers.com
 lgsm_version="271215"
 
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+
 check.sh
 install_header.sh
 install_serverdir.sh

+ 1 - 0
functions/command_monitor.sh

@@ -8,6 +8,7 @@ lgsm_version="271215"
 # then passes to monitor_gsquery.sh.
 
 local modulename="Monitor"
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
 fn_monitor_teamspeak3(){
 check.sh

+ 1 - 0
functions/command_start.sh

@@ -7,6 +7,7 @@ lgsm_version="271215"
 # Description: Starts the server.
 
 local modulename="Starting"
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
 fn_start_teamspeak3(){
 check.sh

+ 1 - 0
functions/command_stop.sh

@@ -7,6 +7,7 @@ lgsm_version="271215"
 # Description: Stops the server.
 
 local modulename="Stopping"
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
 sdtd_telnet(){
     sdtdshutdown=$( expect -c '

+ 1 - 0
functions/command_validate.sh

@@ -7,6 +7,7 @@ lgsm_version="271215"
 # Description: Runs a server validation.
 
 local modulename="Validate"
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
 fn_validation(){
 fn_printwarn "Validating may overwrite some customised files."

+ 2 - 0
functions/compress_unreal2_maps.sh

@@ -4,6 +4,8 @@
 # Website: http://gameservermanagers.com
 lgsm_version="271215"
 
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+
 check.sh
 clear
 echo "${gamename} Map Compressor"

+ 2 - 0
functions/compress_ut99_maps.sh

@@ -4,6 +4,8 @@
 # Website: http://gameservermanagers.com
 lgsm_version="271215"
 
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+
 check.sh
 clear
 echo "${gamename} Map Compressor"

+ 0 - 3
functions/core_getopt.sh

@@ -203,8 +203,6 @@ case "$getopt" in
 		fn_autoinstall;;
 	dd|depsdetect)
 		dev_detect_deps.sh;;
-	gc|gmod-content)
-		fn_content_gmod;;
 	*)
 	echo "Usage: $0 [option]"
 	echo "${gamename} - Linux Game Server Manager - Version ${version}"
@@ -227,7 +225,6 @@ case "$getopt" in
 		echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal."
 		echo -e "\e[34minstall\t\e[0mInstall the server."
 		echo -e "\e[34mauto-install\t\e[0mInstall the server, without prompts."
-		echo -e "\e[34mgmod-content\t\e[0mDownload gmod add-on content."
 	} | column -s $'\t' -t 
 	esac
 exit

+ 2 - 1
functions/update_check.sh

@@ -7,6 +7,7 @@ lgsm_version="271215"
 # Description: Checks if a server update is available.
 
 local modulename="Update"
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
 ### SteamCMD Update Checker ###
 
@@ -296,7 +297,7 @@ else
 fi
 }
 
-check_logs.sh
+check.sh
 fn_printdots "Checking for update"
 if [ "${gamename}" == "Teamspeak 3" ]; then
 	fn_teamspeak3_check

+ 1 - 0
functions/update_dl.sh

@@ -7,6 +7,7 @@ lgsm_version="271215"
 # Description: Runs a server update.
 
 local modulename="Update"
+function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
 fn_steamcmd_dl(){
 check.sh