check_dirs.sh 501 B

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