#!/bin/sh -ex
###########################################################################
# 
# Unfortunately, uscan doesn't work well with downloading upstream source,
# due to the complicated http://cldr.unicode.org/ site design.  This
# script should help download and repack.
#  Usage:
#  $ cd /path/to/unicode-cldr-core/debian/
#  $ cd ../..
#  $ unicode-cldr-core/debian/getorigtar "32.0.1"
###########################################################################
VERSION="$1"
# SANITY CHECKS
if [ -z "${VERSION}" ]; then
	exit 1
fi
if [ -d "unicode-cldr-core-${VERSION}" ]; then
	exit 1
fi
# DOWNLOAD
wget "http://www.unicode.org/Public/cldr/${VERSION}/core.zip"
# UNPACK
unzip core.zip -d "unicode-cldr-core-${VERSION}"
# PACK
tar --xz -cvf "unicode-cldr-core_${VERSION}.orig.tar.xz" "unicode-cldr-core-${VERSION}"
