#!/bin/sh
#
# $Id$
#
# Converts RPMs from up2date into a YUM repository. Consults both base
# packages (under redhat/3AS/i386 for RHEL3 AS on i386) and updates
# (redhat/updates/3AS/i386), though only updates the updates directory.
# where YUM data stored on system, e.g. /var/www/yum
YUMDIR=FIXME_YUM_DIR
# '3AS' on RHEL3 systems
releasever=`rpm -q --qf '%{VERSION}' redhat-release`
# should be i386 or x86_64
basearch=`uname -i`
up2date --showall | xargs up2date -k $YUMDIR/redhat/$releasever/$basearch/RPMS/:$YUMDIR/redhat/updates/$releasever/$basearch/RPMS/ --get
find /var/spool/up2date -type l -print0 | xargs -0 rm -f
find /var/spool/up2date -type f -iname '*.rpm' -exec mv {} $YUMDIR/redhat/updates/$releasever/$basearch/RPMS/ \;
pushd $YUMDIR/redhat/updates/$releasever/$basearch/
yum-arch -q .
popd