fn_install_config 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. #!/bin/bash
  2. # LGSM fn_install_config function
  3. # Author: Daniel Gibbs
  4. # Website: http://gameservermanagers.com
  5. # Version: 281015
  6. fn_arkconfig(){
  7. echo "creating ${servercfg} config file."
  8. cp -v "lgsm-default.ini" "${servercfgfullpath}"
  9. sleep 1
  10. echo ""
  11. }
  12. fn_arma3config(){
  13. echo "creating ${servercfg} config file."
  14. cp -v "${servercfgdefault}" "${servercfgfullpath}"
  15. sleep 1
  16. echo "creating ${networkcfg} config file."
  17. cp -v "${networkcfgdefault}" "${networkcfgfullpath}"
  18. sleep 1
  19. echo ""
  20. }
  21. fn_dstconfig(){
  22. echo "creating ${servercfg} config file."
  23. cp -v "${servercfgdefault}" "${servercfgfullpath}"
  24. sleep 1
  25. echo ""
  26. }
  27. fn_goldsourceconfig(){
  28. echo "creating ${servercfg} config file."
  29. cp -v "lgsm-default.cfg" "${servercfgfullpath}"
  30. sleep 1
  31. # server.cfg redirects to ${servercfg} for added security
  32. echo "creating server.cfg."
  33. touch "${defaultcfg}"
  34. sleep 1
  35. echo "creating redirect."
  36. echo "server.cfg > ${servercfg}."
  37. echo "exec ${servercfg}" > "${defaultcfg}"
  38. sleep 1
  39. # creating other files required
  40. echo "creating listip.cfg."
  41. sleep 1
  42. touch "${systemdir}/listip.cfg"
  43. echo "creating banned.cfg."
  44. touch "${systemdir}/banned.cfg"
  45. sleep 1
  46. # allow user to input server name and password
  47. if [ -z "${autoinstall}" ]; then
  48. echo ""
  49. echo "Configuring ${gamename} Server"
  50. echo "================================="
  51. sleep 1
  52. read -p "Enter server name: " servername
  53. read -p "Enter rcon password: " rconpass
  54. else
  55. servername="${servicename}"
  56. rconpass="rconpassword"
  57. fi
  58. sed -i "s/\"hostname\"/\"${servername}\"/g" "${servercfgfullpath}"
  59. sed -i "s/\"rconpassword\"/\"${rconpass}\"/g" "${servercfgfullpath}"
  60. echo ""
  61. }
  62. fn_jc2config(){
  63. echo "creating ${servercfg} config file."
  64. cp -v "${servercfgdefault}" "${servercfgfullpath}"
  65. sleep 1
  66. echo ""
  67. }
  68. fn_serious3config(){
  69. echo "creating ${servercfg} config file."
  70. cp -v "${servercfgdefault}" "${servercfgfullpath}"
  71. sleep 1
  72. echo ""
  73. echo "To edit ${gamename} server config use SS3 Server GUI 3 tool"
  74. echo "http://mrag.nl/sgui3/"
  75. sleep 1
  76. echo ""
  77. }
  78. fn_sourceconfig(){
  79. echo "creating ${servercfg} config file."
  80. cp -v "lgsm-default.cfg" "${servercfgfullpath}"
  81. sleep 1
  82. # server.cfg redirects to ${servercfg} for added security
  83. echo "creating server.cfg."
  84. touch "${servercfgdefault}"
  85. sleep 1
  86. echo "creating redirect."
  87. echo "server.cfg > ${servercfg}."
  88. echo "exec ${servercfg}" > "${servercfgdefault}"
  89. sleep 1
  90. # allow user to input server name and password
  91. if [ -z "${autoinstall}" ]; then
  92. echo ""
  93. echo "Configuring ${gamename} Server"
  94. echo "================================="
  95. sleep 1
  96. read -p "Enter server name: " servername
  97. read -p "Enter rcon password: " rconpass
  98. else
  99. servername="${servicename}"
  100. rconpass="rconpassword"
  101. fi
  102. sed -i "s/\"hostname\"/\"${servername}\"/g" "${servercfgfullpath}"
  103. sed -i "s/\"rconpassword\"/\"${rconpass}\"/g" "${servercfgfullpath}"
  104. echo ""
  105. }
  106. fn_teeworldsconfig(){
  107. echo "creating ${servercfg} config file."
  108. cp -v "${servercfgdefault}" "${servercfgfullpath}"
  109. sleep 1
  110. echo ""
  111. }
  112. fn_terrariaconfig(){
  113. echo "creating ${servercfg} config file."
  114. cp -v "${servercfgdefault}" "${servercfgfullpath}"
  115. sleep 1
  116. echo ""
  117. }
  118. fn_ts3config(){
  119. echo "creating blank ${servercfg} config file."
  120. sleep 1
  121. echo "${servercfg} can remain blank by default."
  122. sleep 1
  123. echo "${servercfg} is located in ${servercfgfullpath}."
  124. sleep 1
  125. touch "${servercfgfullpath}"
  126. }
  127. fn_ut99config(){
  128. echo "${defaultcfg} > ${servercfgfullpath}"
  129. tr -d '\r' < "${servercfgdefault}" > "${servercfgfullpath}"
  130. sleep 1
  131. echo ""
  132. echo "Configuring ${gamename} Server"
  133. echo "================================="
  134. sleep 1
  135. echo "enabling WebAdmin."
  136. sed -i 's/bEnabled=False/bEnabled=True/g' "${servercfgfullpath}"
  137. sleep 1
  138. echo "setting WebAdmin port to 8076."
  139. sed -i '467i\ListenPort=8076' "${servercfgfullpath}"
  140. sleep 1
  141. echo ""
  142. }
  143. fn_unity3dconfig(){
  144. echo "creating ${servercfg} config file."
  145. cp -v "${servercfgdefault}" "${servercfgfullpath}"
  146. sleep 1
  147. echo ""
  148. }
  149. fn_unreal2config(){
  150. echo "creating ${servercfg} config file."
  151. cp -v "${servercfgdefault}" "${servercfgfullpath}"
  152. sleep 1
  153. echo ""
  154. echo "Configuring ${gamename} Server"
  155. echo "================================="
  156. sleep 1
  157. echo "setting WebAdmin username and password."
  158. sed -i 's/AdminName=/AdminName=admin/g' "${servercfgfullpath}"
  159. sed -i 's/AdminPassword=/AdminPassword=admin/g' "${servercfgfullpath}"
  160. sleep 1
  161. echo "enabling WebAdmin."
  162. sed -i 's/bEnabled=False/bEnabled=True/g' "${servercfgfullpath}"
  163. if [ "${gamename}" == "Unreal Tournament 2004" ]; then
  164. sleep 1
  165. echo "setting WebAdmin port to 8075."
  166. sed -i 's/ListenPort=80/ListenPort=8075/g' "${servercfgfullpath}"
  167. fi
  168. sleep 1
  169. echo ""
  170. }
  171. echo ""
  172. echo "Creating Configs"
  173. echo "================================="
  174. sleep 1
  175. if [ ! -d "${servercfgdir}" ]; then
  176. echo -e "creating ${servercfgdir} dir...\c"
  177. mkdir -pv "${servercfgdir}"
  178. if [[ $? == 0 ]]; then
  179. echo -e "OK"
  180. else
  181. echo -e "FAIL"
  182. fi
  183. fi
  184. cd "${servercfgdir}"
  185. # statements
  186. if [ "${gamename}" == "7 Days To Die" ]; then
  187. fn_unity3dconfig
  188. elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then
  189. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/ARKSurvivalEvolved/cfg/lgsm-default.ini 2>&1 | grep -F HTTP | cut -c45- | uniq
  190. sleep 1
  191. echo -e "downloading lgsm-default.ini...\c"
  192. fn_arkconfig
  193. elif [ "${gamename}" == "ARMA 3" ]; then
  194. echo -e "downloading lgsm-default.server.cfg...\c"
  195. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/Arma3/cfg/lgsm-default.server.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  196. sleep 1
  197. echo -e "downloading lgsm-default.network.cfg...\c"
  198. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/Arma3/cfg/lgsm-default.network.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  199. sleep 1
  200. fn_arma3config
  201. elif [ "${gamename}" == "Black Mesa: Deathmatch" ]; then
  202. echo -e "downloading lgsm-default.cfg...\c"
  203. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/BlackMesa/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  204. sleep 1
  205. fn_sourceconfig
  206. elif [ "${gamename}" == "Blade Symphony" ]; then
  207. echo -e "downloading lgsm-default.cfg...\c"
  208. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/BladeSymphony/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  209. sleep 1
  210. fn_goldsourceconfig
  211. elif [ "${gamename}" == "Counter Strike 1.6" ]; then
  212. echo -e "downloading lgsm-default.cfg...\c"
  213. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/CounterStrike/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  214. sleep 1
  215. fn_goldsourceconfig
  216. elif [ "${gamename}" == "Counter Strike: Condition Zero" ]; then
  217. echo -e "downloading lgsm-default.cfg...\c"
  218. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/CounterStrikeConditionZero/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  219. sleep 1
  220. fn_goldsourceconfig
  221. elif [ "${gamename}" == "Counter Strike: Global Offensive" ]; then
  222. echo -e "downloading lgsm-default.cfg...\c"
  223. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/CounterStrikeGlobalOffensive/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  224. sleep 1
  225. fn_sourceconfig
  226. elif [ "${gamename}" == "Counter Strike: Source" ]; then
  227. echo -e "downloading lgsm-default.cfg...\c"
  228. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/CounterStrikeSource/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  229. sleep 1
  230. fn_sourceconfig
  231. elif [ "${gamename}" == "Day of Defeat" ]; then
  232. echo -e "downloading lgsm-default.cfg...\c"
  233. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/DayOfDefeat/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  234. sleep 1
  235. fn_goldsourceconfig
  236. elif [ "${gamename}" == "Day of Defeat: Source" ]; then
  237. echo -e "downloading lgsm-default.cfg...\c"
  238. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/DayOfDefeatSource/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  239. sleep 1
  240. fn_sourceconfig
  241. elif [ "${gamename}" == "Dont Starve Together" ]; then
  242. echo -e "downloading lgsm-default.ini...\c"
  243. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/DontStarveTogether/lgsm-default.ini 2>&1 | grep -F HTTP | cut -c45- | uniq
  244. sleep 1
  245. fn_dstconfig
  246. elif [ "${gamename}" == "Double Action: Boogaloo" ]; then
  247. echo -e "downloading lgsm-default.cfg...\c"
  248. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/DoubleActionBoogaloo/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  249. sleep 1
  250. fn_sourceconfig
  251. elif [ "${gamename}" == "Fistful of Frags" ]; then
  252. echo -e "downloading lgsm-default.cfg...\c"
  253. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/FistfulOfFrags/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  254. sleep 1
  255. fn_sourceconfig
  256. elif [ "${gamename}" == "Garry's Mod" ]; then
  257. echo -e "downloading lgsm-default.cfg...\c"
  258. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/GarrysMod/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  259. sleep 1
  260. fn_sourceconfig
  261. elif [ "${gamename}" == "Half Life 2: Deathmatch" ]; then
  262. echo -e "downloading lgsm-default.cfg...\c"
  263. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/HalfLife2Deathmatch/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  264. sleep 1
  265. fn_sourceconfig
  266. elif [ "${gamename}" == "Half Life: Deathmatch Classic" ]; then
  267. echo -e "downloading lgsm-default.cfg...\c"
  268. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/HalfLifeDeathmatchClassic/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  269. sleep 1
  270. fn_goldsourceconfig
  271. elif [ "${gamename}" == "Insurgency" ]; then
  272. echo -e "downloading lgsm-default.cfg...\c"
  273. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/Insurgency/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  274. sleep 1
  275. fn_sourceconfig
  276. elif [ "${gamename}" == "Just Cause 2" ]; then
  277. fn_jc2config
  278. elif [ "${gamename}" == "Killing Floor" ]; then
  279. fn_unreal2config
  280. elif [ "${gamename}" == "Left 4 Dead" ]; then
  281. echo -e "downloading lgsm-default.cfg...\c"
  282. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/Left4Dead/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  283. sleep 1
  284. fn_sourceconfig
  285. elif [ "${gamename}" == "Left 4 Dead 2" ]; then
  286. echo -e "downloading lgsm-default.cfg...\c"
  287. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/Left4Dead2/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  288. sleep 1
  289. fn_sourceconfig
  290. elif [ "${gamename}" == "No More Room in Hell" ]; then
  291. echo -e "downloading lgsm-default.cfg...\c"
  292. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/NoMoreRoomInHell/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  293. sleep 1
  294. fn_sourceconfig
  295. elif [ "${gamename}" == "Natural Selection 2" ]; then
  296. echo -e "no configs required."
  297. sleep 1
  298. echo ""
  299. elif [ "${gamename}" == "Red Orchestra: Ostfront 41-45" ]; then
  300. fn_unreal2config
  301. elif [ "${gamename}" == "Serious Sam 3: BFE" ]; then
  302. echo -e "downloading lgsm-default.ini...\c"
  303. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/SeriousSam3BFE/cfg/lgsm-default.ini 2>&1 | grep -F HTTP | cut -c45- | uniq
  304. sleep 1
  305. fn_serious3config
  306. elif [ "${gamename}" == "Teamspeak 3" ]; then
  307. fn_ts3config
  308. elif [ "${gamename}" == "Team Fortress 2" ]; then
  309. echo -e "downloading lgsm-default.cfg...\c"
  310. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/TeamFortress2/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  311. sleep 1
  312. fn_sourceconfig
  313. elif [ "${gamename}" == "Team Fortress Classic" ]; then
  314. echo -e "downloading lgsm-default.cfg...\c"
  315. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/TeamFortressClassic/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  316. sleep 1
  317. fn_goldsourceconfig
  318. elif [ "${gamename}" == "Teeworlds" ]; then
  319. echo -e "downloading ctf.cfg...\c"
  320. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/Teeworlds/cfg/ctf.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  321. echo -e "downloading dm.cfg...\c"
  322. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/Teeworlds/cfg/dm.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  323. echo -e "downloading duel.cfg...\c"
  324. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/Teeworlds/cfg/duel.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  325. echo -e "downloading tdm.cfg...\c"
  326. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/Teeworlds/cfg/tdm.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  327. echo -e "downloading lgsm-default.cfg...\c"
  328. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/Teeworlds/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  329. sleep 1
  330. fn_teeworldsconfig
  331. elif [ "${gamename}" == "Terraria" ]; then
  332. echo -e "downloading lgsm-default.txt...\c"
  333. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/Terraria/cfg/lgsm-default.txt 2>&1 | grep -F HTTP | cut -c45- | uniq
  334. sleep 1
  335. fn_terrariaconfig
  336. elif [ "${gamename}" == "Unreal Tournament 2004" ]; then
  337. fn_unreal2config
  338. elif [ "${gamename}" == "Unreal Tournament 99" ]; then
  339. fn_ut99config
  340. fi