fn_install_config 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. #!/bin/bash
  2. # LGSM fn_install_config function
  3. # Author: Daniel Gibbs
  4. # Website: http://gameservermanagers.com
  5. # Version: 090815
  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_ts3config(){
  107. echo "creating blank ${servercfg} config file."
  108. sleep 1
  109. echo "${servercfg} can remain blank by default."
  110. sleep 1
  111. echo "${servercfg} is located in ${servercfgfullpath}."
  112. sleep 1
  113. touch "${servercfgfullpath}"
  114. }
  115. fn_ut99config(){
  116. echo "${defaultcfg} > ${servercfgfullpath}"
  117. tr -d '\r' < "${servercfgdefault}" > "${servercfgfullpath}"
  118. sleep 1
  119. echo ""
  120. echo "Configuring ${gamename} Server"
  121. echo "================================="
  122. sleep 1
  123. echo "enabling WebAdmin."
  124. sed -i 's/bEnabled=False/bEnabled=True/g' "${servercfgfullpath}"
  125. sleep 1
  126. echo "setting WebAdmin port to 8076."
  127. sed -i '467i\ListenPort=8076' "${servercfgfullpath}"
  128. sleep 1
  129. echo ""
  130. }
  131. fn_unity3dconfig(){
  132. echo "creating ${servercfg} config file."
  133. cp -v "${servercfgdefault}" "${servercfgfullpath}"
  134. sleep 1
  135. echo ""
  136. }
  137. fn_unreal2config(){
  138. echo "creating ${servercfg} config file."
  139. cp -v "${servercfgdefault}" "${servercfgfullpath}"
  140. sleep 1
  141. echo ""
  142. echo "Configuring ${gamename} Server"
  143. echo "================================="
  144. sleep 1
  145. echo "setting WebAdmin username and password."
  146. sed -i 's/AdminName=/AdminName=admin/g' "${servercfgfullpath}"
  147. sed -i 's/AdminPassword=/AdminPassword=admin/g' "${servercfgfullpath}"
  148. sleep 1
  149. echo "enabling WebAdmin."
  150. sed -i 's/bEnabled=False/bEnabled=True/g' "${servercfgfullpath}"
  151. if [ "${gamename}" == "Unreal Tournament 2004" ]; then
  152. sleep 1
  153. echo "setting WebAdmin port to 8075."
  154. sed -i 's/ListenPort=80/ListenPort=8075/g' "${servercfgfullpath}"
  155. fi
  156. sleep 1
  157. echo ""
  158. }
  159. echo ""
  160. echo "Creating Configs"
  161. echo "================================="
  162. sleep 1
  163. if [ ! -d "${servercfgdir}" ]; then
  164. echo -e "creating ${servercfgdir} dir...\c"
  165. mkdir -pv "${servercfgdir}"
  166. if [[ $? == 0 ]]; then
  167. echo -e "OK"
  168. else
  169. echo -e "FAIL"
  170. fi
  171. fi
  172. cd "${servercfgdir}"
  173. # statements
  174. if [ "${gamename}" == "7 Days To Die" ]; then
  175. fn_unity3dconfig
  176. elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then
  177. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/ARKSurvivalEvolved/cfg/lgsm-default.ini 2>&1 | grep -F HTTP | cut -c45- | uniq
  178. sleep 1
  179. echo -e "downloading lgsm-default.ini...\c"
  180. fn_arkconfig
  181. elif [ "${gamename}" == "ARMA 3" ]; then
  182. echo -e "downloading lgsm-default.server.cfg...\c"
  183. 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
  184. sleep 1
  185. echo -e "downloading lgsm-default.network.cfg...\c"
  186. 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
  187. sleep 1
  188. fn_arma3config
  189. elif [ "${gamename}" == "Black Mesa: Deathmatch" ]; then
  190. echo -e "downloading lgsm-default.cfg...\c"
  191. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/BlackMesa/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  192. sleep 1
  193. fn_sourceconfig
  194. elif [ "${gamename}" == "Blade Symphony" ]; then
  195. echo -e "downloading lgsm-default.cfg...\c"
  196. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/BladeSymphony/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  197. sleep 1
  198. fn_goldsourceconfig
  199. elif [ "${gamename}" == "Counter Strike 1.6" ]; then
  200. echo -e "downloading lgsm-default.cfg...\c"
  201. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/CounterStrike/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  202. sleep 1
  203. fn_goldsourceconfig
  204. elif [ "${gamename}" == "Counter Strike: Condition Zero" ]; then
  205. echo -e "downloading lgsm-default.cfg...\c"
  206. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/CounterStrikeConditionZero/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  207. sleep 1
  208. fn_goldsourceconfig
  209. elif [ "${gamename}" == "Counter Strike: Global Offensive" ]; then
  210. echo -e "downloading lgsm-default.cfg...\c"
  211. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/CounterStrikeGlobalOffensive/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  212. sleep 1
  213. fn_sourceconfig
  214. elif [ "${gamename}" == "Counter Strike: Source" ]; then
  215. echo -e "downloading lgsm-default.cfg...\c"
  216. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/CounterStrikeSource/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  217. sleep 1
  218. fn_sourceconfig
  219. elif [ "${gamename}" == "Day of Defeat" ]; then
  220. echo -e "downloading lgsm-default.cfg...\c"
  221. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/DayOfDefeat/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  222. sleep 1
  223. fn_goldsourceconfig
  224. elif [ "${gamename}" == "Day of Defeat: Source" ]; then
  225. echo -e "downloading lgsm-default.cfg...\c"
  226. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/DayOfDefeatSource/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  227. sleep 1
  228. fn_sourceconfig
  229. elif [ "${gamename}" == "Dont Starve Together" ]; then
  230. echo -e "downloading lgsm-default.ini...\c"
  231. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/DontStarveTogether/lgsm-default.ini 2>&1 | grep -F HTTP | cut -c45- | uniq
  232. sleep 1
  233. fn_dstconfig
  234. elif [ "${gamename}" == "Double Action: Boogaloo" ]; then
  235. echo -e "downloading lgsm-default.cfg...\c"
  236. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/DoubleActionBoogaloo/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  237. sleep 1
  238. fn_sourceconfig
  239. elif [ "${gamename}" == "Fistful of Frags" ]; then
  240. echo -e "downloading lgsm-default.cfg...\c"
  241. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/FistfulOfFrags/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  242. sleep 1
  243. fn_sourceconfig
  244. elif [ "${gamename}" == "Garry's Mod" ]; then
  245. echo -e "downloading lgsm-default.cfg...\c"
  246. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/GarrysMod/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  247. sleep 1
  248. fn_sourceconfig
  249. elif [ "${gamename}" == "Half Life 2: Deathmatch" ]; then
  250. echo -e "downloading lgsm-default.cfg...\c"
  251. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/HalfLife2Deathmatch/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  252. sleep 1
  253. fn_sourceconfig
  254. elif [ "${gamename}" == "Half Life: Deathmatch Classic" ]; then
  255. echo -e "downloading lgsm-default.cfg...\c"
  256. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/HalfLifeDeathmatchClassic/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  257. sleep 1
  258. fn_goldsourceconfig
  259. elif [ "${gamename}" == "Insurgency" ]; then
  260. echo -e "downloading lgsm-default.cfg...\c"
  261. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/Insurgency/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  262. sleep 1
  263. fn_sourceconfig
  264. elif [ "${gamename}" == "Just Cause 2" ]; then
  265. fn_jc2config
  266. elif [ "${gamename}" == "Killing Floor" ]; then
  267. fn_unreal2config
  268. elif [ "${gamename}" == "Left 4 Dead" ]; then
  269. echo -e "downloading lgsm-default.cfg...\c"
  270. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/Left4Dead/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  271. sleep 1
  272. fn_sourceconfig
  273. elif [ "${gamename}" == "Left 4 Dead 2" ]; then
  274. echo -e "downloading lgsm-default.cfg...\c"
  275. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/Left4Dead2/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  276. sleep 1
  277. fn_sourceconfig
  278. elif [ "${gamename}" == "No More Room in Hell" ]; then
  279. echo -e "downloading lgsm-default.cfg...\c"
  280. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/NoMoreRoomInHell/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  281. sleep 1
  282. fn_sourceconfig
  283. elif [ "${gamename}" == "Natural Selection 2" ]; then
  284. echo -e "no configs required."
  285. sleep 1
  286. echo ""
  287. elif [ "${gamename}" == "Red Orchestra: Ostfront 41-45" ]; then
  288. fn_unreal2config
  289. elif [ "${gamename}" == "Serious Sam 3: BFE" ]; then
  290. echo -e "downloading lgsm-default.ini...\c"
  291. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/SeriousSam3BFE/cfg/lgsm-default.ini 2>&1 | grep -F HTTP | cut -c45- | uniq
  292. sleep 1
  293. fn_serious3config
  294. elif [ "${gamename}" == "Teamspeak 3" ]; then
  295. fn_ts3config
  296. elif [ "${gamename}" == "Team Fortress 2" ]; then
  297. echo -e "downloading lgsm-default.cfg...\c"
  298. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/TeamFortress2/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  299. sleep 1
  300. fn_sourceconfig
  301. elif [ "${gamename}" == "Team Fortress Classic" ]; then
  302. echo -e "downloading lgsm-default.cfg...\c"
  303. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/TeamFortressClassic/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  304. sleep 1
  305. fn_goldsourceconfig
  306. elif [ "${gamename}" == "Unreal Tournament 2004" ]; then
  307. fn_unreal2config
  308. elif [ "${gamename}" == "Unreal Tournament 99" ]; then
  309. fn_ut99config
  310. fi