freebsd-ports/security/openvas-plugins/files/patch-openvas-nvt-sync.in
Martin Wilke 0a6311719e - Update to 1.0.7
PR:		137210
Submitted by:	farrokhi
Approved by:	maintainer timeout
2009-08-17 22:48:23 +00:00

59 lines
1.6 KiB
Text

$FreeBSD$
--- openvas-nvt-sync.in.orig
+++ openvas-nvt-sync.in
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# OpenVAS
# $Id$
@@ -62,16 +62,20 @@
chk_system_tools(){
echo "Searching for required system tools ..."
-RSYNC=`findcmd rsync`
-MD5SUM=`findcmd md5sum`
+RSYNC=`which rsync`
+if [ `uname -s` = "FreeBSD" ]; then
+ MD5SUM=`which gmd5sum`
+else
+ MD5SUM=`which md5sum`
+fi
-if [ -z "$RSYNC" ]; then
- echo "Error: RSYNC not found";
+if [ ! -f "$RSYNC" ]; then
+ echo "Error: rsync not found in \$PATH=$PATH" 1>&2
exit -1
fi
-if [ -z "$MD5SUM" ]; then
- echo "Error: MD5SUM not found";
+if [ ! -f "$MD5SUM" ]; then
+ echo "Error: md5 not found in \$PATH=$PATH" 1>&2
exit -1
fi
}
@@ -80,15 +84,15 @@
echo "Synchonizing NVTs via RSYNC ..."
mkdir -p "$NVT_DIR"
- eval "rsync -ltvrP \"$FEED\" \"$NVT_DIR\""
+ eval "$RSYNC -ltvrP \"$FEED\" \"$NVT_DIR\""
if [ $? -ne 0 ] ; then
- echo "Error: rsync failed. Your NVT collection might be broken now."
+ echo "Error: rsync failed. Your NVT collection might be broken now." 1>&2
exit 1
fi
- eval "cd \"$NVT_DIR\" ; md5sum -c --status \"$NVT_DIR/md5sums\""
+ eval "cd \"$NVT_DIR\" ; $MD5SUM -c --status \"$NVT_DIR/md5sums\""
if [ $? -ne 0 ] ; then
- echo "Error: md5sums not correct. Your NVT collection might be broken now."
- echo "Please try this for details: cd \"$NVT_DIR\" ; md5sum -c \"$NVT_DIR/md5sums\" | less"
+ echo "Error: md5sums not correct. Your NVT collection might be broken now." 1>&2
+ echo "Please try this for details: cd \"$NVT_DIR\" ; md5sum -c \"$NVT_DIR/md5sums\" | less" 1>&2
exit 1
fi