#!/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

# Download the archives if we don't have them already
for i in ${months[@]}; do
    if [ ! -f data/bridge-extra-infos-${i}.tar.xz ]; then
        curl -Lo data/bridge-extra-infos-${i}.tar.xz https://collector.torproject.org/archive/bridge-descriptors/extra-infos/bridge-extra-infos-${i}.tar.xz || exit 1
    fi
done

# Check that we have the right archives
sha256sum -c data/bridge-extra-infos.sha256 || exit 1
