find_surplus_binaries.sh 748 B

123456789101112131415161718192021222324
  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' \))
  9. count_total=0
  10. count_bad=0
  11. while read -r filename; do
  12. filename=${filename##./}
  13. if [[ ! "$per_line_data" == *"$filename"* ]]; then
  14. echo "Culprit: $filename"
  15. count_bad=$((count_bad + 1))
  16. fi
  17. count_total=$((count_total + 1))
  18. done <<< "$pefiles"
  19. echo "Done. Checked ${count_total} files. ${count_bad} bad file(s)."