check_dirs.sh 434 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash
  2. GIT_URL=$1
  3. set -e
  4. declare -A top_dirs=(
  5. [ydb/]=1,
  6. [util/]=1,
  7. [build/]=1,
  8. [contrib/]=1,
  9. [certs/]=1,
  10. [cmake/]=1,
  11. [.git/]=1,
  12. [.github/]=1,
  13. [library/]=1,
  14. [tools/]=1,
  15. )
  16. cd $GIT_URL
  17. shopt -s dotglob
  18. shopt -s nullglob
  19. array=(*/)
  20. for dir in "${array[@]}"
  21. do
  22. if [[ ! ${top_dirs[$dir]} ]]
  23. then
  24. echo "$dir is not allowed root level directory."
  25. exit 1
  26. fi
  27. done