check_deps.sh 24 KB

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