1+ #! /bin/bash
2+ # Project: Game Server Managers - LinuxGSM
3+ # Author: Daniel Gibbs
4+ # License: MIT License, Copyright (c) 2017 Daniel Gibbs
5+ # Purpose: Ballistic Overkill | Server Management Script
6+ # Contributors: https://github.com/GameServerManagers/LinuxGSM/graphs/contributors
7+ # Documentation: https://github.com/GameServerManagers/LinuxGSM/wiki
8+ # Website: https://gameservermanagers.com
9+
10+ # Debugging
11+ if [ -f " .dev-debug" ]; then
12+ exec 5> dev-debug.log
13+ BASH_XTRACEFD=" 5"
14+ set -x
15+ fi
16+
17+ version=" 170219"
18+
19+ # #########################
20+ # ####### Settings ########
21+ # #########################
22+
23+ # ### Server Settings ####
24+
25+ # # Optional: Game Server Login Token
26+ # GSLT can be used for running a public server.
27+ # More info: https://gameservermanagers.com/gslt
28+ gslt=" "
29+
30+ # # Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
31+ fn_parms (){
32+ parms=" -batchmode -nographics -logFile output.txt"
33+ }
34+
35+ # ### LinuxGSM Settings ####
36+
37+ # # Notification Alerts
38+ # (on|off)
39+ # Email Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Email
40+ emailalert=" off"
41+ 42+ emailfrom=" "
43+
44+ # Pushbullet Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Pushbullet
45+ pushbulletalert=" off"
46+ pushbullettoken=" accesstoken"
47+ channeltag=" "
48+
49+ # # Updating | https://github.com/GameServerManagers/LinuxGSM/wiki/Update
50+ updateonstart=" off"
51+
52+ # # Backup | https://github.com/GameServerManagers/LinuxGSM/wiki/Backup
53+ maxbackups=" 4"
54+ maxbackupdays=" 30"
55+ stoponbackup=" on"
56+
57+ # # Logging | https://github.com/GameServerManagers/LinuxGSM/wiki/Logging
58+ consolelogging=" on"
59+ logdays=" 7"
60+
61+ # ### LinuxGSM Advanced Settings ####
62+
63+ # # Github Branch Select
64+ # Allows for the use of different function files
65+ # from a different repo and/or branch.
66+ githubuser=" GameServerManagers"
67+ githubrepo=" LinuxGSM"
68+ githubbranch=" master"
69+
70+ # # SteamCMD Settings
71+ # Server appid
72+ appid=" 416880"
73+ # Steam App Branch Select
74+ # Allows to opt into the various Steam app branches. Default branch is "".
75+ # Example: "-beta latest_experimental"
76+ branch=" "
77+
78+ # # LinuxGSM Server Details
79+ # Do not edit
80+ gamename=" Ballistic Overkill"
81+ engine=" unity"
82+
83+ # # Service Name | https://github.com/GameServerManagers/LinuxGSM/wiki/Multiple-Servers
84+ servicename=" bo-server"
85+
86+ # ### Directories ####
87+ # Edit with care
88+
89+ # # Work Directories
90+ rootdir=" $( dirname $( readlink -f " ${BASH_SOURCE[0]} " ) ) "
91+ selfname=" $( basename $( readlink -f " ${BASH_SOURCE[0]} " ) ) "
92+ lockselfname=" .${servicename} .lock"
93+ lgsmdir=" ${rootdir} /lgsm"
94+ functionsdir=" ${lgsmdir} /functions"
95+ libdir=" ${lgsmdir} /lib"
96+ tmpdir=" ${lgsmdir} /tmp"
97+ filesdir=" ${rootdir} /serverfiles"
98+
99+ # # Server Specific Directories
100+ systemdir=" ${filesdir} "
101+ executabledir=" ${filesdir} "
102+ executable=" ./BODS.x86"
103+ servercfg=" ${servicename} .txt"
104+ servercfgdefault=" config.txt"
105+ servercfgdir=" ${systemdir} "
106+ servercfgfullpath=" ${servercfgdir} /${servercfg} "
107+
108+
109+ # # Backup Directory
110+ backupdir=" ${rootdir} /backups"
111+
112+ # # Logging Directorie
113+ gamelogdir=" ${systemdir} /logs"
114+ scriptlogdir=" ${rootdir} /log/script"
115+ consolelogdir=" ${rootdir} /log/console"
116+ scriptlog=" ${scriptlogdir} /${servicename} -script.log"
117+ consolelog=" ${consolelogdir} /${servicename} -console.log"
118+ emaillog=" ${scriptlogdir} /${servicename} -email.log"
119+
120+ # # Logs Naming
121+ scriptlogdate=" ${scriptlogdir} /${servicename} -script-$( date ' +%Y-%m-%d-%H:%M:%S' ) .log"
122+ consolelogdate=" ${consolelogdir} /${servicename} -console-$( date ' +%Y-%m-%d-%H:%M:%S' ) .log"
123+
124+ # #######################
125+ # ####### Script ########
126+ # ##### Do not edit #####
127+ # #######################
128+
129+ # Fetches core_dl for file downloads
130+ fn_fetch_core_dl (){
131+ github_file_url_dir=" lgsm/functions"
132+ github_file_url_name=" ${functionfile} "
133+ filedir=" ${functionsdir} "
134+ filename=" ${github_file_url_name} "
135+ githuburl=" https://raw.githubusercontent.com/${githubuser} /${githubrepo} /${githubbranch} /${github_file_url_dir} /${github_file_url_name} "
136+ # If the file is missing, then download
137+ if [ ! -f " ${filedir} /${filename} " ]; then
138+ if [ ! -d " ${filedir} " ]; then
139+ mkdir -p " ${filedir} "
140+ fi
141+ echo -e " fetching ${filename} ...\c"
142+ # Check curl exists and use available path
143+ curlpaths=" $( command -v curl 2> /dev/null) $( which curl > /dev/null 2>&1 ) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
144+ for curlcmd in ${curlpaths}
145+ do
146+ if [ -x " ${curlcmd} " ]; then
147+ break
148+ fi
149+ done
150+ # If curl exists download file
151+ if [ " $( basename ${curlcmd} ) " == " curl" ]; then
152+ curlfetch=$( ${curlcmd} -s --fail -o " ${filedir} /${filename} " " ${githuburl} " 2>&1 )
153+ if [ $? -ne 0 ]; then
154+ echo -e " \e[0;31mFAIL\e[0m\n"
155+ echo " ${curlfetch} "
156+ echo -e " ${githuburl} \n"
157+ exit 1
158+ else
159+ echo -e " \e[0;32mOK\e[0m"
160+ fi
161+ else
162+ echo -e " \e[0;31mFAIL\e[0m\n"
163+ echo " Curl is not installed!"
164+ echo -e " "
165+ exit 1
166+ fi
167+ chmod +x " ${filedir} /${filename} "
168+ fi
169+ source " ${filedir} /${filename} "
170+ }
171+
172+ core_dl.sh (){
173+ # Functions are defined in core_functions.sh.
174+ functionfile=" ${FUNCNAME} "
175+ fn_fetch_core_dl
176+ }
177+
178+ core_functions.sh (){
179+ # Functions are defined in core_functions.sh.
180+ functionfile=" ${FUNCNAME} "
181+ fn_fetch_core_dl
182+ }
183+
184+ # Prevent from running this script as root.
185+ if [ " $( whoami) " = " root" ]; then
186+ if [ ! -f " ${functionsdir} /core_functions.sh" ]|| [ ! -f " ${functionsdir} /check_root.sh" ]|| [ ! -f " ${functionsdir} /core_messages.sh" ]|| [ ! -f " ${functionsdir} /core_exit.sh" ]; then
187+ echo " [ FAIL ] Do NOT run this script as root!"
188+ exit 1
189+ else
190+ core_functions.sh
191+ check_root.sh
192+ fi
193+ fi
194+
195+ core_dl.sh
196+ core_functions.sh
197+ getopt=$1
198+ core_getopt.sh
0 commit comments