Created
May 7, 2011 12:06
-
-
Save alexrinass/960450 to your computer and use it in GitHub Desktop.
Creates a new SVN repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Creates a Subversion repository under /var/lib/svn and imports the default | |
# SVN directory layout (trunk branches tags) as initial commit. | |
# | |
SCRIPT_NAME="`basename $0`" | |
SVN_REPOSITORY_PATH="/var/lib/svn" | |
SVN_HOOKS_PATH="/usr/local/share/subversion/repository-creation/hooks" | |
SVN_BASE_IMPORT_PATH="/usr/local/share/subversion/repository-creation/base-import" | |
NEW_REPOSITORY_NAME="$1" | |
NEW_REPOSITORY_PATH="$SVN_REPOSITORY_PATH/$NEW_REPOSITORY_NAME" | |
if [ "`whoami`" != "root" ]; then | |
echo "$SCRIPT_NAME: You need to run this script as root." | |
exit 1 | |
fi | |
if [ -z "$NEW_REPOSITORY_NAME" ]; then | |
echo "Usage: $SCRIPT_NAME REPOSITORY_NAME" | |
exit 1 | |
fi | |
if [ -d "$NEW_REPOSITORY_PATH" ]; then | |
echo "$SCRIPT_NAME: SVN repository already exists at $NEW_REPOSITORY_PATH! Aborting." | |
exit 1 | |
fi | |
umask 002 | |
mkdir -v "$NEW_REPOSITORY_PATH" | |
svnadmin create "$NEW_REPOSITORY_PATH" | |
cp -v $SVN_HOOKS_PATH/* $NEW_REPOSITORY_PATH/hooks/ | |
svn import -m "Initial commit." "$SVN_BASE_IMPORT_PATH" "file://$NEW_REPOSITORY_PATH" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment