fn_serverconfig 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. #!/bin/bash
  2. # LGSM fn_serverconfig function
  3. # Author: Daniel Gibbs
  4. # Website: http://danielgibbs.co.uk
  5. # Version: 011214
  6. fn_arma3config(){
  7. echo ""
  8. echo "Loading Configs"
  9. echo "================================="
  10. sleep 1
  11. cp -v lgsm-default.cfg "${servercfgfullpath}"
  12. sleep 1
  13. echo ""
  14. }
  15. fn_goldsourceconfig(){
  16. echo ""
  17. echo "Loading Configs"
  18. echo "================================="
  19. sleep 1
  20. echo "creating ${servicename}.cfg config file."
  21. cp -v lgsm-default.cfg "${servercfgfullpath}"
  22. sleep 1
  23. echo "creating server.cfg."
  24. touch "${defaultcfg}"
  25. sleep 1
  26. echo "creating redirect."
  27. echo "server.cfg > ${servercfg}."
  28. echo "exec ${servercfg}" > "${defaultcfg}"
  29. echo "creating listip.cfg."
  30. sleep 1
  31. touch "${systemdir}/listip.cfg"
  32. echo "creating banned.cfg."
  33. touch "${systemdir}/banned.cfg"
  34. sleep 1
  35. if [ -z "${autoinstall}" ]; then
  36. echo ""
  37. echo "Configuring ${gamename} Server"
  38. echo "================================="
  39. sleep 1
  40. read -p "Enter server name: " servername
  41. read -p "Enter rcon password: " rconpass
  42. else
  43. servername="${servicename}"
  44. rconpass="rconpassword"
  45. fi
  46. sed -i "s/\"hostname\"/\"${servername}\"/g" "${servercfgfullpath}"
  47. sed -i "s/\"rconpassword\"/\"${rconpass}\"/g" "${servercfgfullpath}"
  48. echo ""
  49. }
  50. fn_jc2config(){
  51. echo ""
  52. echo "Loading Configs"
  53. echo "================================="
  54. sleep 1
  55. cd "${filesdir}"
  56. cp -v default_config.lua config.lua
  57. sleep 1
  58. echo ""
  59. }
  60. fn_sourceconfig(){
  61. echo ""
  62. echo "Loading Configs"
  63. echo "================================="
  64. sleep 1
  65. echo "creating ${servicename}.cfg config file."
  66. cp -v lgsm-default.cfg "${servercfgfullpath}"
  67. sleep 1
  68. echo "creating server.cfg."
  69. touch "${defaultcfg}"
  70. sleep 1
  71. echo "creating redirect."
  72. echo "server.cfg > ${servercfg}."
  73. echo "exec ${servercfg}" > "${defaultcfg}"
  74. sleep 1
  75. if [ -z "${autoinstall}" ]; then
  76. echo ""
  77. echo "Configuring ${gamename} Server"
  78. echo "================================="
  79. sleep 1
  80. read -p "Enter server name: " servername
  81. read -p "Enter rcon password: " rconpass
  82. else
  83. servername="${servicename}"
  84. rconpass="rconpassword"
  85. fi
  86. sed -i "s/\"hostname\"/\"${servername}\"/g" "${servercfgfullpath}"
  87. sed -i "s/\"rconpassword\"/\"${rconpass}\"/g" "${servercfgfullpath}"
  88. echo ""
  89. }
  90. fn_ut99config(){
  91. echo "Loading Configs"
  92. echo "================================="
  93. sleep 1
  94. echo "${defaultcfg} > ${systemdir}/${ini}"
  95. tr -d '\r' < "${defaultcfg}" > "${systemdir}/${ini}"
  96. sleep 1
  97. echo ""
  98. echo "Configuring ${gamename} Server"
  99. echo "================================="
  100. sleep 1
  101. echo "Enabling WebAdmin"
  102. sed -i 's/bEnabled=False/bEnabled=True/g' "${systemdir}/${ini}"
  103. sleep 1
  104. echo "Setting WebAdmin port to 8076"
  105. sed -i '467i\ListenPort=8076' "${systemdir}/${ini}"
  106. echo ""
  107. }
  108. fn_unreal2config(){
  109. echo ""
  110. echo "Loading Configs"
  111. echo "================================="
  112. sleep 1
  113. cp -v "${defaultcfg}" "${systemdir}/${ini}"
  114. sleep 1
  115. echo ""
  116. echo "Configuring ${gamename} Server"
  117. echo "================================="
  118. sleep 1
  119. echo "Setting WebAdmin username and password"
  120. sed -i 's/AdminName=/AdminName=admin/g' "${systemdir}/${ini}"
  121. sed -i 's/AdminPassword=/AdminPassword=admin/g' "${systemdir}/${ini}"
  122. sleep 1
  123. echo "Enabling WebAdmin"
  124. sed -i 's/bEnabled=False/bEnabled=True/g' "${systemdir}/${ini}"
  125. sleep 1
  126. echo "Setting WebAdmin port to 8077"
  127. sed -i 's/ListenPort=80/ListenPort=8077/g' "${systemdir}/${ini}"
  128. echo ""
  129. }
  130. echo "Downloading lgsm-default.cfg"
  131. echo "================================="
  132. sleep 1
  133. cd "${servercfgdir}"
  134. if [ "${gamename}" == "ARMA 3" ]; then
  135. wget --no-check-certificate -nv -N https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/Arma3/cfg/lgsm-default.cfg
  136. fn_arma3config
  137. elif [ "${gamename}" == "Blade Symphony" ]; then
  138. wget --no-check-certificate -nv -N https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/BladeSymphony/cfg/lgsm-default.cfg
  139. fn_goldsourceconfig
  140. elif [ "${gamename}" == "Counter Strike 1.6" ]; then
  141. wget --no-check-certificate -nv -N https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/CounterStrike/cfg/lgsm-default.cfg
  142. fn_goldsourceconfig
  143. elif [ "${gamename}" == "Counter Strike: Condition Zero" ]; then
  144. wget --no-check-certificate -nv -N https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/CounterStrikeConditionZero/cfg/lgsm-default.cfg
  145. fn_goldsourceconfig
  146. elif [ "${gamename}" == "Counter Strike: Global Offensive" ]; then
  147. wget --no-check-certificate -nv -N https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/CounterStrikeGlobalOffensive/cfg/lgsm-default.cfg
  148. fn_sourceconfig
  149. elif [ "${gamename}" == "Counter Strike: Source" ]; then
  150. wget --no-check-certificate -nv -N https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/CounterStrikeSource/cfg/lgsm-default.cfg
  151. fn_sourceconfig
  152. elif [ "${gamename}" == "Day of Defeat" ]; then
  153. wget --no-check-certificate -nv -N https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/DayOfDefeat/cfg/lgsm-default.cfg
  154. fn_goldsourceconfig
  155. elif [ "${gamename}" == "Day of Defeat: Source" ]; then
  156. wget --no-check-certificate -nv -N https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/DayOfDefeatSource/cfg/lgsm-default.cfg
  157. fn_sourceconfig
  158. elif [ "${gamename}" == "Fistful of Frags" ]; then
  159. wget --no-check-certificate -nv -N https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/FistfulOfFrags/cfg/lgsm-default.cfg
  160. fn_sourceconfig
  161. elif [ "${gamename}" == "Garrys's Mod" ]; then
  162. wget --no-check-certificate -nv -N https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/GarrysMod/cfg/lgsm-default.cfg
  163. fn_sourceconfig
  164. elif [ "${gamename}" == "Half Life 2: Deathmatch" ]; then
  165. wget --no-check-certificate -nv -N https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/HalfLife2Deathmatch/cfg/lgsm-default.cfg
  166. fn_sourceconfig
  167. elif [ "${gamename}" == "Half Life: Deathmatch Classic" ]; then
  168. wget --no-check-certificate -nv -N https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/HalfLifeDeathmatchClassic/cfg/lgsm-default.cfg
  169. fn_goldsourceconfig
  170. elif [ "${gamename}" == "Insurgency" ]; then
  171. wget --no-check-certificate -nv -N https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/Insurgency/cfg/lgsm-default.cfg
  172. fn_sourceconfig
  173. elif [ "${gamename}" == "Just Cause 2" ]; then
  174. echo "lgsm-default.cfg not required."
  175. fn_jc2config
  176. elif [ "${gamename}" == "Killing Floor" ]; then
  177. echo "lgsm-default.cfg not required."
  178. fn_unreal2config
  179. elif [ "${gamename}" == "Left 4 Dead" ]; then
  180. wget --no-check-certificate -nv -N https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/Left4Dead/cfg/lgsm-default.cfg
  181. fn_sourceconfig
  182. elif [ "${gamename}" == "Left 4 Dead 2" ]; then
  183. wget --no-check-certificate -nv -N https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/Left4Dead2/cfg/lgsm-default.cfg
  184. fn_sourceconfig
  185. elif [ "${gamename}" == "No More Room in Hell" ]; then
  186. wget --no-check-certificate -nv -N https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/NoMoreRoomInHell/cfg/lgsm-default.cfg
  187. fn_sourceconfig
  188. elif [ "${gamename}" == "Red Orchestra: Ostfront 41-45" ]; then
  189. echo "lgsm-default.cfg not required."
  190. fn_unreal2config
  191. elif [ "${gamename}" == "Team Fortress 2" ]; then
  192. wget --no-check-certificate -nv -N https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/TeamFortress2/cfg/lgsm-default.cfg
  193. fn_sourceconfig
  194. elif [ "${gamename}" == "Team Fortress Classic" ]; then
  195. wget --no-check-certificate -nv -N https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/TeamFortressClassic/cfg/lgsm-default.cfg
  196. fn_goldsourceconfig
  197. elif [ "${gamename}" == "Unreal Tournament 2004" ]; then
  198. echo "lgsm-default.cfg not required."
  199. fn_unreal2config
  200. elif [ "${gamename}" == "Unreal Tournament 99" ]; then
  201. echo "lgsm-default.cfg not required."
  202. fn_ut99config
  203. fi