Svn create script
From ds-ea wiki
this script is a dummy for easy creation of svn repositories. It assumes you're using an apache setup, so it doesn't configure the repository. Additionally a skeleton directory for first import containing something like a trunk folder etc is required. customize as required
#!/bin/bash #(c)opyright 2007 christoph zenny melzer, digital signs - haenel & melzer gbr #lgpl or something show_help () { echo "Usage: `basename $0` [PROJECT_NAME] " } isalpha2 () { [ $# -eq 1 ] || return -1 case $1 in *[!a-zA-Z]*|"") return -1;; *) return 0;; esac } REPOSITORY_DIR=/srv/svn/repos SKEL_DIR=/srv/svn/tools/skel NEW_GROUP=svn_use NEW_MOD=770 #root only if [ "$UID" -ne "0" ] then echo "onlyroot, nehe" exit 67 fi if [ -n "$1" ] then PROJECT_NAME=$1 else echo "no project name supplied" show_help exit fi cd $REPOSITORY_DIR || { echo "cannot change to repository folger" exit 66 } if ! isalpha2 "$PROJECT_NAME" then echo "Bad argument: only single whole word, no slashes or dots" exit fi REPOSITORY="$REPOSITORY_DIR/$1" if test -d "$REPOSITORY" then echo "Repository with name $1 already exists in $REPOSITORY_DIR" exit fi if ! test -d "$SKEL_DIR" then echo "Skeleton directory for initial import does not exist: $SKEL_DIR" exit fi echo "checks passed, creating repository" echo "checks passed, creating repository" svnadmin create $REPOSITORY || { echo "error on creating repository - aborting" exit } svn import $SKEL_DIR "file://$REPOSITORY" -m "Skeleton Import."i chgrp -R $NEW_GROUP $REPOSITORY chmod -R 770 $REPOSITORY echo "all done. Your repository is located at $REPOSITORY"
