diff options
author | wiz <wiz@pkgsrc.org> | 2004-07-29 22:19:57 +0000 |
---|---|---|
committer | wiz <wiz@pkgsrc.org> | 2004-07-29 22:19:57 +0000 |
commit | 7824c761d52417ccf87e1f606edd9fff0e462d00 (patch) | |
tree | 28cf38108d52805e9e8653eba772ba31157a7b47 /security/uvscan/files | |
parent | 2ebc04dd8bfed0afb1418b5aedd02e40a2df07d6 (diff) | |
download | pkgsrc-7824c761d52417ccf87e1f606edd9fff0e462d00.tar.gz |
Update to 4.24.1:
Improve update_dat script with patch from Jason White in followup
to PR 26408.
. get updates from faster and more reliable http server
. dat file format has changed -- version info is now in a different file
. abort update if no write permissions in target dir
Diffstat (limited to 'security/uvscan/files')
-rw-r--r-- | security/uvscan/files/update_dat.sh | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/security/uvscan/files/update_dat.sh b/security/uvscan/files/update_dat.sh index 540404d59de..4cd244a95cf 100644 --- a/security/uvscan/files/update_dat.sh +++ b/security/uvscan/files/update_dat.sh @@ -1,7 +1,7 @@ #!/bin/sh UVSCANDIR="@UVSCANDIR@" -DAT_SITE="ftp://ftp.nai.com/pub/datfiles/english/" +DAT_SITE="http://download.nai.com/products/datfiles/4.x/nai/" DAT_FILES="@DATFILES@" TMPDIR="${TMPDIR:-/tmp}/$$" @@ -25,25 +25,38 @@ while getopts vf: arg; do esac done +(${ECHO} writetest > ${UVSCANDIR}/writetest) >/dev/null 2>&1 +if [ $? != 0 ]; then + echo ${progname}: no write access to ${UVSCANDIR} -- update aborted. + exit 1 +else + ${RM} -f ${UVSCANDIR}/writetest +fi + ${MKDIR} ${TMPDIR} if [ -n "$dat_tar" ]; then - if ! (${GTAR} -x -C ${TMPDIR} -f $dat_tar readme.txt >/dev/null); then - ${ECHO} "$progname: unable to extract readme.txt" + if ! (${GTAR} -x -C ${TMPDIR} -f $dat_tar pkgdesc.ini >/dev/null); then + ${ECHO} "$progname: unable to extract pkgdesc.ini" ${RM} -rf ${TMPDIR} exit 1 fi + curver=`${AWK} -F= '/Version/ { print $2; exit }' ${TMPDIR}/pkgdesc.ini | ${SED} -e 's/^.*\([0-9][0-9][0-9][0-9]\).*$/\1/'` else - # Fetch the ReadMe file to read the latest version of the DAT files. - if ! (cd ${TMPDIR}; ftp ${DAT_SITE}readme.txt >/dev/null); then - ${ECHO} "$progname: unable to fetch ${DAT_SITE}readme.txt" + # Fetch the update.ini file to read the latest version of the DAT files. + if ! (cd ${TMPDIR}; ftp ${DAT_SITE}update.ini >/dev/null); then + ${ECHO} "$progname: unable to fetch ${DAT_SITE}update.ini" ${RM} -rf ${TMPDIR} exit 1 fi + curver=`${AWK} -F= '/DATVersion/ { print $2; exit }' ${TMPDIR}/update.ini | ${SED} -e 's/^.*\([0-9][0-9][0-9][0-9]\).*$/\1/'` fi -curver=`${AWK} '/DAT Version/ { print $4; exit }' ${TMPDIR}/readme.txt | ${SED} -e 's/^.*\([0-9][0-9][0-9][0-9]\).*$/\1/'` -oldver=`${AWK} '/DAT Version/ { print $4; exit }' ${UVSCANDIR}/readme.txt | ${SED} -e 's/^.*\([0-9][0-9][0-9][0-9]\).*$/\1/'` +if [ -e ${UVSCANDIR}/pkgdesc.ini ]; then + oldver=`${AWK} -F= '/Version/ { print $2; exit }' ${UVSCANDIR}/pkgdesc.ini | ${SED} -e 's/^.*\([0-9][0-9][0-9][0-9]\).*$/\1/'` +else + oldver=0 +fi if [ $curver -le $oldver ]; then if [ -z "$verbose" ]; then |