check_dirs.sh 465 B

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