fn_install_config 10 KB

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