#!/bin/bash

# Need to make this var work better.  It's hackish now.
YUMREPOS=""
YUMREPOS="${YUMREPOS} centos/4/{tested,current}/"
YUMREPOS="${YUMREPOS} centos/5/{tested,current}/"
YUMREPOS="${YUMREPOS} rhel/4/{tested,current}/"
YUMREPOS="${YUMREPOS} rhel/5/{tested,current}/"
YUMREPOS="${YUMREPOS} sles/10/{tested,current}/"
YUMREPOS="${YUMREPOS} suse/11/{tested,current}/"

ARCHES="i386 SRPMS x86_64"

for repo in `eval echo ${YUMREPOS}`; do
	for arch in ${ARCHES}; do
		if [ ! -d "${repo}/${arch}" ]; then
			# Let yum work, even if there are no packages.
			mkdir -p ${repo}/${arch}
		fi
		cr_flags=-q
		#cr_flags=-v
		if [ -f `pwd`/${repo}/comps.xml ]; then
			createrepo -g `pwd`/${repo}/comps.xml --update ${cr_flags} -p ${repo}/${arch}
		else
			createrepo --update ${cr_flags} -p ${repo}/${arch}
		fi
	done
done
