#!/bin/sh
#
#

REPODIR=$1

if [ ${REPODIR}x = x ];then
    echo "Call: $0 <repodir>"
    echo ""
    echo "Creates list of files beneath repodir by boxname and write to files like"
    echo "  <repodir>/box-<boxname>.rlist"
    exit 1
fi

if [ ! -f "${REPODIR}/boxstate.xml" ];then
    echo "No boxstate.xml file in ${REPODIR}"
    exit 2
fi

grep identifier ${REPODIR}/boxstate.xml|cut -d \" -f 2 |\
while read boxdir; do
    find ${REPODIR}/${boxdir} -type f > ${REPODIR}/box-${boxdir}.repolist
done
