#!/bin/bash

# Need to make this var work better.  It's hackish now.
YUMREPOS=""
YUMREPOS="${YUMREPOS} centos/5/{current,beta}/"
YUMREPOS="${YUMREPOS} centos/5/digium-{1.4,1.6.2,1.8,1.8-digiumphones,1.8-certified,10}/"
YUMREPOS="${YUMREPOS} trixbox/28/current/"
YUMREPOS="${YUMREPOS} centos/6/current/"
YUMREPOS="${YUMREPOS} centos/6/digium-{11,11-certified,12}/"

ARCHES="i386 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
