#!/bin/sh

set -e

link=$1

export TEXTDOMAIN=kcm_mobile_update_scripts
. gettext.sh

update_dir=~/update
mkdir $update_dir -p
filename=$(echo $link | awk -F '/' '{print $ NF}')

echo $(gettext "Downloading files...")
curl -f -o $update_dir/$filename --connect-timeout 5 $link
echo $(gettext "Downloading gostsum...")
curl -f -o $update_dir/$filename.gost --connect-timeout 5 $link.gost
echo $(gettext "Downloading md5sum...")
curl -f -o $update_dir/$filename.md5 --connect-timeout 5 $link.md5 || echo $(gettext "md5 checksum does not exist on the server")
