check_deps.sh 22 KB

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