check_dirs.sh 515 B

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