#!/bin/bash
set -e
script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source "$script_dir/functions"

for builder in $tb_builders
do
  for file in sha256sums-unsigned-build.txt.asc sha256sums-unsigned-build.incrementals.txt.asc
  do
    tmpfile=$(mktemp)
    chmod 644 "$tmpfile"
    wget -q -O "$tmpfile" "https://people.torproject.org/~$builder/builds/$tbb_version-build$tbb_version_build/$file" || \
      wget -q -O "$tmpfile" "https://people.torproject.org/~$builder/builds/tor-browser/$tbb_version-build$tbb_version_build/$file" && \
      mv "$tmpfile" "$signed_version_dir/$file-$builder" && echo "Added $file-$builder"
  done
done
