#!/bin/bash

# Need to make this var work better.  It's hackish now.
YUMREPOS=""
YUMREPOS="${YUMREPOS} centos/5/{current,beta,asterisk-scf}/"
YUMREPOS="${YUMREPOS} centos/5/asterisk-{1.4,1.6.2,1.8,10}/"

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

