#!/bin/sh -e

update_db()
{
	local branch=$1
	shift
	rm -rf ~/.cache/distrodb/altlinux/$branch
	for url in "$@"; do
	    local file=`basename "$url"`
	    rm -f "$file"
	    wget -c "$url"
	    tar xz -C ~ -f "$file"
	    rm -f "$file"
	done
	echo "unpacked to ~/.cache/distrodb/altlinux/$branch"
}

update_db sisyphus \
    http://repocop.altlinux.org/pub/repocop/data/repocop-distrodb-sisyphus-current.tar.gz \
    http://autoimports.altlinux.org/pub/repocop/autoimports/Sisyphus/data/repocop-distrodb-sisyphus-autoimports-current.tar.gz
