#!/bin/bash

DISTS="esx35 sle9 sle10"
YUM_TARGET="/home/ftp/RPM.additions/dists"
GPG_KEY="19297E42"

# Now, recreate the repomd.xml by means of createrepo
for distribution in $DISTS; do
	# Build the exclusion list for createrepo
	EXCLUDE=""
	EXCLUDES=""
	EXCLUDES="$( echo ${DISTS} | sed "s,$distribution,,g" )"
	for exclude in $EXCLUDES; do
		EXCLUDE="${EXCLUDE} -x \"*.$exclude.*\""
	done
	echo "Exclusion list for $distribution is: $EXCLUDE"
	echo "/usr/bin/createrepo $EXCLUDE -q $YUM_TARGET/$distribution"

	# Now additonally sign the repomd.xml
#	cd $YUM_TARGET/$distribution
#	[ ! -f repodata/repomd.xml.key ] && gpg -a --export $GPG_KEY > repodata/repomd.xml.key
#	rm -f repodata/repomd.xml.asc && gpg -a --detach-sign repodata/repomd.xml
done
