Browse Source

Compatibility for legacy scripts

Daniel Gibbs 10 years ago
parent
commit
89c4c98325
4 changed files with 87 additions and 452 deletions
  1. 7 426
      functions/core_functions.sh
  2. 19 3
      functions/fn_functions
  3. 26 4
      functions/fn_getopt
  4. 35 19
      functions/fn_update_functions

+ 7 - 426
functions/core_functions.sh

@@ -2,75 +2,16 @@
 # LGSM core_functions.sh function
 # LGSM core_functions.sh function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
-lgsm_version="270216"
+lgsm_version="271215"
 
 
-# Description: Defines all functions to allow download and execution of functions using fn_fetch_function.
-# This function is called first before any other function. Without this file other functions would not load.
+# Description: Redirect to new core_functions.sh
 
 
-# Code/functions for legacy servers
-
-fn_functions(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-fn_getopt(){
+core_functions(){
+# Functions are defined in core_functions.sh.
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-# fn_fetch_core_dl also placed here to allow legecy servers to still download core functions
-if [ -z "${lgsmdir}" ]; then
-	lgsmdir="${rootdir}/lgsm"
-	functionsdir="${lgsmdir}/functions"
-	libdir="${lgsmdir}/lib"
-fi 
-
-fn_fetch_core_dl(){
-github_file_url_dir="lgsm/functions"
-github_file_url_name="${functionfile}"
-filedir="${functionsdir}"
-filename="${github_file_url_name}"
-githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
-# If the file is missing, then download
-if [ ! -f "${filedir}/${filename}" ]; then
-	if [ ! -d "${filedir}" ]; then
-		mkdir -p "${filedir}"
-	fi
-	echo -e "    fetching ${filename}...\c"
-	# Check curl exists and use available path
-	curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
-	for curlcmd in ${curlpaths}
-	do
-		if [ -x "${curlcmd}" ]; then
-			break
-		fi
-	done
-	# If curl exists download file
-	if [ "$(basename ${curlcmd})" == "curl" ]; then
-		curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
-		if [ $? -ne 0 ]; then
-			echo -e "\e[0;31mFAIL\e[0m\n"
-			echo "${curlfetch}"
-			echo -e "${githuburl}\n"
-			exit 1
-		else
-			echo -e "\e[0;32mOK\e[0m"
-		fi		
-	else
-		echo -e "\e[0;31mFAIL\e[0m\n"
-		echo "Curl is not installed!"
-		echo -e ""
-		exit 1
-	fi
-	chmod +x "${filedir}/${filename}"
-fi
-source "${filedir}/${filename}"
+fn_fetch_core_dl
 }
 }
 
 
-
-# Core
-
 core_dl.sh(){
 core_dl.sh(){
 # Functions are defined in core_functions.sh.
 # Functions are defined in core_functions.sh.
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
@@ -87,369 +28,9 @@ functionfile="${FUNCNAME}"
 fn_fetch_core_dl
 fn_fetch_core_dl
 }
 }
 
 
-core_dl.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_core_dl
-}
-
-# Command
-
-command_console.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-command_debug.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-command_details.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-command_email_test.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-command_backup.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-command_monitor.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-command_start.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-command_stop.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-command_validate.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-command_install.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-command_fastdl.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-command_ts3_server_pass.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-fn_restart(){
-local modulename="Restarting"
-info_config.sh
-if [ -d "${scriptlogdir}" ]; then
-	fn_scriptlog "${servername}"
-fi	
-command_stop.sh
-command_start.sh
-}
-
-
-# Checks
-
-check.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-check_config.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-check_deps.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-check_ip.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-check_logs.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-check_root.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-check_steamcmd.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-check_system_dir.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-check_tmux.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-
-# Compress
-
-compress_unreal2_maps.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-compress_ut99_maps.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-
-# Dev
-
-command_dev_debug.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-command_dev_detect_deps.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-
-# Fix
-
-fix.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-fix_arma3.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-fix_csgo.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-fix_dst.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-fix_ins.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-fix_steamcmd.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-fix_glibc.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-fix_ro.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-fix_kf.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-fix_ut2k4.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-
-# Info
-
-info_config.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-info_distro.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-info_glibc.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-info_ts3status.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-
-# Email
-
-email.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-# Logs
-
-logs.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-
-# Monitor
-
-monitor_gsquery.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-# Update
-
-update_check.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
 command_update_functions.sh(){
 command_update_functions.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-update_dl.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-fn_update_functions.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-
-#
-## Installer functions
-#
-
-fn_autoinstall(){
-autoinstall=1
-command_install.sh
-}
-
-install_complete.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-install_config.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-install_gsquery.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-install_gslt.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-install_header.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-install_logs.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-install_retry.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-install_server_dir.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-install_server_files.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-install_steamcmd.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-install_ts3.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-install_ts3db.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-install_ut2k4.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-install_dl_ut2k4.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-install_ut2k4_key.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
-}
-
-fix_ut99.sh(){
-functionfile="${FUNCNAME}"
-fn_fetch_function
+fn_fetch_core_dl
 }
 }
 
 
