#!/bin/bash # Populate array of months we care about months=() # 2020 for i in {7..12}; do months+=( 2020-$(printf %02d $i) ) done # 2021 for i in {1..4}; do months+=( 2021-$(printf %02d $i) ) done cd belarus-2020-2021 if [ "$1" == "--fast" ]; then echo "Repacking some pre-processed data for the next step..." ./scripts/repack-preprocessed-data.sh else echo "Downloading data from the Tor Project..." ./scripts/download-bridge-data.sh if [ "$1" == "-s" ]; then # Do this step sequentially for i in ${months[@]}; do if [ ! -e data/bridge-extra-infos-${i}_processed.tar.xz ]; then ./scripts/process-data-docker.sh "$i" fi done else # Do this step in parallel for i in ${months[@]}; do if [ ! -e data/bridge-extra-infos-${i}_processed.tar.xz ]; then ./scripts/process-data-docker.sh "$i" & fi done wait fi fi docker run --name "tp-belarus" --rm -d -i tp-analysis:latest || exit 1 docker exec tp-belarus sh -c "mkdir -p /home/analysis/belarus-2020-2021/data/bridge_data" # Copy archives to docker for i in data/*_processed.tar.xz; do docker cp "${i}" tp-belarus:/home/analysis/belarus-2020-2021/data/bridge_data/ done # Return to artifact root cd .. # Process the data docker exec tp-belarus sh -c "cd /home/analysis/belarus-2020-2021 && ./scripts/get-email-bridges.sh && ./scripts/clean-bridge-data.sh" && \ docker exec tp-belarus sh -c "cd /home/analysis/belarus-2020-2021 && ./scripts/get-stats.sh" | tee section-3-results docker cp tp-belarus:/home/analysis/belarus-2020-2021/appendix-a-results.tex . && \ docker cp tp-belarus:/home/analysis/belarus-2020-2021/appendix-a-results.pdf . && \ docker stop tp-belarus