Project Creation

After making a few tracs and subversion repos by hand and having to do all the little things that need setting up to make things run smoothly (remembering to give svn trunk/tags/branches directories, setting up trac authentication, etc.), I decided to make a little shell script to do most of it for me.

The script I wrote takes a name as its argument and makes a trac and a repository using that name and makes a linked pair with all the bits set the way I need them in my environment for basic functionality. The repository is accessible to anyone in group `dev`, and I am the only admin on the trac.

#!/bin/bash

if [ $# != 1 ]; then
    echo "Usage: $0 "
    exit 1
fi

PROJ=$1
SVNPATH=/var/svn/$PROJ
TRACPATH=/var/trac/$PROJ

echo "About to create svn/trac for project $PROJ."
echo "    svn: $SVNPATH"
echo "    trac: $TRACPATH"
echo "Press Ctrl-C to abort."
sleep 5

svnadmin create $SVNPATH

chown -R root:dev $SVNPATH
chmod -R g+ws $SVNPATH

svn mkdir -m "Directory layout" file://$SVNPATH/trunk file://$SVNPATH/branches file://$SVNPATH/tags

# initenv    
trac-admin $TRACPATH initenv $PROJ sqlite:db/trac.db svn $SVNPATH


chmod g+w $TRACPATH/db
chmod g+w $TRACPATH/db/trac.db

cat >> $TRACPATH/conf/trac.ini <

Things I might like to fix someday:

1. I create duplicate sections in the trac.ini, although it appears to parse them OK.
1. I'd like it to put a link on the wiki start page with the URL to the repository.