#!/bin/sh -e

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

update_db_autoports()
{
	local branch=$1
	update_db $branch http://autoextra.altlinux.org/pub/repocop/$branch/data/repocop-distrodb-$branch-current.tar.gz
}

update_db_autoports p11

