diff options
author | Jeffrey C. Ollie <jeff@ocjtech.us> | 2007-03-29 09:44:10 -0500 |
---|---|---|
committer | Jeffrey C. Ollie <jcollie@lt26923.campus.dmacc.edu> | 2009-09-01 08:39:15 -0500 |
commit | 10a9fb8419f6db56bf98252a4b25f4ba10bc7839 (patch) | |
tree | 5010f181a6993c9df13b361eb4b61f934cb4f47b /bin/rancid-cvs.in | |
parent | df23b0df28dbddf73d06910ac250459743ac663e (diff) | |
download | rancid-10a9fb8419f6db56bf98252a4b25f4ba10bc7839.tar.gz rancid-10a9fb8419f6db56bf98252a4b25f4ba10bc7839.tar.xz rancid-10a9fb8419f6db56bf98252a4b25f4ba10bc7839.zip |
More work on git.
Diffstat (limited to 'bin/rancid-cvs.in')
-rw-r--r-- | bin/rancid-cvs.in | 116 |
1 files changed, 87 insertions, 29 deletions
diff --git a/bin/rancid-cvs.in b/bin/rancid-cvs.in index 2104694..f7f8738 100644 --- a/bin/rancid-cvs.in +++ b/bin/rancid-cvs.in @@ -87,21 +87,44 @@ cd $BASEDIR # RCS system RCSSYS=${RCSSYS:=cvs}; -if [ $RCSSYS != "cvs" -a $RCSSYS != "svn" -a $RCSSYS != "git" ] ; then - echo "$RCSSYS is not a valid value for RCSSYS." - exit 1 -fi +case $RCSSYS in + cvs | svn ) + # we're good + ;; + git ) + # force $CVSROOT + CVSROOT=$BASEDIR/.git + ;; + * ) + echo "$RCSSYS is not a valid value for RCSSYS." + exit 1 + ;; +esac # Top level CVS stuff if [ ! -d $CVSROOT ]; then - if [ $RCSSYS = cvs ]; then - cvs -d $CVSROOT init - elif [ $RCSSYS = svn ]; then - svnadmin create $CVSROOT @SVN_FSTYPE@ - else - # git does not use $CVSROOT, instead configs are stored in $BASEDIR - git init - echo "logs" >> .gitignore + case $RCSSYS in + cvs ) + cvs -d $CVSROOT init + ;; + svn ) + svnadmin create $CVSROOT @SVN_FSTYPE@ + ;; + git ) + # git does not use $CVSROOT, instead configs are stored in $BASEDIR + ( + flock -x 200 + git init + rm -f .gitignore + echo "/logs" >> .gitignore + echo "/.lockfile" >> .gitignore + echo "*~" >> .gitignore + echo ".#*" >> .gitignore + echo ".cvsignore" >> .gitignore + echo "*.new" >> .gitignore + git add .gitignore + git commit -m "Initializing repository." + ) 200>$BASEDIR/.lockfile fi fi @@ -127,23 +150,48 @@ do if [ ! -d $DIR ]; then mkdir -p $DIR cd $DIR - if [ $RCSSYS = cvs ]; then - cvs import -m "$GROUP" $GROUP new rancid - cd $BASEDIR - cvs checkout $GROUP - elif [ $RCSSYS = svn ]; then - svn import -m "$GROUP" . file:///$CVSROOT/$GROUP - cd $BASEDIR - svn checkout file:///$CVSROOT/$GROUP $GROUP - fi + case $RCSSYS in + cvs ) + cvs import -m "$GROUP" $GROUP new rancid + cd $BASEDIR + cvs checkout $GROUP + ;; + svn ) + svn import -m "$GROUP" . file:///$CVSROOT/$GROUP + cd $BASEDIR + svn checkout file:///$CVSROOT/$GROUP $GROUP + ;; + git ) + cd $BASEDIR + echo "$GROUP/routers.all" >> .gitignore + echo "$GROUP/routers.down" >> .gitignore + echo "$GROUP/routers.up" >> .gitignore + echo "$GROUP/routers.mail" >> .gitignore + echo "$GROUP/routers.added" >> .gitignore + echo "$GROUP/routers.deleted" >> .gitignore + echo "$GROUP/routers.single" >> .gitignore + echo "$GROUP/routers.up.missed" >> .gitignore + echo "$GROUP/routers.failed" >> .gitignore + ( + flock -x 200 + git add .gitignore + git commit -m "Update .gitignore" + ) 200>$BASEDIR/.lockfile + ;; + esac fi cd $DIR if [ ! -d configs ]; then mkdir configs - if [ $RCSSYS = cvs -o $RCSSYS = svn ]; then - $RCSSYS add configs - $RCSSYS commit -m 'new' configs - fi + case $RCSSYS in + cvs | svn ) + $RCSSYS add configs + $RCSSYS commit -m 'new' configs + ;; + git ) + # nothing to be done here + ;; + esac fi # main files @@ -158,9 +206,19 @@ do fi if [ ! -f router.db ]; then touch router.db - if [ $RCSSYS = cvs -o $RCSSYS = svn ]; then - $RCSSYS add router.db - fi - $RCSSYS commit -m 'new' router.db + case $RCSSYS in + cvs | svn ) + $RCSSYS add router.db + $RCSSYS commit -m 'new' router.db + ;; + git ) + git add + ( + flock -x 200 + git add router.db + git commit -m "Initializing $GROUP" + ) 200>$BASEDIR/.lockfile + ;; + esac fi done |