[rancid] Re: Setting up rancid with a corp svn server?

Karsten Heymann karsten.heymann at blue-cable.net
Thu Dec 4 06:42:46 UTC 2008


Hi,

"Peter Serwe" <peter.serwe at gmail.com> writes:
> So, if it were to be a pretty clean hack, i.e.: Something that could
> be committed to the source tree

I solved this problem with the following trivial patch to
rancid-cvs.in (in debian dpatch format, but should be usable by others
too). Feel free to include it into the source tree. The idea is to
test if CVSROOT contains the characters ://, and, depending on that,
behave differently.

hth,
Karsten

#! /bin/sh /usr/share/dpatch/dpatch-run
## 07_svn_remote.dpatch by  <karsten.heymann at gmx.de>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Add support for remote subversion repositories

@DPATCH@
diff -urNad rancid-2.3.2~a8~/bin/rancid-cvs.in rancid-2.3.2~a8/bin/rancid-cvs.in
--- rancid-2.3.2~a8~/bin/rancid-cvs.in  2008-02-08 07:28:29.000000000 +0100
+++ rancid-2.3.2~a8/bin/rancid-cvs.in   2008-09-26 08:51:18.000000000 +0200
@@ -97,7 +97,9 @@
     if [ $RCSSYS = cvs ]; then
        cvs -d $CVSROOT init
     else
-       svnadmin create $CVSROOT @SVN_FSTYPE@
+       if [[ $(expr match $CVSROOT '.*://') -eq 0 ]]; then
+           svnadmin create $CVSROOT @SVN_FSTYPE@
+       fi
     fi
 fi

@@ -127,10 +129,16 @@
            cvs import -m "$GROUP" $GROUP new rancid
            cd $BASEDIR
            cvs checkout $GROUP
-       else
+
+       # local subversion repository:
+        elif [[ $(expr match $CVSROOT '.*://') -eq 0 ]]; then
            svn import -m "$GROUP" . file://$CVSROOT/$GROUP
            cd $BASEDIR
            svn checkout file://$CVSROOT/$GROUP $GROUP
+       else # remote subversion repository
+           svn import -m "$GROUP" . $CVSROOT/$GROUP
+           cd $BASEDIR
+           svn checkout $CVSROOT/$GROUP $GROUP
        fi
     fi
     cd $DIR

-- 
Karsten Heymann


More information about the Rancid-discuss mailing list