#!/bin/sh

set -e

version="$1"

if [ -z "$version" ]; then
	echo usage: $0 VERSION >&2
	exit 1
fi

cd /var/www/teeworlds.com/downloads

base="https://github.com/teeworlds/teeworlds"


while read -r url; do
	printf "Downloading $url… "
	wget -q "$url"
	printf "done\n"
done <<EOF
$base/releases/download/$version/teeworlds-$version-linux_x86.tar.gz
$base/releases/download/$version/teeworlds-$version-linux_x86_64.tar.gz
$base/releases/download/$version/teeworlds-$version-osx.dmg
$base/releases/download/$version/teeworlds-$version-win32.zip
$base/releases/download/$version/teeworlds-$version-win64.zip
$base/archive/$version.zip
$base/archive/$version.tar.gz
EOF
