#!/bin/sh

# $Debian: cvs/debian/cvs-makerepos,v 1.2 2001/06/14 02:59:32 epg Exp $

repository_create () {
    printf "Creating CVS repository in $1...\n"
    if [ ! -d $1 ]; then
	install -d -o root -g root -m 2755 $1
    fi
    cvs -d $1 init
}

if [ "$1" = "-d" ]; then
    . /usr/share/debconf/confmodule
	
    db_get cvs/repositories
    REPOS="$RET"
elif [ -f /etc/cvs-cron.conf ]; then
    . /etc/cvs-cron.conf
elif [ -f /etc/cvs.conf ]; then
    . /etc/cvs.conf
    REPOS="$CVS_REPOS"
fi

IFS=':'
for i in $REPOS; do
    IFS=' 	\
'
    if [ ! -d $i -o ! -d $i/CVSROOT ]; then
	repository_create $i
    fi
done
