[Openvas-devel] OpenVAS NVT Feed as Tarball

Javier Fernandez-Sanguino jfs at computer.org
Fri Oct 23 10:42:01 CEST 2009


2009/10/22 Vlatko Kosturjak <kost at linux.hr>:
> Fixed. New script is in the attachment. Did not know there is coding style
> for scripts as well. TMPDIR only left as it is standard environment
> variable.

If I might be of help: instead of using TMPDIR (which is not commonly
defined in Linux environments) it should use tempfile instead if
availaable. As there is only one file being downloaded it would be
best if you replaced

TMP_NVT="$SYNC_TMP_DIR/openvas-feed-`date +%F`-$$.tar.bz2"

With this (untested, but should work):

----------------------------------------------------------------------------------------------------------------------------------------------------
CURDATE=-`date +%F`
# Try to find tempfile, if available, then use it for the download file
if [ -n "`which tempfile`" ] ; then
    TMP_NVT=`tempfile --suffix=-openvas-feed-$CURDATE.tar.bz2` || {
echo "Cannot create temporary file for download!" >&2; exit 1 ;}
else
    TMP_NVT="$SYNC_TMP_DIR/openvas-feed-$CURDATE-$$.tar.bz2"
fi
# Set up a trap so that the file is removed if there are any errors
trap "rm -f -- '$TMP_NVT" EXIT
----------------------------------------------------------------------------------------------------------------------------------------------------

Best regards

Javier


More information about the Openvas-devel mailing list