Tuesday, April 15, 2014

SVN: sort of

i've long been looking at a way to version files in place in lieu of not doing it manually with RCS like I do (I've come up with something better in the mean time - I have NOT posted it yet)


here are some basic instructions on how to do that with Subversion


RESETTING EVERYTHING TO SCRATCH (only need to do this to start again)


# on the repository server
z-webdav:/ # \rm -rf /web/webdav/svn/unixsvn/hosts/z-webdav/

z-webdav:/ # svnadmin create /web/webdav/svn/unixsvn/hosts/z-webdav

z-webdav:/ # chown -R svn:svn /web/webdav/svn/unixsvn/hosts/


# on the client system
clientserver:/ # \rm -rf /.svn



and then run this script I wrote

clientserver:/ # ./SVNME.sh



you'll probably need to update the username and password to your own details - actually it would be better to have a specific SVN user added to AD for
doing this

and note that this was done on a solaris 10 box so it might not be quite the same on other boxes and you might need to use full path names to find the
various utils you need ... eg. gfind

z-webdav:/ # cat SVNME.sh
#!/bin/sh

USER=username
PASS=password
AUTH="--username $USER --password $PASS"
TARGETHOST=`hostname | sed 's/\..*$//g'`
SVNHOST=unixsvn
MINSIZE=+64c
MINUTES="-mmin +60 -and -mmin -1840"
MYEXIT=0

# test to see if we have a hostname repository
svn list http://$SVNHOST/hosts/$TARGETHOST || MYEXIT=23

cd /

INCLUDE_LIST="etc web/server*/etc web/server*/httpd-*.*.*/conf usr/local/etc"
ENDOFLINE="(-edit|\-|\.|,v|\.(bak|db|disabled|example|sample|old|OUT|[0-9]+))$"
PATHPREFIX="/(\.[a-z]|_|\.?(JUNK|OLD|OUT)|CVS|FFF|RCS|RUN|core|svc/repository-boot)"
PATHSUFFIX="-old/|etc/mnttab"
EXCLUDE_LIST="$ENDOFLINE|$PATHPREFIX|$PATHSUFFIX"

EXPANDED_INCLUDE_LIST=`/bin/ls -d $INCLUDE_LIST`


case $MYEXIT in
   0)
     echo TARGET REPOSITORY SEEMS TO EXIST - BEGIN PROCESSING
     ;;
   23)
     echo TARGET RESPOSITORY DOES NOT SEEM TO EXIST
     exit $MYEXIT
     ;;
esac

set -x

[ -d /.svn ] ||
    svn co http://$SVNHOST/hosts/$TARGETHOST .


for i in $EXPANDED_INCLUDE_LIST
do
echo ============= $i ================
    for j in `[ -d "$i" ] && gfind $i -type f $MINUTES -size $MINSIZE | egrep -v -e "$EXCLUDE_LIST"`
    do
        svn ls http://$SVNHOST/hosts/$TARGETHOST/$j ||
            svn add --parents $j
    done
done

svn commit -m "auto commit"

exit $MYEXIT


No comments:

Post a Comment