#!/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
REMOVED_LIST=audit/REMOVED-PLUGINS

[ ! -f $REMOVED_LIST ] && { echo "ERROR: Cannot find removed plugins list ($REMOVED_LIST)!" >&2 ; exit 1 ; }
[ ! -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 ; }


# Check new plugins
for pluginfile in ${SVN_PLUGINS}/* ; do
    plugin=`basename $pluginfile`
    if [ ! -e ${DIR_PLUGINS}/$plugin ] && ! grep -q $plugin $REMOVED_LIST; then
        echo "New plugin available: $plugin"
    fi
done
    
