-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsvn-check-dump
51 lines (47 loc) · 1.18 KB
/
svn-check-dump
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash -i
# SVN CHECK DUMP : verify an SVN dump.
# The script creates a repository using svnadmin,
# load the specified dump file, verify it and remove it.
# Cleanup exit function
function svn_check_dump_exit()
{
# remove tmp test repository directory
if [ -d $repo_path ]; then
rm -rf $repo_path
fi
exit
}
# Check if an existing dump file is provided as an argument
if [ $1 ]; then
if [ ! -f $1 ]; then
echo "$1 not found"
svn_check_dump_exit
else
dump_path=$1
fi
else
echo "Enter SVN dump file to test :"
read -e dump_path
if [ ! -f $dump_path ]; then
echo "$dump_path not found"
svn_check_dump_exit
fi
fi
# Setup tmp test repository directory
repo_path="/tmp/testrepo/"
rm -rf $repo_path
mkdir $repo_path
# Create, import and verify repository from dump
echo "Creating repository..."
if ! svnadmin create $repo_path; then
echo "Error on : svnadmin create $repo_path"
svn_check_dump_exit
fi
echo "Loading dump... (this may take a while depending on your repo size)"
if ! svnadmin load -q $repo_path < $dump_path; then
echo "Error on : svnadmin load -q $repo_path < $dump_path"
svn_check_dump_exit
fi
echo "Veriy dump..."
svnadmin verify $repo_path
svn_check_dump_exit