clone-repos 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/bash
  2. # cd into the directory containing this script (from the bash faq 028)
  3. if [[ $BASH_SOURCE = */* ]]; then
  4. cd -- "${BASH_SOURCE%/*}/" || exit
  5. fi
  6. cd ..
  7. fetch_repo() {
  8. repo_url="$1"
  9. commit_id="$2"
  10. dir_name="$3"
  11. if [ -d "$dir_name" ]; then
  12. ( cd "$dir_name" && git fetch origin --tags && \
  13. git checkout "$commit_id" )
  14. else
  15. git clone "$repo_url" "$dir_name" && \
  16. ( cd "$dir_name" && git checkout "$commit_id" && \
  17. if [ -e "../patches/${dir_name}.diff" ]; then
  18. patch -p1 < ../patches/${dir_name}.diff || exit 1
  19. fi )
  20. fi
  21. }
  22. fetch_repos() {
  23. fetch_repo https://github.com/arkworks-rs/spongefish v0.5.1 spongefish && \
  24. fetch_repo https://github.com/mmaker/sigma-rs v0.3.0 sigma-proofs && \
  25. fetch_repo https://git-crysp.uwaterloo.ca/SigmaProtocol/sigma-compiler 0.2.2 sigma-compiler && \
  26. fetch_repo https://git-crysp.uwaterloo.ca/SigmaProtocol/cmz 0.2.1 cmz && \
  27. fetch_repo https://gitlab.torproject.org/onyinyang/lox.git/ lox-artifact application-lox && \
  28. fetch_repo https://gitlab.torproject.org/onyinyang/lox.git/ lox-artifact-zkp application-lox-zkp && \
  29. fetch_repo https://github.com/ooni/userauth artifact-v0.2 application-ooni
  30. }
  31. fetch_repos