find_surplus_binaries.sh 943 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env bash
  2. # Read-only utility script to check for leftover binary files from past installations.
  3. # This might be helpful to narrow down possible causes of the error 31-4302.
  4. #
  5. # Usage: ./find_surplus_finaries.sh
  6. # Execute the script within the game installation directory.
  7. per_line_data=$(jq -r "[.remoteName] | join(\"\")" "pkg_version")
  8. pefiles=$(find . \( -iname '*.exe' -o -iname '*.sys' -o -iname '*.dll' -o -iname "*.blk" -o -iname "*.usm" \))
  9. echo "List of files not contained in pkg_version"
  10. echo "Note: Matches in */Persistent/* might be false-positives"
  11. echo "-------------------"
  12. count_total=0
  13. count_bad=0
  14. while read -r filename; do
  15. filename=${filename##./}
  16. if [[ ! "$per_line_data" == *"$filename"* ]]; then
  17. echo "$filename"
  18. count_bad=$((count_bad + 1))
  19. fi
  20. count_total=$((count_total + 1))
  21. done <<< "$pefiles"
  22. echo "-------------------"
  23. echo "Done. Checked ${count_total} files. ${count_bad} bad file(s)."