fn_install_config 9.5 KB

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