Răsfoiți Sursa

Added command_install_resources_mta.sh

Daniel Gibbs 9 ani în urmă
părinte
comite
c5d9476218

+ 31 - 0
lgsm/functions/command_install_resources_mta.sh

@@ -0,0 +1,31 @@
+#!/bin/bash
+# LGSM command_install_resources_mta.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+# Description: Installs the default resources for Multi Theft Auto.
+
+local commandname="DEFAULT_RESOURCES"
+local commandaction="Default Resources"
+local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+
+fn_install_resources(){
+	echo ""
+	echo "Installing Default Resources"
+	echo "================================="
+	fileurl="http://mirror.mtasa.com/mtasa/resources/mtasa-resources-latest.zip"; filedir="${tmpdir}"; filename="multitheftauto_resources.zip"; executecmd="noexecute" run="norun"; force="noforce"; md5="97a587509698f7f010bcd6e5c6dd9c31"
+	fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
+	fn_dl_extract "${filedir}" "${filename}" "${resourcesdir}"
+	echo "Default Resources Installed."
+}
+
+fn_print_header
+
+fn_print_warning_nl "Installing the default resources with existing resources may cause issues."
+while true; do
+	read -e -i "y" -p "Do you want to install MTA default resources? [Y/n]" yn
+	case $yn in
+	[Yy]* ) fn_install_resources && break;;
+	[Nn]* ) break;;
+	* ) echo "Please answer yes or no.";;
+	esac
+done

+ 5 - 0
lgsm/functions/core_functions.sh

@@ -182,6 +182,11 @@ functionfile="${FUNCNAME}"
 fn_fetch_function
 }
 
+command_install_resources_mta.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
 command_fastdl.sh(){
 functionfile="${FUNCNAME}"
 fn_fetch_function

+ 71 - 1
lgsm/functions/core_getopt.sh

@@ -342,6 +342,73 @@ case "${getopt}" in
 	esac
 }
 
+fn_getopt_mta(){
+case "${getopt}" in
+	st|start)
+		command_start.sh;;
+	sp|stop)
+		command_stop.sh;;
+	r|restart)
+		command_restart.sh;;
+	uf|update-functions)
+		command_update_functions.sh;;
+	m|monitor)
+		command_monitor.sh;;
+	ta|test-alert)
+		command_test_alert.sh;;
+	dt|details)
+		command_details.sh;;
+	pd|postdetails)
+		command_postdetails.sh;;
+	b|backup)
+		command_backup.sh;;
+	c|console)
+		command_console.sh;;
+	d|debug)
+		command_debug.sh;;
+	dev|dev-debug)
+		command_dev_debug.sh;;
+	i|install)
+		command_install.sh;;
+	ir|install-default-resources)
+		command_install_resources_mta.sh;;
+	ai|auto-install)
+		fn_autoinstall;;
+	dd|detect-deps)
+		command_dev_detect_deps.sh;;
+	dg|detect-glibc)
+		command_dev_detect_glibc.sh;;
+	dl|detect-ldd)
+		command_dev_detect_ldd.sh;;
+	*)
+	if [ -n "${getopt}" ]; then
+		echo -e "${red}Unknown command${default}: $0 ${getopt}"
+		exitcode=2
+	fi
+	echo "Usage: $0 [option]"
+	echo "${gamename} - Linux Game Server Manager - Version ${version}"
+	echo "https://gameservermanagers.com/${selfname}"
+	echo -e ""
+	echo -e "${lightyellow}Commands${default}"
+	{
+		echo -e "${blue}start\t${default}st |Start the server."
+		echo -e "${blue}stop\t${default}sp |Stop the server."
+		echo -e "${blue}restart\t${default}r  |Restart the server."
+		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
+		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
+		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
+		echo -e "${blue}details\t${default}dt |Displays useful infomation about the server."
+		echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
+		echo -e "${blue}backup\t${default}b  |Create archive of the server."
+		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
+		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
+		echo -e "${blue}install\t${default}i  |Install the server."
+		echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
+		echo -e "${blue}install-default-resources\t${default}ir |Install the MTA default resources."
+	} | column -s $'\t' -t
+	esac
+}
+
 fn_getopt_mumble(){
 case "${getopt}" in
 	st|start)
@@ -772,6 +839,9 @@ elif [ "${gamename}" == "Garry's Mod" ]; then
 # Minecraft
 elif [ "${engine}" == "lwjgl2" ]; then
 	fn_getopt_minecraft
+# Multi Theft Auto
+elif [ "${gamename}" == "Multi Theft Auto" ]; then
+	fn_getopt_mta
 # Mumble
 elif [ "${gamename}" == "Mumble" ]; then
 	fn_getopt_mumble
@@ -789,7 +859,7 @@ elif [ "${engine}" == "unreal2" ]; then
 elif [ "${engine}" == "unreal" ]; then
 	fn_getopt_unreal
 # Generic
-elif [ "${gamename}" == "Battlefield: 1942" ]||[ "${gamename}" == "Call of Duty" ]||[ "${gamename}" == "Call of Duty: United Offensive" ]||[ "${gamename}" == "Call of Duty 2" ]||[ "${gamename}" == "Call of Duty 4" ]||[ "${gamename}" == "Call of Duty: World at War" ]||[ "${gamename}" == "Multi Theft Auto" ]||[ "${gamename}" == "QuakeWorld" ]||[ "${gamename}" == "Quake 2" ]||[ "${gamename}" == "Quake 3: Arena" ]||[ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
+elif [ "${gamename}" == "Battlefield: 1942" ]||[ "${gamename}" == "Call of Duty" ]||[ "${gamename}" == "Call of Duty: United Offensive" ]||[ "${gamename}" == "Call of Duty 2" ]||[ "${gamename}" == "Call of Duty 4" ]||[ "${gamename}" == "Call of Duty: World at War" ]||[ "${gamename}" == "QuakeWorld" ]||[ "${gamename}" == "Quake 2" ]||[ "${gamename}" == "Quake 3: Arena" ]||[ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
 	fn_getopt_generic_no_update
 elif  [ "${gamename}" == "Factorio" ]; then
 	fn_getopt_generic_update_no_steam