check_deps.sh 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  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 modulename="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. 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 [ "${function_selfname}" == "command_install.sh" ]; 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 [ "${function_selfname}" == "command_install.sh" ]; then
  176. echo -e "${red}${deptocheck}${default}"
  177. fn_sleep_time
  178. fi
  179. # Define required dependencies for SteamCMD.
  180. if [ "${appid}" ]; then
  181. if [ "${deptocheck}" == "glibc.i686" ]||[ "${deptocheck}" == "libstdc++64.i686" ]||[ "${deptocheck}" == "lib32gcc1" ]||[ "${deptocheck}" == "lib32stdc++6" ]; then
  182. steamcmdfail=1
  183. fi
  184. fi
  185. fi
  186. # Missing dependencies are added to array_deps_missing.
  187. if [ "${missingdep}" == "1" ]; then
  188. array_deps_missing+=("${deptocheck}")
  189. fi
  190. }
  191. fn_deps_email(){
  192. # Adds postfix to required dependencies if email alert is enabled.
  193. if [ "${emailalert}" == "on" ]; then
  194. if [ -f /usr/bin/mailx ]; then
  195. if [ -d /etc/exim4 ]; then
  196. array_deps_required+=( exim4 )
  197. elif [ -d /etc/sendmail ]; then
  198. array_deps_required+=( sendmail )
  199. elif [ "$(command -v dpkg-query 2>/dev/null)" ]; then
  200. array_deps_required+=( mailutils postfix )
  201. elif [ "$(command -v rpm 2>/dev/null)" ]; then
  202. array_deps_required+=( mailx postfix )
  203. fi
  204. else
  205. if [ "$(command -v dpkg-query 2>/dev/null)" ]; then
  206. array_deps_required+=( mailutils postfix )
  207. elif [ "$(command -v rpm 2>/dev/null)" ]; then
  208. array_deps_required+=( mailx postfix )
  209. fi
  210. fi
  211. fi
  212. }
  213. fn_found_missing_deps(){
  214. if [ "${#array_deps_missing[@]}" != "0" ]; then
  215. fn_print_warning_nl "Missing dependencies: ${red}${array_deps_missing[@]}${default}"
  216. fn_script_log_warn "Missing dependencies: ${array_deps_missing[@]}"
  217. fn_sleep_time
  218. if [ "${monostatus}" ]; then
  219. fn_install_mono_repo
  220. fi
  221. if [ "${jqstatus}" ]; then
  222. fn_print_warning_nl "jq is not available in the ${distroname} repository."
  223. echo -e " * https://docs.linuxgsm.com/requirements/jq"
  224. fi
  225. if [ "${autoinstall}" == "1" ]; then
  226. sudo -n true > /dev/null 2>&1
  227. else
  228. sudo -v > /dev/null 2>&1
  229. fi
  230. if [ $? -eq 0 ]; then
  231. fn_print_information_nl "Automatically installing missing dependencies."
  232. fn_script_log_info "Automatically installing missing dependencies."
  233. echo -en ".\r"
  234. sleep 1
  235. echo -en "..\r"
  236. sleep 1
  237. echo -en "...\r"
  238. sleep 1
  239. echo -en " \r"
  240. if [ "$(command -v dpkg-query 2>/dev/null)" ]; then
  241. 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 update; sudo apt -y install ${array_deps_missing[@]}"
  242. eval "${cmd}"
  243. elif [ "$(command -v dnf 2>/dev/null)" ]; then
  244. cmd="sudo dnf -y install ${array_deps_missing[@]}"
  245. eval "${cmd}"
  246. elif [ "$(command -v yum 2>/dev/null)" ]; then
  247. cmd="sudo yum -y install ${array_deps_missing[@]}"
  248. eval "${cmd}"
  249. fi
  250. if [ $? != 0 ]; then
  251. fn_print_failure_nl "Unable to install dependencies."
  252. fn_script_log_fatal "Unable to install dependencies."
  253. echo -e ""
  254. fn_print_warning_nl "Manually install dependencies."
  255. fn_script_log_warn "Manually install dependencies."
  256. if [ "$(command -v dpkg-query 2>/dev/null)" ]; then
  257. echo -e " sudo dpkg --add-architecture i386; sudo apt update; sudo apt install ${array_deps_missing[@]}"
  258. elif [ "$(command -v dnf 2>/dev/null)" ]; then
  259. echo -e " sudo dnf install ${array_deps_missing[@]}"
  260. elif [ "$(command -v yum 2>/dev/null)" ]; then
  261. echo -e " sudo yum install ${array_deps_missing[@]}"
  262. fi
  263. if [ "${steamcmdfail}" ]; then
  264. echo -e ""
  265. fn_print_failure_nl "Missing dependencies required to run SteamCMD."
  266. fn_script_log_fatal "Missing dependencies required to run SteamCMD."
  267. core_exit.sh
  268. fi
  269. else
  270. fn_print_complete_nl "Install dependencies completed."
  271. fn_script_log_pass "Install dependencies completed."
  272. fi
  273. else
  274. fn_print_warning_nl "$(whoami) does not have sudo access. Manually install dependencies."
  275. fn_script_log_warn "$(whoami) does not have sudo access. Manually install dependencies."
  276. echo -e ""
  277. if [ "$(command -v dpkg-query 2>/dev/null)" ]; then
  278. echo -e "sudo dpkg --add-architecture i386; sudo apt update; sudo apt install ${array_deps_missing[@]}"
  279. elif [ "$(command -v dnf 2>/dev/null)" ]; then
  280. echo -e "sudo dnf install ${array_deps_missing[@]}"
  281. elif [ "$(command -v yum 2>/dev/null)" ]; then
  282. echo -e "sudo yum install ${array_deps_missing[@]}"
  283. fi
  284. if [ "${steamcmdfail}" ]; then
  285. echo -e ""
  286. fn_print_failure_nl "Missing dependencies required to run SteamCMD."
  287. fn_script_log_fatal "Missing dependencies required to run SteamCMD."
  288. core_exit.sh
  289. fi
  290. echo -e ""
  291. fi
  292. if [ "${function_selfname}" == "command_install.sh" ]; then
  293. sleep 5
  294. fi
  295. else
  296. if [ "${function_selfname}" == "command_install.sh" ]; then
  297. fn_print_information_nl "Required dependencies already installed."
  298. fn_script_log_info "Required dependencies already installed."
  299. fi
  300. fi
  301. }
  302. fn_check_loop(){
  303. # Loop though required depenencies.
  304. for deptocheck in "${array_deps_required[@]}"
  305. do
  306. fn_deps_detector
  307. done
  308. # user to be informed of any missing dependencies.
  309. fn_found_missing_deps
  310. }
  311. # Generate require dependencies for debian based systems.
  312. fn_deps_build_debian(){
  313. # Generate array of missing deps.
  314. array_deps_missing=()
  315. # LinuxGSM requirements.
  316. array_deps_required=( curl wget ca-certificates file bsdmainutils util-linux python3 tar bzip2 gzip unzip binutils bc jq tmux )
  317. # All servers except ts3, mumble, GTA and minecraft servers require libstdc++6 and lib32gcc1.
  318. if [ "${shortname}" != "ts3" ]&&[ "${shortname}" != "mumble" ]&&[ "${shortname}" != "mc" ]&&[ "${engine}" != "renderware" ]; then
  319. if [ "${arch}" == "x86_64" ]; then
  320. array_deps_required+=( lib32gcc1 lib32stdc++6 )
  321. else
  322. array_deps_required+=( lib32stdc++6 )
  323. fi
  324. fi
  325. # If requires steamcmd.
  326. if [ "${appid}" ]; then
  327. # Will not use apt if non-free repo is missing
  328. if [ "${distroid}" == "debian" ]&& ! grep -qE "^deb .*non-free" /etc/apt/sources.list; then
  329. :
  330. else
  331. array_deps_required+=( steamcmd )
  332. fi
  333. fi
  334. # Game Specific requirements.
  335. # Natural Selection 2 (x64 only)
  336. if [ "${shortname}" == "ns2" ]; then
  337. array_deps_required+=( speex libtbb2 )
  338. # NS2: Combat
  339. elif [ "${shortname}" == "ns2c" ]; then
  340. array_deps_required+=( speex:i386 libtbb2 )
  341. # 7 Days to Die
  342. elif [ "${shortname}" == "sdtd" ]; then
  343. array_deps_required+=( telnet expect )
  344. # No More Room in Hell, Counter-Strike: Source, Garry's Mod and Zombie Panic: Source
  345. elif [ "${shortname}" == "nmrih" ]||[ "${shortname}" == "css" ]||[ "${shortname}" == "gmod" ]||[ "${shortname}" == "zps" ]; then
  346. if [ "${arch}" == "x86_64" ]; then
  347. array_deps_required+=( libtinfo5:i386 )
  348. else
  349. array_deps_required+=( libtinfo5 )
  350. fi
  351. # Brainbread 2, Don't Starve Together & Team Fortress 2
  352. elif [ "${shortname}" == "bb2" ]||[ "${shortname}" == "dst" ]||[ "${shortname}" == "tf2" ]; then
  353. array_deps_required+=( libcurl4-gnutls-dev:i386 )
  354. if [ "${shortname}" == "tf2" ]; then
  355. array_deps_required+=( libtcmalloc-minimal4:i386 )
  356. fi
  357. # Battlefield: 1942
  358. elif [ "${shortname}" == "bf1942" ]; then
  359. array_deps_required+=( libncurses5:i386 )
  360. # Call of Duty & Medal of Honor: Allied Assault
  361. elif [ "${shortname}" == "cod" ]||[ "${shortname}" == "coduo" ]||[ "${shortname}" == "cod2" ]||[ "${shortname}" == "mohaa" ]; then
  362. array_deps_required+=( libstdc++5:i386 )
  363. # Factorio
  364. elif [ "${shortname}" == "fctr" ]; then
  365. array_deps_required+=( xz-utils )
  366. # Hurtword/Rust
  367. elif [ "${shortname}" == "hw" ]||[ "${shortname}" == "rust" ]; then
  368. array_deps_required+=( lib32z1 )
  369. # Minecraft, Rising World, Wurm
  370. elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "rw" ]||[ "${shortname}" == "wurm" ]; then
  371. javaversion=$(java -version 2>&1 | grep "version")
  372. if [ "${javaversion}" ]; then
  373. # Added for users using Oracle JRE to bypass the check.
  374. javacheck=1
  375. else
  376. array_deps_required+=( default-jre )
  377. fi
  378. # Onset
  379. elif [ "${shortname}" == "onset" ]; then
  380. array_deps_required+=( libmariadbclient-dev )
  381. # Project Zomboid
  382. elif [ "${shortname}" == "pz" ]; then
  383. if java -version 2>&1 | grep "version"; then
  384. # Added for users using Oracle JRE to bypass the check.
  385. javacheck=1
  386. array_deps_required+=( rng-tools )
  387. else
  388. array_deps_required+=( default-jre rng-tools )
  389. fi
  390. # GoldenEye: Source
  391. elif [ "${shortname}" == "ges" ]; then
  392. array_deps_required+=( zlib1g:i386 libldap-2.4-2:i386 )
  393. # Serious Sam 3: BFE
  394. elif [ "${shortname}" == "ss3" ]; then
  395. 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 )
  396. # Sven Co-op
  397. elif [ "${shortname}" == "sven" ]; then
  398. array_deps_required+=( libssl1.1:i386 zlib1g:i386 )
  399. # Unreal Engine
  400. elif [ "${executable}" == "./ucc-bin" ]; then
  401. # UT2K4
  402. if [ -f "${executabledir}/ut2004-bin" ]; then
  403. array_deps_required+=( libsdl1.2debian libstdc++5:i386 )
  404. # UT99
  405. else
  406. array_deps_required+=( libsdl1.2debian )
  407. fi
  408. # Unreal Tournament
  409. elif [ "${shortname}" == "ut" ]; then
  410. array_deps_required+=( unzip )
  411. # Unturned
  412. elif [ "${shortname}" == "unt" ]; then
  413. array_deps_required+=( mono-complete )
  414. # Wurm: Unlimited
  415. elif [ "${shortname}" == "wurm" ]; then
  416. array_deps_required+=( xvfb )
  417. elif [ "${shortname}" == "pstbs" ]; then
  418. array_deps_required+=( libgconf-2-4 )
  419. fi
  420. fn_deps_email
  421. fn_check_loop
  422. }
  423. fn_deps_build_redhat(){
  424. # Generate array of missing deps.
  425. array_deps_missing=()
  426. # LinuxGSM requirements.
  427. # CentOS
  428. if [ "${distroversion}" == "7" ]; then
  429. array_deps_required=( epel-release curl wget util-linux python3 file tar gzip bzip2 unzip binutils bc jq tmux )
  430. elif [ "${distroversion}" == "8" ]; then
  431. array_deps_required=( epel-release curl wget util-linux python36 file tar gzip bzip2 unzip binutils bc jq tmux )
  432. elif [ "${distroid}" == "fedora" ]; then
  433. array_deps_required=( curl wget util-linux python3 file tar gzip bzip2 unzip binutils bc jq tmux )
  434. elif [[ "${distroname}" == *"Amazon Linux AMI"* ]]; then
  435. array_deps_required=( curl wget util-linux python3 file tar gzip bzip2 unzip binutils bc jq tmux )
  436. else
  437. array_deps_required=( curl wget util-linux python3 file tar gzip bzip2 unzip binutils bc jq tmux )
  438. fi
  439. # All servers except ts3, mumble, multi theft auto and minecraft servers require glibc.i686 and libstdc++.i686.
  440. if [ "${shortname}" != "ts3" ]&&[ "${shortname}" != "mumble" ]&&[ "${shortname}" != "mc" ]&&[ "${engine}" != "renderware" ]; then
  441. if [[ "${distroname}" == *"Amazon Linux AMI"* ]]; then
  442. array_deps_required+=( glibc.i686 libstdc++64.i686 )
  443. else
  444. array_deps_required+=( glibc.i686 libstdc++.i686 )
  445. fi
  446. fi
  447. # Game Specific requirements.
  448. # Natural Selection 2 (x64 only)
  449. if [ "${shortname}" == "ns2" ]; then
  450. array_deps_required+=( speex tbb )
  451. # NS2: Combat
  452. elif [ "${shortname}" == "ns2c" ]; then
  453. array_deps_required+=( speex.i686 tbb.i686 )
  454. # 7 Days to Die
  455. elif [ "${shortname}" == "sdtd" ]; then
  456. array_deps_required+=( telnet expect )
  457. # No More Room in Hell, Counter-Strike: Source, Garry's Mod and Zombie Panic: Source
  458. elif [ "${shortname}" == "nmrih" ]||[ "${shortname}" == "css" ]||[ "${shortname}" == "gmod" ]||[ "${shortname}" == "zps" ]; then
  459. array_deps_required+=( ncurses-libs.i686 )
  460. # Brainbread 2, Don't Starve Together & Team Fortress 2
  461. elif [ "${shortname}" == "bb2" ]||[ "${shortname}" == "dst" ]||[ "${shortname}" == "tf2" ]; then
  462. array_deps_required+=( libcurl.i686 )
  463. if [ "${shortname}" == "tf2" ]; then
  464. array_deps_required+=( gperftools-libs.i686 )
  465. fi
  466. # Battlefield: 1942
  467. elif [ "${shortname}" == "bf1942" ]; then
  468. array_deps_required+=( ncurses-libs.i686 )
  469. # Call of Duty & Medal of Honor: Allied Assault
  470. elif [ "${shortname}" == "cod" ]||[ "${shortname}" == "coduo" ]||[ "${shortname}" == "cod2" ]||[ "${shortname}" == "mohaa" ]; then
  471. array_deps_required+=( compat-libstdc++-33.i686 )
  472. # Factorio
  473. elif [ "${shortname}" == "fctr" ]; then
  474. array_deps_required+=( xz )
  475. # Hurtword/Rust
  476. elif [ "${shortname}" == "hw" ]||[ "${shortname}" == "rust" ]; then
  477. array_deps_required+=( zlib-devel )
  478. # Minecraft, Rising World, Wurm
  479. elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "rw" ]||[ "${shortname}" == "wurm" ]; then
  480. javaversion=$(java -version 2>&1 | grep "version")
  481. if [ "${javaversion}" ]; then
  482. # Added for users using Oracle JRE to bypass the check.
  483. javacheck=1
  484. else
  485. array_deps_required+=( java-11-openjdk )
  486. fi
  487. # Onset
  488. elif [ "${shortname}" == "onset" ]; then
  489. array_deps_required+=( mariadb-connector-c )
  490. # Project Zomboid
  491. elif [ "${shortname}" == "pz" ]; then
  492. if java -version 2>&1 | grep "version"; then
  493. # Added for users using Oracle JRE to bypass the check.
  494. javacheck=1
  495. array_deps_required+=( rng-tools )
  496. else
  497. array_deps_required+=( java-11-openjdk rng-tools )
  498. fi
  499. # GoldenEye: Source
  500. elif [ "${shortname}" == "ges" ]; then
  501. array_deps_required+=( zlib.i686 openldap.i686 )
  502. # Serious Sam 3: BFE
  503. elif [ "${shortname}" == "ss3" ]; then
  504. : # not compatible
  505. elif [ "${shortname}" == "sven" ]; then
  506. : # not compatible
  507. # Unreal Engine
  508. elif [ "${executable}" == "./ucc-bin" ]; then
  509. # UT2K4
  510. if [ -f "${executabledir}/ut2004-bin" ]; then
  511. array_deps_required+=( compat-libstdc++-33.i686 SDL.i686 bzip2 )
  512. # UT99
  513. else
  514. array_deps_required+=( SDL.i686 bzip2 )
  515. fi
  516. # Unreal Tournament
  517. elif [ "${shortname}" == "ut" ]; then
  518. array_deps_required+=( unzip )
  519. # Unturned
  520. elif [ "${shortname}" == "unt" ]; then
  521. array_deps_required+=( mono-complete )
  522. # Wurm: Unlimited
  523. elif [ "${shortname}" == "wurm" ]; then
  524. array_deps_required+=( xorg-x11-server-Xvfb )
  525. elif [ "${shortname}" == "pstbs" ]; then
  526. array_deps_required+=( GConf2 )
  527. fi
  528. fn_deps_email
  529. fn_check_loop
  530. }
  531. if [ "${function_selfname}" == "command_install.sh" ]; then
  532. if [ "$(whoami)" == "root" ]; then
  533. echo -e ""
  534. echo -e "${lightyellow}Checking Dependencies as root${default}"
  535. echo -e "================================="
  536. fn_print_information_nl "Checking any missing dependencies for ${gamename} server only."
  537. fn_print_information_nl "This will NOT install a ${gamename} server."
  538. fn_sleep_time
  539. else
  540. echo -e ""
  541. echo -e "${lightyellow}Checking Dependencies${default}"
  542. echo -e "================================="
  543. fi
  544. fi
  545. # Filter checking in to Debian or Red Hat Based.
  546. info_distro.sh
  547. if [ -f "/etc/debian_version" ]; then
  548. fn_deps_build_debian
  549. elif [ -f "/etc/redhat-release" ]; then
  550. fn_deps_build_redhat
  551. else
  552. fn_print_warning_nl "${distroname} dependency checking unavailable."
  553. fi