John Manko

stuff

Archive for the 'Linux' Category

Scripting SVN Repo Creation in Gentoo

I wrote a script to ease the creation of subversion repositories in Gentoo.  This script assumes the existence of three files:

authz         - Standard svn authorization file,
                located svn root conf directory,
                used for all repos.
passwd        - Standard passwd file, and
                is used for all repos.
svnserve.conf - Template file (points back to
                authz & passwd), copied to each
                newly created repo conf
                directory.

Here is the script:


#! /bin/bash
REPO_ROOT=/var/svn

echo -n "New Repository Name: "
read -e REPO_NAME

if [ "$REPO_NAME" = "" ]; then
 echo "A valid repository name must be entered.  Cannot create repository.";
 exit;
fi

REPO_PATH=$REPO_ROOT/$REPO_NAME

if [ -e $REPO_PATH ]; then
 echo "The file or directory ($REPO_PATH) already exists.  Cannot create repository.";
 exit;
fi

svnadmin create $REPO_PATH
cp $REPO_ROOT/conf/svnserve.conf $REPO_PATH/conf/
rm $REPO_PATH/conf/authz
rm $REPO_PATH/conf/passwd
chown -R svn:svnusers $REPO_PATH
chmod -R g+w $REPO_PATH
chmod -R o-rwx $REPO_PATH
/etc/init.d/svnserve restart

echo $REPO_PATH has been created!
posted by john in Linux and have No Comments