From 6f7aca25b3ad80c2047ddc731c2f0d66835bccb3 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Mon, 28 Dec 2015 21:31:53 +0000 Subject: [PATCH] changed to using function_selfname over getopt --- functions/check.sh | 19 +++++++++---------- functions/command_backup.sh | 2 ++ functions/command_console.sh | 2 ++ functions/command_debug.sh | 2 ++ functions/command_details.sh | 2 ++ functions/command_dev_debug.sh | 2 ++ functions/command_dev_detect_deps.sh | 2 ++ functions/command_install.sh | 2 ++ functions/command_monitor.sh | 1 + functions/command_start.sh | 1 + functions/command_stop.sh | 1 + functions/command_validate.sh | 1 + functions/compress_unreal2_maps.sh | 2 ++ functions/compress_ut99_maps.sh | 2 ++ functions/core_getopt.sh | 3 --- functions/update_check.sh | 3 ++- functions/update_dl.sh | 1 + 17 files changed, 34 insertions(+), 14 deletions(-) diff --git a/functions/check.sh b/functions/check.sh index 4c0259053..a7cd2ae32 100644 --- a/functions/check.sh +++ b/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 \ No newline at end of file diff --git a/functions/command_backup.sh b/functions/command_backup.sh index 65a88508c..5f923ad07 100644 --- a/functions/command_backup.sh +++ b/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 "" diff --git a/functions/command_console.sh b/functions/command_console.sh index 4386cc770..4eab4d6eb 100644 --- a/functions/command_console.sh +++ b/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" diff --git a/functions/command_debug.sh b/functions/command_debug.sh index 5cf2f5138..bec1f7ade 100644 --- a/functions/command_debug.sh +++ b/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 diff --git a/functions/command_details.sh b/functions/command_details.sh index aca698dbc..30437b933 100644 --- a/functions/command_details.sh +++ b/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 diff --git a/functions/command_dev_debug.sh b/functions/command_dev_debug.sh index ed92a90e3..87ba563a3 100644 --- a/functions/command_dev_debug.sh +++ b/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" diff --git a/functions/command_dev_detect_deps.sh b/functions/command_dev_detect_deps.sh index 28826a2bb..30f89157d 100644 --- a/functions/command_dev_detect_deps.sh +++ b/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 diff --git a/functions/command_install.sh b/functions/command_install.sh index dc5b5bff9..2ddb3a785 100644 --- a/functions/command_install.sh +++ b/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 diff --git a/functions/command_monitor.sh b/functions/command_monitor.sh index 728b59c49..f253abc54 100644 --- a/functions/command_monitor.sh +++ b/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 diff --git a/functions/command_start.sh b/functions/command_start.sh index 08bd013d7..2a4c9b74c 100644 --- a/functions/command_start.sh +++ b/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 diff --git a/functions/command_stop.sh b/functions/command_stop.sh index 0b91ea69d..98d21c9a5 100644 --- a/functions/command_stop.sh +++ b/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 ' diff --git a/functions/command_validate.sh b/functions/command_validate.sh index 369969f4d..1d3774276 100644 --- a/functions/command_validate.sh +++ b/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." diff --git a/functions/compress_unreal2_maps.sh b/functions/compress_unreal2_maps.sh index 2a0f88542..627df96a0 100644 --- a/functions/compress_unreal2_maps.sh +++ b/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" diff --git a/functions/compress_ut99_maps.sh b/functions/compress_ut99_maps.sh index 510a7b5a7..cd3948edf 100644 --- a/functions/compress_ut99_maps.sh +++ b/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" diff --git a/functions/core_getopt.sh b/functions/core_getopt.sh index 93b0a005c..563956310 100644 --- a/functions/core_getopt.sh +++ b/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 diff --git a/functions/update_check.sh b/functions/update_check.sh index b5f36f7b5..18813cc4a 100644 --- a/functions/update_check.sh +++ b/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 diff --git a/functions/update_dl.sh b/functions/update_dl.sh index 9c7106287..073760223 100644 --- a/functions/update_dl.sh +++ b/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