fn_install_config 11 KB

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