clone-repos 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. update_crate="$4"
  12. if [ -d "$dir_name" ]; then
  13. echo "$dir_name already present"
  14. else
  15. git clone "$repo_url" "$dir_name" && \
  16. ( cd "$dir_name" && git checkout "$commit_id" && \
  17. # Patch the Cargo.toml files to point to the local copies
  18. # of our own sigma-rs dependencies
  19. if [ -e "../patches/${dir_name}.diff" ]; then
  20. patch -p1 < ../patches/${dir_name}.diff || exit 1
  21. fi ) || exit 1
  22. # Update the Cargo.lock file to catch the now-local sigma-rs dependencies
  23. if [ "$update_crate" != "" ]; then
  24. ( cd "$dir_name" && cargo update "$update_crate" ) || exit 1
  25. fi
  26. fi
  27. }
  28. fetch_repos() {
  29. fetch_repo https://github.com/arkworks-rs/spongefish v0.6.1 spongefish && \
  30. fetch_repo https://github.com/sigma-rs/sigma-proofs v0.3.1 sigma-proofs spongefish && \
  31. fetch_repo https://git-crysp.uwaterloo.ca/SigmaProtocol/sigma-compiler 0.2.2 sigma-compiler sigma-proofs && \
  32. fetch_repo https://git-crysp.uwaterloo.ca/SigmaProtocol/cmz 0.2.1 cmz sigma-compiler && \
  33. fetch_repo https://gitlab.torproject.org/onyinyang/lox.git/ lox-artifact application-lox cmz && \
  34. fetch_repo https://gitlab.torproject.org/onyinyang/lox.git/ lox-artifact-zkp application-lox-zkp && \
  35. fetch_repo https://github.com/ooni/userauth artifact-v0.4 application-ooni cmz
  36. }
  37. fetch_repos