fn_install_config 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. #!/bin/bash
  2. # LGSM fn_server function
  3. # Author: Daniel Gibbs
  4. # Website: http://danielgibbs.co.uk
  5. # Version: 200315
  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. elif [
  130. cd "${servercfgdir}" ]; then
  131. #statements
  132. if [ "${gamename}" == "7 Days To Die" ]; then
  133. fn_unity3dconfig
  134. elif [ "${gamename}" == "ARMA 3" ]; then
  135. echo -e "downloading lgsm-default.server.cfg & lgsm-default.network.cfg...\c"
  136. wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/Arma3/cfg/lgsm-default.server.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  137. wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/Arma3/cfg/lgsm-default.network.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
  138. sleep 1
  139. fn_arma3config
  140. elif [ "${gamename}" == "Blade Symphony" ]; then
  141. echo -e "downloading lgsm-default.cfg...\c"
  142. 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
  143. sleep 1
  144. fn_goldsourceconfig
  145. elif [ "${gamename}" == "Counter Strike 1.6" ]; then
  146. echo -e "downloading lgsm-default.cfg...\c"
  147. 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
  148. sleep 1
  149. fn_goldsourceconfig
  150. elif [ "${gamename}" == "Counter Strike: Condition Zero" ]; then
  151. echo -e "downloading lgsm-default.cfg...\c"
  152. 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
  153. sleep 1
  154. fn_goldsourceconfig
  155. elif [ "${gamename}" == "Counter Strike: Global Offensive" ]; then
  156. echo -e "downloading lgsm-default.cfg...\c"
  157. 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
  158. sleep 1
  159. fn_sourceconfig
  160. elif [ "${gamename}" == "Counter Strike: Source" ]; then
  161. echo -e "downloading lgsm-default.cfg...\c"
  162. 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
  163. sleep 1
  164. fn_sourceconfig
  165. elif [ "${gamename}" == "Day of Defeat" ]; then
  166. echo -e "downloading lgsm-default.cfg...\c"
  167. 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
  168. sleep 1
  169. fn_goldsourceconfig
  170. elif [ "${gamename}" == "Day of Defeat: Source" ]; then
  171. echo -e "downloading lgsm-default.cfg...\c"
  172. 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
  173. sleep 1
  174. fn_sourceconfig
  175. elif [ "${gamename}" == "Fistful of Frags" ]; then
  176. echo -e "downloading lgsm-default.cfg...\c"
  177. 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
  178. sleep 1
  179. fn_sourceconfig
  180. elif [ "${gamename}" == "Garry's Mod" ]; then
  181. echo -e "downloading lgsm-default.cfg...\c"
  182. 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
  183. sleep 1
  184. fn_sourceconfig
  185. elif [ "${gamename}" == "Half Life 2: Deathmatch" ]; then
  186. echo -e "downloading lgsm-default.cfg...\c"
  187. 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
  188. sleep 1
  189. fn_sourceconfig
  190. elif [ "${gamename}" == "Half Life: Deathmatch Classic" ]; then
  191. echo -e "downloading lgsm-default.cfg...\c"
  192. 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
  193. sleep 1
  194. fn_goldsourceconfig
  195. elif [ "${gamename}" == "Insurgency" ]; then
  196. echo -e "downloading lgsm-default.cfg...\c"
  197. 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
  198. sleep 1
  199. fn_sourceconfig
  200. elif [ "${gamename}" == "Just Cause 2" ]; then
  201. fn_jc2config
  202. elif [ "${gamename}" == "Killing Floor" ]; then
  203. fn_unreal2config
  204. elif [ "${gamename}" == "Left 4 Dead" ]; then
  205. echo -e "downloading lgsm-default.cfg...\c"
  206. 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
  207. sleep 1
  208. fn_sourceconfig
  209. elif [ "${gamename}" == "Left 4 Dead 2" ]; then
  210. echo -e "downloading lgsm-default.cfg...\c"
  211. 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
  212. sleep 1
  213. fn_sourceconfig
  214. elif [ "${gamename}" == "No More Room in Hell" ]; then
  215. echo -e "downloading lgsm-default.cfg...\c"
  216. 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
  217. sleep 1
  218. fn_sourceconfig
  219. elif [ "${gamename}" == "Natural Selection 2" ]; then
  220. echo -e "no configs required."
  221. sleep 1
  222. echo ""
  223. elif [ "${gamename}" == "Red Orchestra: Ostfront 41-45" ]; then
  224. fn_unreal2config
  225. elif [ "${gamename}" == "Serious Sam 3: BFE" ]; then
  226. echo -e "downloading lgsm-default.ini...\c"
  227. 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
  228. sleep 1
  229. fn_serious3config
  230. elif [ "${gamename}" == "Team Fortress 2" ]; then
  231. echo -e "downloading lgsm-default.cfg...\c"
  232. 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
  233. sleep 1
  234. fn_sourceconfig
  235. elif [ "${gamename}" == "Team Fortress Classic" ]; then
  236. echo -e "downloading lgsm-default.cfg...\c"
  237. 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
  238. sleep 1
  239. fn_goldsourceconfig
  240. elif [ "${gamename}" == "Unreal Tournament 2004" ]; then
  241. fn_unreal2config
  242. elif [ "${gamename}" == "Unreal Tournament 99" ]; then
  243. fn_ut99config
  244. fi