diff options
Diffstat (limited to 'z-distfiles/scripts-gw-1.1/SVN-etc')
-rwxr-xr-x | z-distfiles/scripts-gw-1.1/SVN-etc | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/z-distfiles/scripts-gw-1.1/SVN-etc b/z-distfiles/scripts-gw-1.1/SVN-etc index c802770..3d53c7e 100755 --- a/z-distfiles/scripts-gw-1.1/SVN-etc +++ b/z-distfiles/scripts-gw-1.1/SVN-etc @@ -1,37 +1,26 @@ #!/bin/bash -if [ "x$1" == "x--help" ]; then - echo "Usage: SVN-etc /backup/dir \"commit message\"" - echo - echo "Copies the /etc directory into the given /backup/dir/etc" - echo "and subsequently performs a \"svn commit\". So the " - echo "backup dir has to be a checkout from an svn repository." - exit 0 -fi +LOGFILE=/root/.log/cronlog +ERRFILE=/root/.log/errlog +BASEDIR=/root/opt/backup/etc/ -LOGFILE=${1}/cronlog -ERRFILE=${1}/errlog -BASEDIR=${1}/etc/ +rm $LOGFILE +rm $ERRFILE -if [ ! -d "${BASEDIR}" ]; then - mkdir -p $BASEDIR - cd ${1} && svn add etc -fi +date >> $LOGFILE +date >> $ERRFILE -date > $LOGFILE -date > $ERRFILE +find /etc/ | grep "~$" >> $LOGFILE +find /etc/ | grep "~$" | xargs rm rsync -rptgo --delete-after --exclude ".svn/" /etc/ $BASEDIR 2>> $ERRFILE | grep -v "skipping" cd $BASEDIR && TL=`find .` && for fl in $TL;do [ -L $fl ] && rm $fl;done -cd $BASEDIR && svn status | grep '^!' | sed -e 's/^!//' | sed -e "s/^ *//" | sed -e 's/ /\\ /g' | xargs svn rm &> $LOGFILE -cd $BASEDIR && svn status | grep '^?' | sed -e 's/^?//' | sed -e "s/^ *//" | sed -e 's/ /\\ /g' | xargs svn add &> $LOGFILE +cd $BASEDIR && svn-del do &> $LOGFILE +cd $BASEDIR && svn-add do &> $LOGFILE -MESSAGE="$2" +MESSAGE="$1" [ ! "$MESSAGE" ] && MESSAGE="Automatic Update" cd $BASEDIR >> $LOGFILE 2>> $ERRFILE && svn commit -m "$MESSAGE" >> $LOGFILE 2>> $ERRFILE cat $LOGFILE cat $ERRFILE - -rm $LOGFILE -rm $ERRFILE |