| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449 |
- #!/bin/bash
- # LGSM fn_getopt function
- # Author: Daniel Gibbs
- # Website: http://gameservermanagers.com
- lgsm_version="061115"
- # Description: getopt arguments.
- fn_getopt_generic(){
- case "$getopt" in
- st|start)
- fn_start;;
- sp|stop)
- fn_stop;;
- r|restart)
- fn_restart;;
- u|update)
- fn_update_check;;
- fu|force-update|update-restart)
- forceupdate=1;
- fn_update_check;;
- uf|update-functions)
- fn_update_functions;;
- v|validate)
- fn_validate;;
- m|monitor)
- fn_monitor;;
- et|email-test)
- fn_email_test;;
- d|details)
- fn_details;;
- b|backup)
- fn_backup;;
- c|console)
- fn_console;;
- d|debug)
- fn_debug;;
- i|install)
- fn_install;;
- ai|auto-install)
- fn_autoinstall;;
- dd|depsdetect)
- fn_deps_detect;;
- *)
- echo "Usage: $0 [option]"
- echo "${gamename} - Linux Game Server Manager - Version ${version}"
- echo "http://gameservermanagers.com/${selfname}"
- echo -e ""
- echo -e "\e[93mCommands\e[0m"
- {
- echo -e "\e[34mstart\t\e[0mStart the server."
- echo -e "\e[34mstop\t\e[0mStop the server."
- echo -e "\e[34mrestart\t\e[0mRestart the server."
- echo -e "\e[34mupdate\t\e[0mChecks and applies updates from SteamCMD."
- echo -e "\e[34mforce-update\t\e[0mBypasses the check and applies updates from SteamCMD."
- echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded."
- echo -e "\e[34mvalidate\t\e[0mValidate server files with SteamCMD."
- echo -e "\e[34mmonitor\t\e[0mChecks that the server is running."
- echo -e "\e[34memail-test\t\e[0mSends test monitor email."
- echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server."
- echo -e "\e[34mbackup\t\e[0mCreate archive of the server."
- echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server."
- 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."
- } | column -s $'\t' -t
- esac
- exit
- }
- fn_getopt_teamspeak3(){
- case "$getopt" in
- st|start)
- fn_start;;
- sp|stop)
- fn_stop;;
- r|restart)
- fn_restart;;
- u|update)
- fn_update_check;;
- uf|update-functions)
- fn_update_functions;;
- m|monitor)
- fn_monitor;;
- et|email-test)
- fn_email_test;;
- d|details)
- fn_details;;
- b|backup)
- fn_backup;;
- i|install)
- fn_install;;
- ai|auto-install)
- fn_autoinstall;;
- dd|depsdetect)
- fn_deps_detect;;
- *)
- echo "Usage: $0 [option]"
- echo "${gamename} - Linux Game Server Manager - Version ${version}"
- echo "http://gameservermanagers.com/${selfname}"
- echo -e ""
- echo -e "\e[93mCommands\e[0m"
- {
- echo -e "\e[34mstart\t\e[0mStart the server."
- echo -e "\e[34mstop\t\e[0mStop the server."
- echo -e "\e[34mrestart\t\e[0mRestart the server."
- echo -e "\e[34mupdate\t\e[0mChecks and applies updates from teamspeak.com."
- echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded."
- echo -e "\e[34mmonitor\t\e[0mChecks that the server is running."
- echo -e "\e[34memail-test\t\e[0mSends test monitor email."
- echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server."
- echo -e "\e[34mbackup\t\e[0mCreate archive of the server."
- echo -e "\e[34minstall\t\e[0mInstall the server."
- echo -e "\e[34mauto-install\t\e[0mInstall the server, without prompts."
- } | column -s $'\t' -t
- esac
- exit
- }
- fn_getopt_mumble(){
- case "$getopt" in
- st|start)
- fn_start;;
- sp|stop)
- fn_stop;;
- r|restart)
- fn_restart;;
- uf|update-functions)
- fn_update_functions;;
- m|monitor)
- fn_monitor;;
- et|email-test)
- fn_email_test;;
- b|backup)
- fn_backup;;
- console)
- fn_console;;
- d|debug)
- fn_debug;;
- dd|depsdetect)
- fn_deps_detect;;
- *)
- echo "Usage: $0 [option]"
- echo "${gamename} - Linux Game Server Manager - Version ${version}"
- echo "http://gameservermanagers.com/${selfname}"
- echo -e ""
- echo -e "\e[93mCommands\e[0m"
- {
- echo -e "\e[34mstart\t\e[0mStart the server."
- echo -e "\e[34mstop\t\e[0mStop the server."
- echo -e "\e[34mrestart\t\e[0mRestart the server."
- echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded."
- echo -e "\e[34mmonitor\t\e[0mChecks that the server is running."
- echo -e "\e[34memail-test\t\e[0mSends test monitor email."
- echo -e "\e[34mbackup\t\e[0mCreate archive of the server."
- echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server."
- echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal."
- } | column -s $'\t' -t
- esac
- exit
- }
- fn_getopt_gmodserver(){
- case "$getopt" in
- st|start)
- fn_start;;
- sp|stop)
- fn_stop;;
- r|restart)
- fn_restart;;
- u|update)
- fn_update_check;;
- fu|force-update|update-restart)
- forceupdate=1;
- fn_update_check;;
- uf|update-functions)
- fn_update_functions;;
- v|validate)
- fn_validate;;
- m|monitor)
- fn_monitor;;
- et|email-test)
- fn_email_test;;
- d|details)
- fn_details;;
- b|backup)
- fn_backup;;
- c|console)
- fn_console;;
- d|debug)
- fn_debug;;
- i|install)
- fn_install;;
- ai|auto-install)
- fn_autoinstall;;
- dd|depsdetect)
- fn_deps_detect;;
- co|content)
- fn_content_gmod;;
- ica|install-content-all)
- gmod-content-mode=0
- fn_content_gmod;;
- iccss|install-content-css)
- gmod-content-mode=1
- fn_content_gmod;;
- ictf2|install-content-tf2)
- gmod-content-mode=2
- fn_content_gmod;;
- icp2|install-content-p2)
- gmod-content-mode=3
- fn_content_gmod;;
- rca|remove-content-all)
- gmod-content-mode=4
- fn_content_gmod;;
- rccss|remove-content-css)
- gmod-content-mode=5
- fn_content_gmod;;
- rctf2|remove-content-tf2)
- gmod-content-mode=6
- fn_content_gmod;;
- rcp2|remove-content-p2)
- gmod-content-mode=7
- fn_content_gmod;;
- uc|update-content)
- gmod-content-mode=7
- fn_content_gmod;;
- vc|validate-content)
- gmod-content-mode=8
- fn_content_gmod;;
- *)
- } | column -s $'\t' -t
- esac
- exit
- echo "Usage: $0 [option]"
- echo "${gamename} - Linux Game Server Manager - Version ${version}"
- echo "http://gameservermanagers.com/${selfname}"
- echo -e ""
- echo -e "\e[93mCommands\e[0m"
- {
- echo -e "\e[34mstart\t\e[0mStart the server."
- echo -e "\e[34mstop\t\e[0mStop the server."
- echo -e "\e[34mrestart\t\e[0mRestart the server."
- echo -e "\e[34mupdate\t\e[0mChecks and applies updates from SteamCMD."
- echo -e "\e[34mforce-update\t\e[0mBypasses the check and applies updates from SteamCMD."
- echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded."
- echo -e "\e[34mvalidate\t\e[0mValidate server files with SteamCMD."
- echo -e "\e[34mmonitor\t\e[0mChecks that the server is running."
- echo -e "\e[34memail-test\t\e[0mSends test monitor email."
- echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server."
- echo -e "\e[34mbackup\t\e[0mCreate archive of the server."
- echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server."
- 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."
- echo -e "\e[34mcontent\t\e[0mList options for content mounting on ${gamename} server."
- } | column -s $'\t' -t
- esac
- exit
- }
- fn_getopt_unreal(){
- case "$getopt" in
- st|start)
- fn_start;;
- sp|stop)
- fn_stop;;
- r|restart)
- fn_restart;;
- uf|update-functions)
- fn_update_functions;;
- m|monitor)
- fn_monitor;;
- et|email-test)
- fn_email_test;;
- d|details)
- fn_details;;
- b|backup)
- fn_backup;;
- c|console)
- fn_console;;
- d|debug)
- fn_debug;;
- i|install)
- fn_install;;
- mc|map-compressor)
- fn_compress_ut99maps;;
- dd|depsdetect)
- fn_deps_detect;;
- *)
- echo "Usage: $0 [option]"
- echo "${gamename} - Linux Game Server Manager - Version ${version}"
- echo "http://gameservermanagers.com/${selfname}"
- echo -e ""
- echo -e "\e[93mCommands\e[0m"
- {
- echo -e "\e[34mstart\t\e[0mStart the server."
- echo -e "\e[34mstop\t\e[0mStop the server."
- echo -e "\e[34mrestart\t\e[0mRestart the server."
- echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded."
- echo -e "\e[34mmonitor\t\e[0mChecks that the server is running."
- echo -e "\e[34memail-test\t\e[0mSends test monitor email."
- echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server."
- echo -e "\e[34mbackup\t\e[0mCreate archive of the server."
- echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server."
- 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[34mmap-compressor\t\e[0mCompresses all ${gamename} server maps."
- } | column -s $'\t' -t
- esac
- exit
- }
- fn_getopt_unreal2(){
- case "$getopt" in
- st|start)
- fn_start;;
- sp|stop)
- fn_stop;;
- r|restart)
- fn_restart;;
- u|update)
- fn_update_check;;
- fu|force-update|update-restart)
- forceupdate=1;
- fn_update_check;;
- uf|update-functions)
- fn_update_functions;;
- v|validate)
- fn_validate;;
- m|monitor)
- fn_monitor;;
- et|email-test)
- fn_email_test;;
- d|details)
- fn_details;;
- b|backup)
- fn_backup;;
- c|console)
- fn_console;;
- d|debug)
- fn_debug;;
- i|install)
- fn_install;;
- ai|auto-install)
- fn_autoinstall;;
- dd|depsdetect)
- fn_deps_detect;;
- mc|map-compressor)
- fn_compress_unreal2maps;;
- *)
- echo "Usage: $0 [option]"
- echo "${gamename} - Linux Game Server Manager - Version ${version}"
- echo "http://gameservermanagers.com/${selfname}"
- echo -e ""
- echo -e "\e[93mCommands\e[0m"
- {
- echo -e "\e[34mstart\t\e[0mStart the server."
- echo -e "\e[34mstop\t\e[0mStop the server."
- echo -e "\e[34mrestart\t\e[0mRestart the server."
- echo -e "\e[34mupdate\t\e[0mChecks and applies updates from SteamCMD."
- echo -e "\e[34mforce-update\t\e[0mBypasses the check and applies updates from SteamCMD."
- echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded."
- echo -e "\e[34mvalidate\t\e[0mValidate server files with SteamCMD."
- echo -e "\e[34mmonitor\t\e[0mChecks that the server is running."
- echo -e "\e[34memail-test\t\e[0mSends test monitor email."
- echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server."
- echo -e "\e[34mbackup\t\e[0mCreate archive of the server."
- echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server."
- 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[34mmap-compressor\t\e[0mCompresses all ${gamename} server maps."
- } | column -s $'\t' -t
- esac
- exit
- }
- fn_getopt_ut2k4(){
- case "$getopt" in
- st|start)
- fn_start;;
- sp|stop)
- fn_stop;;
- r|restart)
- fn_restart;;
- uf|update-functions)
- fn_update_functions;;
- m|monitor)
- fn_monitor;;
- et|email-test)
- fn_email_test;;
- d|details)
- fn_details;;
- b|backup)
- fn_backup;;
- c|console)
- fn_console;;
- d|debug)
- fn_debug;;
- i|install)
- fn_install;;
- mc|map-compressor)
- fn_compress_ut99maps;;
- dd|depsdetect)
- fn_deps_detect;;
- *)
- echo "Usage: $0 [option]"
- echo "${gamename} - Linux Game Server Manager - Version ${version}"
- echo "http://gameservermanagers.com/${selfname}"
- echo -e ""
- echo -e "\e[93mCommands\e[0m"
- {
- echo -e "\e[34mstart\t\e[0mStart the server."
- echo -e "\e[34mstop\t\e[0mStop the server."
- echo -e "\e[34mrestart\t\e[0mRestart the server."
- echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded."
- echo -e "\e[34mmonitor\t\e[0mChecks that the server is running."
- echo -e "\e[34memail-test\t\e[0mSends test monitor email."
- echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server."
- echo -e "\e[34mbackup\t\e[0mCreate archive of the server."
- echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server."
- 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[34mmap-compressor\t\e[0mCompresses all ${gamename} server maps."
- } | column -s $'\t' -t
- esac
- exit
- }
- if [ "${gamename}" == "Mumble" ]; then
- fn_getopt_mumble
- elif [ "${gamename}" == "Teamspeak 3" ]; then
- fn_getopt_teamspeak3
- elif [ "${engine}" == "unreal2" ]; then
- if [ "${gamename}" == "Unreal Tournament 2004" ]; then
- fn_getopt_ut2k4
- else
- fn_getopt_unreal2
- fi
- elif [ "${engine}" == "unreal" ]; then
- fn_getopt_unreal
- elif [ "$gamename" == "Garry's Mod" ]; then
- fn_getopt_gmodserver
- else
- fn_getopt_generic
- fi
|