fn_serverconfig 9.3 KB

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