4
0

fix_nd.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. # LinuxGSM fix_nd.sh module
  3. # Author: Daniel Gibbs
  4. # Contributors: https://linuxgsm.com/contrib
  5. # Website: https://linuxgsm.com
  6. # Description: Resolves issues with Nuclear Dawn.
  7. moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
  8. if [ ! -f "${serverfiles}/nucleardawn/gameinfo.txt" ]; then
  9. fixname="game content"
  10. fn_fix_msg_start_nl
  11. steamcmdlog="${lgsmlogdir}/${selfname}-steamcmd.log"
  12. rm -f "${steamcmdlog:?}"
  13. if [ -d "${steamcmddir}" ]; then
  14. cd "${steamcmddir}" || exit
  15. fi
  16. "${steamcmdcommand}" +login "${steamuser}" "${steampass}" +app_info_print 17710 +quit > /dev/null 2>&1
  17. "${steamcmdcommand}" +login "${steamuser}" "${steampass}" +download_depot 17710 17711 +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
  18. ndcontentdepot="$(grep -o 'Depot download complete : "[^"]*"' "${steamcmdlog}" | tail -1 | cut -d'"' -f2 | tr '\134' '/')"
  19. if [[ "${ndcontentdepot}" == */depot_17711 ]]; then
  20. if [ -f "${ndcontentdepot}/nucleardawn/gameinfo.txt" ]; then
  21. tar -C "${ndcontentdepot}" -cf - . | tar -C "${serverfiles}" -xf - --skip-old-files
  22. fi
  23. rm -rf "${ndcontentdepot:?}" "${ndcontentdepot%/*}/state_17710_17711.patch"
  24. fi
  25. if [ -f "${serverfiles}/nucleardawn/gameinfo.txt" ]; then
  26. exitcode=0
  27. else
  28. exitcode=1
  29. fi
  30. fn_fix_msg_end
  31. if [ "${exitcode}" -ne 0 ]; then
  32. fn_print_nl "* Nuclear Dawn game content requires a Steam account that owns Nuclear Dawn."
  33. fn_print_nl "* Set steamuser and steampass in ${configdirserver}"
  34. core_exit.sh
  35. fi
  36. fi