install_mta_resources.sh 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/bash
  2. # LGSM install_mta_resources.sh function
  3. # Author: Daniel Gibbs
  4. # Contributor: PhilPhonic
  5. # Website: https://gameservermanagers.com
  6. # Description: Installs the libmysqlclient for database functions on the server and optionally installs default resources required to run the server
  7. local commandname="INSTALL"
  8. local commandaction="Install"
  9. local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
  10. fn_install_libmysqlclient16(){
  11. echo ""
  12. echo "Checking if libmysqlclient16 is installed"
  13. echo "================================="
  14. sleep 1
  15. if [ ! -f /usr/lib/libmysqlclient.so.16 ]; then
  16. echo "libmysqlclient16 not installed. Installing.."
  17. fileurl="https://nightly.mtasa.com/files/modules/64/libmysqlclient.so.16"; filedir="/usr/lib/"; filename="libmysqlclient.so.16"; executecmd="noexecute" run="norun"; force="noforce"; md5="6c188e0f8fb5d7a29f4bc413b9fed6c2"
  18. fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
  19. fi
  20. echo "libmysqlclient16 installed."
  21. }
  22. fn_install_resources(){
  23. echo ""
  24. echo "Installing Default Resources"
  25. echo "================================="
  26. fileurl="http://mirror.mtasa.com/mtasa/resources/mtasa-resources-latest.zip"; filedir="${tmpdir}"; filename="multitheftauto_resources.zip"; executecmd="noexecute" run="norun"; force="noforce"; md5="97a587509698f7f010bcd6e5c6dd9c31"
  27. fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
  28. fn_dl_extract "${filedir}" "${filename}" "${resourcesdir}"
  29. echo "Default Resources Installed."
  30. }
  31. fn_install_libmysqlclient16
  32. if [ -z "${autoinstall}" ]; then
  33. echo ""
  34. while true; do
  35. read -e -i "n" -p "Do you want to have the default resources downloaded? (Server is inoperable without resources!) [y/N]" yn
  36. case $yn in
  37. [Yy]* ) fn_install_resources && break;;
  38. [Nn]* ) break;;
  39. * ) echo "Please answer yes or no.";;
  40. esac
  41. done
  42. else
  43. fn_print_warning_nl "./${selfname} auto-install does not download the default resources. If you require them use ./${selfname} install"
  44. fi