fix_ts3.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/bash
  2. # LinuxGSM fix_ts3.sh module
  3. # Author: Daniel Gibbs
  4. # Contributors: http://linuxgsm.com/contrib
  5. # Website: https://linuxgsm.com
  6. # Description: Resolves issues with Teamspeak 3.
  7. moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
  8. # Creates a blank ts3server.ini if it does not exist.
  9. if [ ! -f "${servercfgfullpath}" ]; then
  10. fixname="create blank ${servercfg}"
  11. fn_fix_msg_start
  12. touch "${servercfgfullpath}"
  13. fn_fix_msg_end
  14. fi
  15. # Accept license.
  16. if [ ! -f "${executabledir}/.ts3server_license_accepted" ]; then
  17. install_eula.sh
  18. fi
  19. # Fixes: makes libmariadb2 available #1924.
  20. if [ ! -f "${serverfiles}/libmariadb.so.2" ]; then
  21. fixname="libmariadb.so.2"
  22. fn_fix_msg_start
  23. cp "${serverfiles}/redist/libmariadb.so.2" "${serverfiles}/libmariadb.so.2"
  24. fn_fix_msg_end
  25. fi
  26. # Fixes: failed to register local accounting service: No such file or directory.
  27. accountingfile="/dev/shm/7gbhujb54g8z9hu43jre8"
  28. if [ -f "${accountingfile}" ] && [ "${status}" == "0" ]; then
  29. # Check permissions for the file if the current user owns it, if not exit.
  30. if [ "$(stat -c %U ${accountingfile})" == "$(whoami)" ]; then
  31. fixname="Delete file ${accountingfile}"
  32. fn_fix_msg_start
  33. rm -f "${accountingfile}"
  34. fn_fix_msg_end
  35. # file is not owned by the current user and needs to be deleted manually.
  36. else
  37. fn_print_error_nl "File ${accountingfile} is not owned by $(whoami) and needs to be deleted manually"
  38. fn_script_log_fatal "File ${accountingfile} is not owned by $(whoami) and needs to be deleted manually"
  39. core_exit.sh
  40. fi
  41. fi