#!/bin/sh -e
# Update the plugins from the SVN locations, only sync those that
# have been modified

# SVN location, adjust as needed
SVN_PLUGINS=/home/jfs/debian/security/openvas/svn/trunk/openvas-plugins/scripts

# Script location
DIR_PLUGINS=scripts

[ ! -d $SVN_PLUGINS ] && { echo "ERROR: Cannot find SVN plugins ($SVN_PLUGINS)!" >&2 ; exit 1 ; }
[ ! -d $DIR_PLUGINS ] && { echo "ERROR: Cannot find plugins directory ($DIR_PLUGINS)!" >&2 ; exit 1 ; }


CURDIR=`pwd`

cd $DIR_PLUGINS &&
    for plugin in *.nasl *.inc; do 
      if [ -e "${SVN_PLUGINS}/$plugin" ] ; then
        if  ! diff -q "${SVN_PLUGINS}/$plugin" "$plugin" >/dev/null ; then
            echo "Updating $plugin"
            cp "${SVN_PLUGINS}/$plugin" "$plugin"
        fi
      fi
     done

    
cd $CURDIR
