4
0

fix_vh.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. # LinuxGSM fix_vh.sh module
  3. # Author: Alasdair Haig
  4. # Website: https://linuxgsm.com
  5. # Description: Resolves issues with Valheim.
  6. moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
  7. export LD_LIBRARY_PATH=./linux64:$LD_LIBRARY_PATH
  8. modsdir="${lgsmdir}/mods"
  9. modsinstalledlistfullpath="${modsdir}/installed-mods.txt"
  10. if [ -f "${modsinstalledlistfullpath}" ]; then
  11. # special check if Valheim Plus is installed
  12. if grep -qE "^valheimplus" "${modsinstalledlistfullpath}"; then
  13. if ! grep -qE "^executable=\"./start_server_bepinex.sh\"" "${configdirserver}/${selfname}.cfg"; then
  14. echo 'executable="./start_server_bepinex.sh"' >> "${configdirserver}/${selfname}.cfg"
  15. executable="./start_server_bepinex.sh"
  16. fi
  17. if [ -d "${serverfiles}/unstripped_corlib" ]; then
  18. rm -rf "${serverfiles}/unstripped_corlib"
  19. fi
  20. sed -i "s/^dllSearchPathOverride=unstripped_corlib/# &/" "${serverfiles}/doorstop_config.ini"
  21. sed -i "s|^export DOORSTOP_CORLIB_OVERRIDE_PATH=\"\\\$BASEDIR/unstripped_corlib\"|# &|" "${serverfiles}/start_game_bepinex.sh"
  22. sed -i "s|^export DOORSTOP_CORLIB_OVERRIDE_PATH=\"\\\${VALHEIM_PLUS_PATH}/unstripped_corlib\"|# &|" "${serverfiles}/start_server_bepinex.sh"
  23. fi
  24. # special exports for BepInEx if installed
  25. if grep -qE "^bepinexvh" "${modsinstalledlistfullpath}"; then
  26. fn_print_info_nl "BepInEx install detected, applying start exports"
  27. fn_script_log_info "BepInEx install detected, applying start exports"
  28. # exports for BepInEx framework from script start_server_bepinex.sh
  29. export DOORSTOP_ENABLE=TRUE
  30. export DOORSTOP_INVOKE_DLL_PATH=./BepInEx/core/BepInEx.Preloader.dll
  31. export DOORSTOP_CORLIB_OVERRIDE_PATH=./unstripped_corlib
  32. export LD_LIBRARY_PATH="./doorstop_libs:${LD_LIBRARY_PATH}"
  33. export LD_PRELOAD="libdoorstop_x64.so:${LD_PRELOAD}"
  34. export SteamAppId=892970
  35. fi
  36. fi