check_deps.sh 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. #!/bin/bash
  2. # LinuxGSM check_deps.sh function
  3. # Author: Daniel Gibbs
  4. # Website: https://linuxgsm.com
  5. # Description: Checks if required dependencies are installed for LinuxGSM.
  6. local commandname="CHECK"
  7. fn_install_mono_repo(){
  8. if [ "${monostatus}" != "0" ]; then
  9. fn_print_dots "Adding Mono repository"
  10. sleep 0.5
  11. sudo -v > /dev/null 2>&1
  12. if [ $? -eq 0 ]; then
  13. fn_print_info_nl "Automatically adding Mono repository."
  14. fn_script_log_info "Automatically adding Mono repository."
  15. echo -en ".\r"
  16. sleep 1
  17. echo -en "..\r"
  18. sleep 1
  19. echo -en "...\r"
  20. sleep 1
  21. echo -en " \r"
  22. if [ "${distroid}" == "ubuntu" ]; then
  23. if [ "${distroversion}" == "18.04" ]; then
  24. cmd="sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/ubuntu stable-bionic main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update"
  25. eval ${cmd}
  26. elif [ "${distroversion}" == "16.04" ]; then
  27. cmd="sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;sudo apt install apt-transport-https;echo 'deb https://download.mono-project.com/repo/ubuntu stable-xenial main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update"
  28. eval ${cmd}
  29. elif [ "${distroversion}" == "14.04" ]; then
  30. cmd="sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;sudo apt install apt-transport-https;echo 'deb https://download.mono-project.com/repo/ubuntu stable-trusty main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update"
  31. eval ${cmd}
  32. else
  33. fn_print_warn_nl "Installing Mono repository"
  34. echo "Mono auto install not available for ${distroname}"
  35. echo " Follow instructions on mono site to install the latest version of Mono."
  36. echo " https://www.mono-project.com/download/stable/#download-lin"
  37. monoautoinstall="1"
  38. fi
  39. elif [ "${distroid}" == "debian" ]; then
  40. if [ "${distroversion}" == "9" ]; then
  41. cmd="sudo apt install apt-transport-https dirmngr;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;echo 'deb https://download.mono-project.com/repo/debian stable-stretch main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update"
  42. eval ${cmd}
  43. elif [ "${distroversion}" == "8" ]; then
  44. cmd="sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF;sudo apt install apt-transport-https;echo 'deb https://download.mono-project.com/repo/debian stable-jessie main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list;sudo apt update"
  45. eval ${cmd}
  46. else
  47. echo "Mono auto install not available for ${distroname}"
  48. echo " Follow instructions on mono site to install the latest version of Mono."
  49. echo " https://www.mono-project.com/download/stable/#download-lin"
  50. monoautoinstall="1"
  51. fi
  52. elif [ "${distroid}" == "centos" ]; then
  53. if [ "${distroversion}" == "7" ]; then
  54. cmd="rpm --import 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF';su -c 'curl https://download.mono-project.com/repo/centos7-stable.repo | tee /etc/yum.repos.d/mono-centos7-stable.repo'"
  55. eval ${cmd}
  56. elif [ "${distroversion}" == "6" ]; then
  57. cmd="rpm --import 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF';su -c 'curl https://download.mono-project.com/repo/centos6-stable.repo | tee /etc/yum.repos.d/mono-centos6-stable.repo'"
  58. eval ${cmd}
  59. else
  60. echo "Mono auto install not available for ${distroname}"
  61. echo " Follow instructions on mono site to install the latest version of Mono."
  62. echo " https://www.mono-project.com/download/stable/#download-lin"
  63. monoautoinstall="1"
  64. fi
  65. elif [ "${distroid}" == "fedora" ]; then
  66. cmd="rpm --import 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF'; su -c 'curl https://download.mono-project.com/repo/centos7-stable.repo | tee /etc/yum.repos.d/mono-centos7-stable.repo'; dnf update"
  67. eval ${cmd}
  68. else
  69. echo "Mono auto install not available for ${distroname}"
  70. echo " Follow instructions on mono site to install the latest version of Mono."
  71. echo " https://www.mono-project.com/download/stable/#download-lin"
  72. monoautoinstall="1"
  73. fi
  74. if [ "${monoautoinstall}" != "1" ];then
  75. if [ $? != 0 ]; then
  76. fn_print_failure_nl "Unable to install Mono repository."
  77. fn_script_log_fatal "Unable to installMono repository."
  78. monoautoinstall=1
  79. else
  80. fn_print_complete_nl "Installing Mono repository completed."
  81. fn_script_log_pass "Installing Mono repository completed."
  82. monoautoinstall=0
  83. fi
  84. fi
  85. else
  86. fn_print_information_nl "Installing Mono repository"
  87. echo ""
  88. fn_print_warning_nl "$(whoami) does not have sudo access. Manually install Mono repository."
  89. fn_script_log_warn "$(whoami) does not have sudo access. Manually install Mono repository."
  90. echo " Follow instructions on mono site to install the latest version of Mono."
  91. echo " https://www.mono-project.com/download/stable/#download-lin"
  92. fi
  93. fi
  94. }
  95. fn_install_universe_repo(){
  96. # Defensive coding - As this is an ubuntu only issue then check to make sure this fix is needed, and we are using ubuntu
  97. if [ "${jquniversemissing}" != "0" ]&&[ "${distroid}" == "ubuntu" ]; then
  98. fn_print_warning_nl "Ubuntu 18.04.1 contains a bug which means the sources.list file does not populate with the Ubuntu universe repository."
  99. fn_print_information_nl "Attempting to add Universe Repo"
  100. sleep 0.5
  101. sudo -v > /dev/null 2>&1
  102. if [ $? -eq 0 ]; then
  103. echo -en ".\r"
  104. sleep 1
  105. echo -en "..\r"
  106. sleep 1
  107. echo -en "...\r"
  108. sleep 1
  109. echo -en " \r"
  110. cmd="sudo apt-add-repository universe"
  111. eval ${cmd}
  112. if [ $? -eq 0 ]; then
  113. fn_print_complete_nl "Installing universe repository completed."
  114. fn_script_log_pass "Installing universe repository completed."
  115. else
  116. fn_print_failure_nl "Unable to install universe repository."
  117. fn_script_log_fatal "Unable to install universe repository."
  118. fi
  119. else
  120. fn_print_warning_nl "$(whoami) does not have sudo access. Manually add Universe repository."
  121. fn_script_log_warn "$(whoami) does not have sudo access. Manually add Universe repository."
  122. echo " Please run the following command as a user with sudo access, and re-run the installation"
  123. echo " sudo apt-add-repository universe"
  124. fi
  125. fi
  126. }
  127. fn_deps_detector(){
  128. # Checks if dependency is missing
  129. if [ "${tmuxcheck}" == "1" ]; then
  130. # Added for users compiling tmux from source to bypass check.
  131. depstatus=0
  132. deptocheck="tmux"
  133. unset tmuxcheck
  134. elif [ "${javacheck}" == "1" ]; then
  135. # Added for users using Oracle JRE to bypass check.
  136. depstatus=0
  137. deptocheck="${javaversion}"
  138. unset javacheck
  139. elif [ "${deptocheck}" == "jq" ]&&[ "${distroversion}" == "6" ]; then
  140. jqstatus=1
  141. elif [ "${deptocheck}" == "jq" ]&&[ "${distroid}" == "ubuntu" ]&&[ "${distroversion}" == "18.04" ]&& ! grep -qE "^deb .*universe" /etc/apt/sources.list; then
  142. #1985 ubuntu 18.04.1 bug does not set sources.list correctly which means universe is not active by default
  143. #If the universe repo does not exist, mark as dependency missing and universe missing
  144. depstatus=1
  145. jquniversemissing=1
  146. elif [ "${deptocheck}" == "mono-complete" ]; then
  147. if [ "$(command -v mono 2>/dev/null)" ]&&[ "$(mono --version 2>&1 | grep -Po '(?<=version )\d')" -ge 5 ]; then
  148. # Mono >= 5.0.0 already installed
  149. depstatus=0
  150. else
  151. # Mono not installed or installed Mono < 5.0.0
  152. depstatus=1
  153. monostatus=1
  154. fi
  155. elif [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then
  156. dpkg-query -W -f='${Status}' "${deptocheck}" 2>/dev/null | grep -q -P '^install ok installed'
  157. depstatus=$?
  158. elif [ -n "$(command -v rpm 2>/dev/null)" ]; then
  159. rpm -q "${deptocheck}" > /dev/null 2>&1
  160. depstatus=$?
  161. fi
  162. if [ "${depstatus}" == "0" ]; then
  163. # if dependency is found
  164. missingdep=0
  165. if [ "${function_selfname}" == "command_install.sh" ]; then
  166. echo -e "${green}${deptocheck}${default}"
  167. sleep 0.2
  168. fi
  169. else
  170. # if dependency is not found
  171. missingdep=1
  172. if [ "${function_selfname}" == "command_install.sh" ]; then
  173. echo -e "${red}${deptocheck}${default}"
  174. sleep 0.2
  175. fi
  176. # Define required dependencies for SteamCMD
  177. if [ -n "${appid}" ]; then
  178. if [ "${deptocheck}" == "glibc.i686" ]||[ "${deptocheck}" == "libstdc++64.i686" ]||[ "${deptocheck}" == "lib32gcc1" ]||[ "${deptocheck}" == "libstdc++6:i386" ]; then
  179. steamcmdfail=1
  180. fi
  181. fi
  182. fi
  183. # Missing dependencies are added to array_deps_missing
  184. if [ "${missingdep}" == "1" ]; then
  185. array_deps_missing+=("${deptocheck}")
  186. fi
  187. }
  188. fn_deps_email(){
  189. # Adds postfix to required dependencies if email alert is enabled
  190. if [ "${emailalert}" == "on" ]; then
  191. if [ -f /usr/bin/mailx ]; then
  192. if [ -d /etc/exim4 ]; then
  193. array_deps_required+=( exim4 )
  194. elif [ -d /etc/sendmail ]; then
  195. array_deps_required+=( sendmail )
  196. elif [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then
  197. array_deps_required+=( mailutils postfix )
  198. elif [ -n "$(command -v rpm 2>/dev/null)" ]; then
  199. array_deps_required+=( mailx postfix )
  200. fi
  201. else
  202. if [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then
  203. array_deps_required+=( mailutils postfix )
  204. elif [ -n "$(command -v rpm 2>/dev/null)" ]; then
  205. array_deps_required+=( mailx postfix )
  206. fi
  207. fi
  208. fi
  209. }
  210. fn_found_missing_deps(){
  211. if [ "${#array_deps_missing[@]}" != "0" ]; then
  212. fn_print_warning_nl "Missing dependencies: ${red}${array_deps_missing[@]}${default}"
  213. fn_script_log_warn "Missing dependencies: ${array_deps_missing[@]}"
  214. sleep 0.5
  215. if [ -n "${monostatus}" ]; then
  216. fn_install_mono_repo
  217. fi
  218. if [ -n "${jqstatus}" ]; then
  219. fn_print_warning_nl "jq is not available in the ${distroname} repository"
  220. echo " * https://github.com/GameServerManagers/LinuxGSM/wiki/jq"
  221. fi
  222. sudo -v > /dev/null 2>&1
  223. if [ $? -eq 0 ]; then
  224. fn_print_information_nl "Automatically installing missing dependencies."
  225. fn_script_log_info "Automatically installing missing dependencies."
  226. echo -en ".\r"
  227. sleep 1
  228. echo -en "..\r"
  229. sleep 1
  230. echo -en "...\r"
  231. sleep 1
  232. echo -en " \r"
  233. if [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then
  234. cmd="sudo dpkg --add-architecture i386; sudo apt update; sudo apt -y install ${array_deps_missing[@]}"
  235. eval "${cmd}"
  236. elif [ -n "$(command -v dnf 2>/dev/null)" ]; then
  237. cmd="sudo dnf -y install ${array_deps_missing[@]}"
  238. eval "${cmd}"
  239. elif [ -n "$(command -v yum 2>/dev/null)" ]; then
  240. cmd="sudo yum -y install ${array_deps_missing[@]}"
  241. eval "${cmd}"
  242. fi
  243. if [ $? != 0 ]; then
  244. fn_print_failure_nl "Unable to install dependencies"
  245. fn_script_log_fatal "Unable to install dependencies"
  246. echo ""
  247. fn_print_warning_nl "Manually install dependencies."
  248. fn_script_log_warn "Manually install dependencies."
  249. if [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then
  250. echo " sudo dpkg --add-architecture i386; sudo apt update; sudo apt install ${array_deps_missing[@]}"
  251. elif [ -n "$(command -v dnf 2>/dev/null)" ]; then
  252. echo " sudo dnf install ${array_deps_missing[@]}"
  253. elif [ -n "$(command -v yum 2>/dev/null)" ]; then
  254. echo " sudo yum install ${array_deps_missing[@]}"
  255. fi
  256. if [ "${steamcmdfail}" ]; then
  257. echo ""
  258. fn_print_failure_nl "Missing dependencies required to run SteamCMD."
  259. fn_script_log_fatal "Missing dependencies required to run SteamCMD."
  260. core_exit.sh
  261. fi
  262. else
  263. fn_print_complete_nl "Install dependencies completed"
  264. fn_script_log_pass "Install dependencies completed"
  265. fi
  266. else
  267. echo ""
  268. fn_print_warning_nl "$(whoami) does not have sudo access. Manually install dependencies."
  269. fn_script_log_warn "$(whoami) does not have sudo access. Manually install dependencies."
  270. if [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then
  271. echo " sudo dpkg --add-architecture i386; sudo apt update; sudo apt install ${array_deps_missing[@]}"
  272. elif [ -n "$(command -v dnf 2>/dev/null)" ]; then
  273. echo " sudo dnf install ${array_deps_missing[@]}"
  274. elif [ -n "$(command -v yum 2>/dev/null)" ]; then
  275. echo " sudo yum install ${array_deps_missing[@]}"
  276. fi
  277. if [ "${steamcmdfail}" ]; then
  278. echo ""
  279. fn_print_failure_nl "Missing dependencies required to run SteamCMD."
  280. fn_script_log_fatal "Missing dependencies required to run SteamCMD."
  281. core_exit.sh
  282. fi
  283. echo ""
  284. fi
  285. if [ "${function_selfname}" == "command_install.sh" ]; then
  286. sleep 5
  287. fi
  288. else
  289. if [ "${function_selfname}" == "command_install.sh" ]; then
  290. fn_print_information_nl "Required dependencies already installed"
  291. fn_script_log_info "Required dependencies already installed"
  292. fi
  293. fi
  294. }
  295. fn_check_loop(){
  296. # Loop though required depenencies
  297. for deptocheck in "${array_deps_required[@]}"
  298. do
  299. fn_deps_detector
  300. done
  301. # user to be informed of any missing dependencies
  302. fn_found_missing_deps
  303. }
  304. # Generate require dependencies for debian based systems
  305. fn_deps_build_debian(){
  306. # Generate array of missing deps
  307. array_deps_missing=()
  308. ## LinuxGSM requirements
  309. array_deps_required=( curl wget ca-certificates file bsdmainutils util-linux python bzip2 gzip unzip binutils bc jq )
  310. # All servers except ts3 require tmux
  311. if [ "${shortname}" != "ts3" ]; then
  312. if [ "$(command -v tmux 2>/dev/null)" ]; then
  313. tmuxcheck=1 # Added for users compiling tmux from source to bypass check.
  314. else
  315. array_deps_required+=( tmux )
  316. fi
  317. fi
  318. # All servers except ts3, mumble, GTA and minecraft servers require libstdc++6 and lib32gcc1
  319. if [ "${shortname}" != "ts3" ]&&[ "${shortname}" != "mumble" ]&&[ "${shortname}" != "mc" ]&&[ "${engine}" != "renderware" ]; then
  320. if [ "${arch}" == "x86_64" ]; then
  321. array_deps_required+=( lib32gcc1 libstdc++6:i386 )
  322. else
  323. array_deps_required+=( libstdc++6:i386 )
  324. fi
  325. fi
  326. ## Game Specific requirements
  327. # Natural Selection 2 - x64 only
  328. if [ "${shortname}" == "ns2" ]; then
  329. array_deps_required+=( speex libtbb2 )
  330. # NS2: Combat
  331. elif [ "${shortname}" == "ns2c" ]; then
  332. array_deps_required+=( speex:i386 libtbb2 )
  333. # 7 Days to Die
  334. elif [ "${shortname}" == "sdtd" ]; then
  335. array_deps_required+=( telnet expect )
  336. # No More Room in Hell, Counter-Strike: Source and Garry's Mod
  337. elif [ "${shortname}" == "nmrih" ]||[ "${shortname}" == "css" ]||[ "${shortname}" == "gmod" ]||[ "${shortname}" == "zps" ]; then
  338. if [ "${arch}" == "x86_64" ]; then
  339. array_deps_required+=( lib32tinfo5 )
  340. else
  341. array_deps_required+=( libtinfo5 )
  342. fi
  343. # Brainbread 2 ,Don't Starve Together & Team Fortress 2
  344. elif [ "${shortname}" == "bb2" ]||[ "${shortname}" == "dst" ]||[ "${shortname}" == "tf2" ]; then
  345. array_deps_required+=( libcurl4-gnutls-dev:i386 )
  346. if [ "${shortname}" == "tf2" ]; then
  347. array_deps_required+=( libtcmalloc-minimal4:i386 )
  348. fi
  349. # Battlefield: 1942
  350. elif [ "${shortname}" == "bf1942" ]; then
  351. array_deps_required+=( libncurses5:i386 )
  352. # Call of Duty
  353. elif [ "${shortname}" == "cod" ]||[ "${shortname}" == "coduo" ]||[ "${shortname}" == "cod2" ]; then
  354. array_deps_required+=( libstdc++5:i386 )
  355. # Factorio
  356. elif [ "${shortname}" == "fctr" ]; then
  357. array_deps_required+=( xz-utils )
  358. # Hurtword/Rust
  359. elif [ "${shortname}" == "hw" ]||[ "${shortname}" == "rust" ]; then
  360. array_deps_required+=( lib32z1 )
  361. # Minecraft
  362. elif [ "${shortname}" == "mc" ]; then
  363. javaversion=$(java -version 2>&1 | grep "version")
  364. if [ "${javaversion}" ]; then
  365. javacheck=1 # Added for users using Oracle JRE to bypass the check.
  366. else
  367. array_deps_required+=( openjdk-8-jre-headless )
  368. fi
  369. # Project Zomboid
  370. elif [ "${shortname}" == "pz" ]; then
  371. if [ -n "$(java -version 2>&1 | grep "version")" ]; then
  372. javacheck=1 # Added for users using Oracle JRE to bypass the check.
  373. array_deps_required+=( rng-tools )
  374. else
  375. array_deps_required+=( default-jre rng-tools )
  376. fi
  377. # GoldenEye: Source
  378. elif [ "${shortname}" == "ges" ]; then
  379. array_deps_required+=( zlib1g:i386 libldap-2.4-2:i386 )
  380. # Serious Sam 3: BFE
  381. elif [ "${shortname}" == "ss3" ]; then
  382. array_deps_required+=( libxrandr2:i386 libglu1-mesa:i386 libxtst6:i386 libusb-1.0-0-dev:i386 libxxf86vm1:i386 libopenal1:i386 libssl1.0.0:i386 libgtk2.0-0:i386 libdbus-glib-1-2:i386 libnm-glib-dev:i386 )
  383. # Sven Co-op
  384. elif [ "${shortname}" == "sven" ]; then
  385. array_deps_required+=( libssl1.0.0:i386 )
  386. # Unreal Engine
  387. elif [ "${executable}" == "./ucc-bin" ]; then
  388. #UT2K4
  389. if [ -f "${executabledir}/ut2004-bin" ]; then
  390. array_deps_required+=( libsdl1.2debian libstdc++5:i386 )
  391. #UT99
  392. else
  393. array_deps_required+=( libsdl1.2debian )
  394. fi
  395. # Unreal Tournament
  396. elif [ "${shortname}" == "ut" ]; then
  397. array_deps_required+=( unzip )
  398. # Eco
  399. elif [ "${shortname}" == "eco" ]; then
  400. array_deps_required+=( mono-complete )
  401. # Wurm: Unlimited
  402. elif [ "${shortname}" == "wurm" ]; then
  403. array_deps_required+=( xvfb )
  404. fi
  405. fn_deps_email
  406. fn_check_loop
  407. }
  408. fn_deps_build_redhat(){
  409. # Generate array of missing deps
  410. array_deps_missing=()
  411. # LinuxGSM requirements
  412. ## CentOS 6
  413. if [ "${distroversion}" == "6" ]; then
  414. array_deps_required=( curl wget util-linux-ng python file gzip bzip2 unzip binutils bc jq )
  415. elif [ "${distroid}" == "fedora" ]; then
  416. array_deps_required=( curl wget util-linux python2 file gzip bzip2 unzip binutils bc jq )
  417. elif [[ "${distroname}" == *"Amazon Linux AMI"* ]]; then
  418. array_deps_required=( curl wget util-linux python27 file gzip bzip2 unzip binutils bc jq )
  419. else
  420. array_deps_required=( curl wget util-linux python file gzip bzip2 unzip binutils bc jq )
  421. fi
  422. # All servers except ts3 require tmux
  423. if [ "${shortname}" != "ts3" ]; then
  424. if [ "$(command -v tmux 2>/dev/null)" ]; then
  425. tmuxcheck=1 # Added for users compiling tmux from source to bypass check.
  426. else
  427. array_deps_required+=( tmux )
  428. fi
  429. fi
  430. # All servers except ts3,mumble,multitheftauto and minecraft servers require glibc.i686 and libstdc++.i686
  431. if [ "${shortname}" != "ts3" ]&&[ "${shortname}" != "mumble" ]&&[ "${shortname}" != "mc" ]&&[ "${engine}" != "renderware" ]; then
  432. if [[ "${distroname}" == *"Amazon Linux AMI"* ]]; then
  433. array_deps_required+=( glibc.i686 libstdc++64.i686 )
  434. else
  435. array_deps_required+=( glibc.i686 libstdc++.i686 )
  436. fi
  437. fi
  438. # Game Specific requirements
  439. # Natural Selection 2 (x64 only)
  440. if [ "${shortname}" == "ns2" ]; then
  441. array_deps_required+=( speex tbb )
  442. # NS2: Combat
  443. elif [ "${shortname}" == "ns2c" ]; then
  444. array_deps_required+=( speex.i686 tbb.i686 )
  445. # 7 Days to Die
  446. elif [ "${shortname}" == "sdtd" ]; then
  447. array_deps_required+=( telnet expect )
  448. # No More Room in Hell, Counter-Strike: Source, Garry's Mod and Zombie Panic: Source
  449. elif [ "${shortname}" == "nmrih" ]||[ "${shortname}" == "css" ]||[ "${shortname}" == "gmod" ]||[ "${shortname}" == "zps" ]; then
  450. array_deps_required+=( ncurses-libs.i686 )
  451. # Brainbread 2, Don't Starve Together & Team Fortress 2
  452. elif [ "${shortname}" == "bb2" ]||[ "${shortname}" == "dst" ]||[ "${shortname}" == "tf2" ]; then
  453. array_deps_required+=( libcurl.i686 )
  454. if [ "${gamename}" == "Team Fortress 2" ]; then
  455. array_deps_required+=( gperftools-libs.i686 )
  456. fi
  457. # Battlefield: 1942
  458. elif [ "${shortname}" == "bf1942" ]; then
  459. array_deps_required+=( ncurses-libs.i686 )
  460. # Call of Duty
  461. elif [ "${shortname}" == "cod" ]||[ "${shortname}" == "coduo" ]||[ "${shortname}" == "cod2" ]; then
  462. array_deps_required+=( compat-libstdc++-33.i686 )
  463. # Factorio
  464. elif [ "${shortname}" == "fctr" ]; then
  465. array_deps_required+=( xz )
  466. elif [ "${shortname}" == "hw" ]||[ "${shortname}" == "rust" ]; then
  467. array_deps_required+=( zlib-devel )
  468. # Minecraft
  469. elif [ "${shortname}" == "mc" ]; then
  470. javaversion=$(java -version 2>&1 | grep "version")
  471. if [ "${javaversion}" ]; then
  472. javacheck=1 # Added for users using Oracle JRE to bypass the check.
  473. array_deps_required+=( rng-tools )
  474. else
  475. array_deps_required+=( java-1.8.0-openjdk rng-tools )
  476. fi
  477. # Project Zomboid & Minecraft
  478. elif [ "${shortname}" == "pz" ]; then
  479. javaversion=$(java -version 2>&1 | grep "version")
  480. if [ "${javaversion}" ]; then
  481. javacheck=1 # Added for users using Oracle JRE to bypass the check.
  482. array_deps_required+=( rng-tools )
  483. else
  484. array_deps_required+=( java-1.8.0-openjdk rng-tools )
  485. fi
  486. # GoldenEye: Source
  487. elif [ "${shortname}" == "ges" ]; then
  488. array_deps_required+=( zlib.i686 openldap.i686 )
  489. # Unreal Engine
  490. elif [ "${executable}" == "./ucc-bin" ]; then
  491. #UT2K4
  492. if [ -f "${executabledir}/ut2004-bin" ]; then
  493. array_deps_required+=( compat-libstdc++-33.i686 SDL.i686 bzip2 )
  494. #UT99
  495. else
  496. array_deps_required+=( SDL.i686 bzip2 )
  497. fi
  498. # Unreal Tournament
  499. elif [ "${shortname}" == "ut" ]; then
  500. array_deps_required+=( unzip )
  501. # Eco
  502. elif [ "${shortname}" == "eco" ]; then
  503. array_deps_required+=( mono-complete )
  504. fi
  505. fn_deps_email
  506. fn_check_loop
  507. }
  508. if [ "${function_selfname}" == "command_install.sh" ]; then
  509. if [ "$(whoami)" == "root" ]; then
  510. echo ""
  511. echo "Checking Dependencies as root"
  512. echo "================================="
  513. fn_print_information_nl "Checking any missing dependencies for ${gamename} server only."
  514. fn_print_information_nl "This will NOT install a ${gamename} server."
  515. sleep 2
  516. else
  517. echo ""
  518. echo "Checking Dependencies"
  519. echo "================================="
  520. fi
  521. fi
  522. # Filter checking in to Debian or Red Hat Based
  523. info_distro.sh
  524. if [ -f "/etc/debian_version" ]; then
  525. fn_deps_build_debian
  526. elif [ -f "/etc/redhat-release" ]; then
  527. fn_deps_build_redhat
  528. else
  529. fn_print_warning_nl "${distroname} dependency checking unavailable"
  530. fi