Created
March 22, 2011 00:53
-
-
Save nbrew/880558 to your computer and use it in GitHub Desktop.
Create and load a svn repository from a dump file.
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/bash | |
# | |
# load.sh | |
# | |
# script to create a repository and load a dumpfile | |
# | |
SVNADMIN=/usr/local/bin/svnadmin | |
REPO_DIR=/var/svn/repos | |
DUMP_DIR=/var/svn/dumps | |
function create() { | |
${SVNADMIN} create ${REPO_DIR}/${repository} | |
if [ $? -ne 0 ]; then | |
echo "Create failed." | |
exit 4 | |
fi | |
} | |
function load() { | |
${SVNADMIN} load --quiet ${REPO_DIR}/${repository} < ${DUMP_DIR}/${repository} | |
if [ $? -ne 0 ]; then | |
echo "Loading failed." | |
exit 5 | |
fi | |
} | |
if [ -z $1 ]; then | |
echo "usage: $0 repository" | |
echo "" | |
echo "Where 'repository' is both the name of the repository and the dump file." | |
exit 1 | |
fi | |
repository="$1" | |
if [ ! -f "${DUMP_DIR}/${repository}" ]; then | |
echo "Dump file does not exist." | |
echo "Expected: ${DUMP_DIR}/${repository}" | |
exit 2 | |
elif [ -d "${REPO_DIR}/${repository}" ]; then | |
echo "Repository directory already exists." | |
exit 3 | |
fi | |
echo "Loading and creating ${repository}..." | |
create | |
load | |
echo "done." | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment