check_deps.sh 25 KB

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