lint-executable-resources.sh 594 B

123456789101112131415161718192021
  1. #!/usr/bin/env bash
  2. set -eo pipefail
  3. script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
  4. cd "$script_path/.."
  5. if [ "$(uname -s)" = "Darwin" ]; then
  6. # MacOS's find does not support '-executable' OR '-perm /mode'.
  7. BAD_FILES=$(find Base/res/ -type f -perm +111)
  8. else
  9. BAD_FILES=$(find Base/res/ -type f -executable)
  10. fi
  11. if [ -n "${BAD_FILES}" ]
  12. then
  13. echo "These files are marked as executable, but are in directories that do not commonly"
  14. echo "contain executables. Please double-check the permissions of these files:"
  15. echo "${BAD_FILES}" | xargs ls -ld
  16. exit 1
  17. fi