clone-repos 1.6 KB

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