check_dirs.sh 452 B

12345678910111213141516171819202122232425262728293031323334
  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. [scripts/]=1,
  16. )
  17. cd $GIT_URL
  18. shopt -s dotglob
  19. shopt -s nullglob
  20. array=(*/)
  21. for dir in "${array[@]}"
  22. do
  23. if [[ ! ${top_dirs[$dir]} ]]
  24. then
  25. echo "$dir is not allowed root level directory."
  26. exit 1
  27. fi
  28. done