alix1c support.
[buildrom.git] / buildrom-devel / bin / fetchsvn.sh
blob9cfe825bca644b9f8eaae27b901f677f5252be9e
1 #!/bin/sh
2 # Check out or update a SVN repository
4 URL=$1
5 DIR=$2
6 REV=$3
7 TARBALL=$4
9 SVNV=`svn --version --quiet`
11 if [ $? -ne 0 ]; then
12 echo "You don't have SVN installed."
13 exit 1
16 # Simple case - the repository doesn't exist
18 if [ ! -d $DIR/svn/.svn ]; then
19 echo "Fetching $URL..."
20 svn co -r $REV $URL $DIR/svn
21 if [ $? -ne 0 ]; then
22 echo "Couldn't fetch the code from $URL"
23 exit 1
24 fi
25 else
26 CURREV=`svn info $DIR/svn | grep "Last Changed Rev" | awk '{ print $4 }'`
28 if [ $CURREV -ne $REV ]; then
29 (cd $DIR/svn; \
30 echo "Updating from $CURREV to $REV"
31 svn update -r $REV || {
32 echo "Couldn't update the repository."
33 exit 1
38 tar -C $DIR -zcf $TARBALL svn