#!/bin/sh

set -e
set -u

repacked=`mktemp -d`

tar -C "$repacked" -xf $3 && (cd $repacked/gawk-*; find . -maxdepth 1 ! -name . ! -name doc -exec rm -rf {} +)
tar -C "$repacked" -cJf ../gawk-doc_"$2".orig.tar.xz gawk-"$2"

uupdate -u ../gawk-doc_"$2".orig.tar.xz -v "$2"

exit 0
