install_mta_resources.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/bash
  2. # LGSM install_mta_resources.sh function
  3. # Author: Daniel Gibbs
  4. # Contributor: ChaosMTA
  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. fn_print_warn_nl "libmysqlclient16 not installed. Installing.."
  17. sleep 1
  18. sudo -v > /dev/null 2>&1
  19. if [ $? -eq 0 ]; then
  20. fileurl="https://nightly.mtasa.com/files/modules/64/libmysqlclient.so.16"; filedir="${tmpdir}"; filename="libmysqlclient.so.16"; executecmd="executecmd" run="norun"; force="noforce"; md5="6c188e0f8fb5d7a29f4bc413b9fed6c2"
  21. fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
  22. sudo mv ${tmpdir}/${filename} /usr/lib/${filename}
  23. else
  24. fn_print_fail_nl "Failed to install libmysqlclient16, $(whoami) does not have sudo access. Download it manually and place it in /usr/lib"
  25. sleep 1
  26. fi
  27. else
  28. echo "libmysqlclient16 already installed."
  29. fi
  30. }
  31. fn_install_libmysqlclient16
  32. fn_print_information_nl "Server is inoperable by default without resources, you can install default ones by running the command install-default-resources"
  33. echo ""