fn_install_config 9.9 KB

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