fn_install_config 10 KB

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