check_deps.sh 23 KB

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