belarus.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. # Populate array of months we care about
  3. months=()
  4. # 2020
  5. for i in {7..12}; do
  6. months+=( 2020-$(printf %02d $i) )
  7. done
  8. # 2021
  9. for i in {1..4}; do
  10. months+=( 2021-$(printf %02d $i) )
  11. done
  12. cd belarus-2020-2021
  13. if [ "$1" == "--fast" ]; then
  14. echo "Repacking some pre-processed data for the next step..."
  15. ./scripts/repack-preprocessed-data.sh
  16. else
  17. echo "Downloading data from the Tor Project..."
  18. ./scripts/download-bridge-data.sh
  19. # Do this step in parallel
  20. for i in ${months[@]}; do
  21. if [ ! -e data/bridge-extra-infos-${i}_processed.tar.xz ]; then
  22. ./scripts/process-data-docker.sh "$i" &
  23. fi
  24. done
  25. wait
  26. fi
  27. docker run --name "tp-belarus" --rm -d -i tp-analysis:latest || exit 1
  28. docker exec tp-belarus sh -c "mkdir -p /home/analysis/belarus-2020-2021/data/bridge_data"
  29. # Copy archives to docker
  30. for i in data/*_processed.tar.xz; do
  31. docker cp "${i}" tp-belarus:/home/analysis/belarus-2020-2021/data/bridge_data/
  32. done
  33. # Return to artifact root
  34. cd ..
  35. # Process the data
  36. docker exec tp-belarus sh -c "cd /home/analysis/belarus-2020-2021 && ./scripts/get-email-bridges.sh && ./scripts/clean-bridge-data.sh" && \
  37. docker exec tp-belarus sh -c "cd /home/analysis/belarus-2020-2021 && ./scripts/get-stats.sh" | tee appendix-a-results
  38. docker cp tp-belarus:/home/analysis/belarus-2020-2021/appendix-a-results.tex . && \
  39. docker cp tp-belarus:/home/analysis/belarus-2020-2021/appendix-a-results.pdf . && \
  40. docker stop tp-belarus