-# Calls on-screen messages
-core_messages.sh
-
-#Calls file downloader
-core_dl.sh
+core_functions.sh

+ 19 - 3
functions/fn_functions

@@ -6,15 +6,31 @@ lgsm_version="271215"
 
 
 # Description: Redirect to new core_functions.sh
 # Description: Redirect to new core_functions.sh
 
 
-core_functions.sh(){
+core_functions(){
 # Functions are defined in core_functions.sh.
 # Functions are defined in core_functions.sh.
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
+}
+
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
 }
 }
 
 
 core_getopt.sh(){
 core_getopt.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
+}
+
+core_messages.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
+}
+
+command_update_functions.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
 }
 }
 
 
 core_functions.sh
 core_functions.sh

+ 26 - 4
functions/fn_getopt

@@ -1,15 +1,37 @@
 #!/bin/bash
 #!/bin/bash
-# LGSM core_getopt.sh function
+# LGSM core_functions.sh function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
 lgsm_version="271215"
 lgsm_version="271215"
 
 
-# Description: Redirect to new core_getopt.sh
+# Description: Redirect to new core_functions.sh
 
 
-core_getopt.sh(){
+core_functions(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
+}
+
+core_dl.sh(){
 # Functions are defined in core_functions.sh.
 # Functions are defined in core_functions.sh.
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
+}
+
+core_getopt.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
+}
+
+core_messages.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
+}
+
+command_update_functions.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
 }
 }
 
 
+core_functions.sh
 core_getopt.sh
 core_getopt.sh

+ 35 - 19
functions/fn_update_functions

@@ -1,22 +1,38 @@
 #!/bin/bash
 #!/bin/bash
-# LGSM fn_update_functions.sh function
+# LGSM core_functions.sh function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
-lgsm_version="230116"
-
-# Description: LEGACY FUNCTION Deletes the functions dir to allow re-downloading of functions from GitHub.
-
-fn_print_dots "Updating functions"
-fn_scriptlog "Updating functions"
-sleep 1
-echo -ne "\n"
-rm -rfv "${rootdir}/functions/"*
-exitcode=$?
-if [ "${exitcode}" == "0" ]; then
-	fn_print_ok "Updating functions"
-	fn_scriptlog "Success! Updating functions"
-else
-	fn_print_fail "Updating functions"
-	fn_scriptlog "Failure! Updating functions"
-fi
-echo -ne "\n"
+lgsm_version="271215"
+
+# Description: Redirect to new core_functions.sh
+
+core_functions(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
+}
+
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
+}
+
+core_getopt.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
+}
+
+core_messages.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
+}
+
+command_update_functions.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
+}
+
+core_functions.sh
+command_update_functions.sh
+