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 -12000"
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)"
PATHSUFFIX="-old/"
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
REFERENCE: http://ask.metafilter.com/121530/Can-I-use-the-existing-file-system-as-subversion-repository
Various snippets of UNIX code that might just be a waste if I keep them to myself. This blog is very much a work in progress and is mainly for myself. Yes, I should probably host code on one of those fancy code hosting web sites and I probably will eventually.
Friday, February 22, 2013
Subversioning files in place automatically....
Subscribe to:
Comments (Atom)