#! /bin/bash

THISDIR=$(readlink -f $(dirname $0))
cd $THISDIR
git rm -rf repodata/ drpms/
createrepo --deltas --oldpackagedirs=../yum_oldrpms/ --no-database --baseurl disagree .
cp updateinfo.xml.gz repodata/
pushd repodata/
sed -i -e '$d' repomd.xml # delete the last line: </repomd>
cat >>repomd.xml <<EOF
<data type="updateinfo">
  <checksum type="sha256">$(sha256sum updateinfo.xml.gz |cut -f 1 -d ' ')</checksum>
  <location href="repodata/updateinfo.xml.gz"/>
  <timestamp>1284438472</timestamp>
</data>
</repomd>
EOF
popd

git add repodata/ drpms/
