Small sh "framework" to test some server responses
sh
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

12345678910111213141516171819202122232425262728293031323334
  1. #Copyright (C) 2016,2023 Weber Yann
  2. #
  3. #This program is free software; you can redistribute it and/or modify
  4. #it under the terms of the GNU General Public License as published by
  5. #the Free Software Foundation; either version 3 of the License, or
  6. #any later version.
  7. #
  8. #This program is distributed in the hope that it will be useful,
  9. #but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. #GNU General Public License for more details.
  12. #
  13. #You should have received a copy of the GNU General Public License
  14. #along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. check_git_repo() {
  16. ipv_arg=$2
  17. case "$ipv_arg" in
  18. ipv4)ipv=-4;;
  19. ipv6)ipv=-6;;
  20. default)ipv="";
  21. esac
  22. tmpdir=$(mktemp -d -t check_git.XXXXXXXXX)
  23. git clone $ipv "$1" "$tmpdir" 2>/dev/null 1>/dev/null
  24. res="$?"
  25. rm -Rf "$tmpdir"
  26. if [ "$res" -ne 0 ]
  27. then
  28. fail "unable to clone git repo '$1' $ipv_arg"
  29. else
  30. success "git repo '$1' $ipv_arg cloned'"
  31. fi
  32. }