From c874f7ec0faa8d510a66647437f9d593696cae1a Mon Sep 17 00:00:00 2001 From: jlam Date: Thu, 16 Aug 2001 00:01:24 +0000 Subject: Update security/uvscan-dat to 4154. Modify package so that it may deinstall cleanly with pkg_delete, and make the update_dat script more robust by fetching to a temporary directory, and only moving the new DAT files into place if the fetch and untar was successful. --- security/uvscan-dat/Makefile | 83 ++++++++++++++++++++++------------ security/uvscan-dat/distinfo | 6 +-- security/uvscan-dat/files/update_dat | 87 ++++++++++++++++++++++++++++++------ security/uvscan-dat/pkg/DEINSTALL | 76 +++++++++++++++++++++++++++++++ security/uvscan-dat/pkg/DESCR | 2 +- security/uvscan-dat/pkg/INSTALL | 49 ++++++++++++++++++++ security/uvscan-dat/pkg/PLIST | 16 +++---- 7 files changed, 265 insertions(+), 54 deletions(-) create mode 100644 security/uvscan-dat/pkg/DEINSTALL create mode 100644 security/uvscan-dat/pkg/INSTALL (limited to 'security/uvscan-dat') diff --git a/security/uvscan-dat/Makefile b/security/uvscan-dat/Makefile index 9d325a27024..965034f9e35 100644 --- a/security/uvscan-dat/Makefile +++ b/security/uvscan-dat/Makefile @@ -1,40 +1,67 @@ -# $NetBSD: Makefile,v 1.18 2001/08/13 15:10:40 rh Exp $ +# $NetBSD: Makefile,v 1.19 2001/08/16 00:01:24 jlam Exp $ # -DISTNAME= dat-4153 -PKGNAME= uvscan-${DISTNAME} -NO_WRKSUBDIR= yes -CATEGORIES= security -MASTER_SITES= http://download.nai.com/products/datfiles/4.x/nai/ \ - http://gd.tuwien.ac.at/pc/nai/antivirus/datfiles/4.x/ \ - ftp://ftp.tuwien.ac.at/pc/nai/antivirus/datfiles/4.x/ -EXTRACT_SUFX= .tar +DISTNAME= dat-4154 +PKGNAME= uvscan-${DISTNAME} +NO_WRKSUBDIR= YES +CATEGORIES= security +MASTER_SITES= http://download.nai.com/products/datfiles/4.x/nai/ \ + http://gd.tuwien.ac.at/pc/nai/antivirus/datfiles/4.x/ \ + ftp://ftp.tuwien.ac.at/pc/nai/antivirus/datfiles/4.x/ +EXTRACT_SUFX= .tar -MAINTAINER= packages@netbsd.org -HOMEPAGE= http://www.nai.com/asp_set/download/dats/mcafee_4x.asp -COMMENT= AntiVirus DAT file for uvscan +MAINTAINER= packages@netbsd.org +HOMEPAGE= http://www.nai.com/asp_set/download/dats/mcafee_4x.asp +COMMENT= AntiVirus DAT file for uvscan -NO_BUILD= YES +NO_BUILD= YES -RESTRICTED= "restricted to the license terms set for VirusScan" -NO_BIN_ON_FTP= ${RESTRICTED} -NO_BIN_ON_CDROM=${RESTRICTED} -NO_SRC_ON_FTP= ${RESTRICTED} -NO_SRC_ON_CDROM=${RESTRICTED} +RESTRICTED= "restricted to the license terms set for VirusScan" +NO_BIN_ON_FTP= ${RESTRICTED} +NO_BIN_ON_CDROM= ${RESTRICTED} +NO_SRC_ON_FTP= ${RESTRICTED} +NO_SRC_ON_CDROM= ${RESTRICTED} + +DOCDIR= ${PREFIX}/share/doc/uvscan +DATDIR= ${PREFIX}/share/uvscan +DATFILES= clean.dat internet.dat names.dat scan.dat readme.txt +DEINSTALL_FILE= ${WRKDIR}/DEINSTALL +INSTALL_FILE= ${WRKDIR}/INSTALL + +FILES_SUBST= PREFIX=${PREFIX} +FILES_SUBST+= DATFILES=${DATFILES:Q} +FILES_SUBST+= CAT=${CAT:Q} +FILES_SUBST+= CMP=${CMP:Q} +FILES_SUBST+= CP=${CP:Q} +FILES_SUBST+= MKDIR=${MKDIR:Q} +FILES_SUBST+= RM=${RM:Q} +FILES_SUBST+= RMDIR=${RMDIR:Q} +FILES_SUBST+= TRUE=${TRUE:Q} +FILES_SUBST_SED= ${FILES_SUBST:S/=/@!/:S/$/!g/:S/^/ -e s!@/} do-configure: - ${SED} -e 's:@PREFIX@:${PREFIX}:g' \ - <${FILESDIR}/update_dat >${WRKDIR}/update_dat + ${SED} ${FILES_SUBST_SED} ${FILESDIR}/update_dat > ${WRKDIR}/update_dat + +pre-install: + ${SED} ${FILES_SUBST_SED} ${PKGDIR}/DEINSTALL > ${DEINSTALL_FILE} + ${SED} ${FILES_SUBST_SED} ${PKGDIR}/INSTALL > ${INSTALL_FILE} do-install: - ${INSTALL_DATA_DIR} ${PREFIX}/libexec/uvscan -.for file in clean.dat internet.dat names.dat scan.dat - ${INSTALL_DATA} ${WRKSRC}/${file} ${PREFIX}/libexec/uvscan -.endfor - ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/uvscan -.for file in reseller.txt readme.txt packing.lst - ${INSTALL_DATA} ${WRKSRC}/${file} ${PREFIX}/share/doc/uvscan -.endfor ${INSTALL_SCRIPT} ${WRKDIR}/update_dat ${PREFIX}/sbin + ${INSTALL_DATA_DIR} ${DATDIR} + cd ${WRKSRC}; \ + for file in ${DATFILES}; do \ + ${INSTALL_DATA} $${file} ${DATDIR}; \ + done + + ${INSTALL_DATA_DIR} ${DOCDIR} + cd ${WRKSRC}; \ + for file in reseller.txt packing.lst; do \ + ${INSTALL_DATA} $${file} ${DOCDIR}; \ + done + +post-install: + PKG_PREFIX=${PREFIX} ${SH} ${INSTALL_FILE} ${PKGNAME} POST-INSTALL + .include "../../mk/bsd.pkg.mk" diff --git a/security/uvscan-dat/distinfo b/security/uvscan-dat/distinfo index 027b9ba2af3..8d7890fd47d 100644 --- a/security/uvscan-dat/distinfo +++ b/security/uvscan-dat/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.6 2001/08/13 15:10:40 rh Exp $ +$NetBSD: distinfo,v 1.7 2001/08/16 00:01:24 jlam Exp $ -SHA1 (dat-4153.tar) = 2fa2cb2837a40dc06842d0cbe9f479b2de7cd4be -Size (dat-4153.tar) = 2222080 bytes +SHA1 (dat-4154.tar) = c3b6dd4d5a1862c084e56a36f2b755cb12e5b645 +Size (dat-4154.tar) = 2232320 bytes diff --git a/security/uvscan-dat/files/update_dat b/security/uvscan-dat/files/update_dat index 214f5f6e822..b8449a0b523 100755 --- a/security/uvscan-dat/files/update_dat +++ b/security/uvscan-dat/files/update_dat @@ -1,18 +1,77 @@ #!/bin/sh -cd @PREFIX@/libexec/uvscan/ -ftp http://download.nai.com/products/datfiles/4.x/nai/readme.txt >/dev/null -AVVER=`head -1 readme.txt | cut -d' ' -f11` -if [ ! -f dat-$AVVER.tar ]; then - for i in *.tar ; do - mv $i $i.old - done - if ftp http://download.nai.com/products/datfiles/4.x/nai/dat-$AVVER.tar >/dev/null ; then - for i in *.dat ; do - cp -p $i $i.bak - done - if tar xf dat-$AVVER.tar ; then - rm -f *.old - echo `date` Successfully updated AntiVirus DAT files to $AVVER +# +# $NetBSD: update_dat,v 1.2 2001/08/16 00:01:25 jlam Exp $ +# +# Script to update the VirusScan data files. + +UVSCANDIR=@PREFIX@/libexec/uvscan +DAT_SITE=http://download.nai.com/products/datfiles/4.x/nai/ +DAT_FILES="@DATFILES@" +TMPDIR=${TMPDIR:-/tmp}/$$ + +mkdir -p ${TMPDIR} +mkdir -p ${UVSCANDIR} +cd ${TMPDIR} + +# Fetch the ReadMe file to read the latest version of the DAT files. +if ! ( ftp ${DAT_SITE}/readme.txt >/dev/null ) +then + echo "$0: unable to fetch ${DAT_SITE}/readme.txt" + rm -rf ${TMPDIR} + exit 1 +fi + +CURVER=`head -1 readme.txt | cut -d' ' -f11` +OLDVER=`head -1 ${UVSCANDIR}/readme.txt | cut -d' ' -f11` +exitcode=0 +if [ "${CURVER}" = "${OLDVER}" ] +then + echo "$0: VirusScan DAT files are current (${CURVER})" +else + DAT_TAR=dat-${CURVER}.tar + if ftp ${DAT_SITE}/${DAT_TAR} >/dev/null + then + if tar xf ${DAT_TAR} ${DAT_FILES} + then + # Backup old dat-* tar files. + if [ "`echo ${UVSCANDIR}/*.tar`" != "${UVSCANDIR}/*.tar" ] + then + for file in ${UVSCANDIR}/*.tar + do + rm -f ${file}.old + mv ${file} ${file}.old + done + fi + + # Backup old DAT files. + for file in ${DAT_FILES} + do + file=${UVSCANDIR}/${file} + if [ -f ${file} ] + then + rm -f ${file}.bak + mv ${file} ${file}.bak + fi + done + + # Copy new DAT files into place. + for file in ${DAT_FILES} + do + cp -p ${file} ${UVSCANDIR}/${file} + done + cp -p ${DAT_TAR} ${UVSCANDIR}/${DAT_TAR} + rm -f ${UVSCANDIR}/*.old + echo `date` Successfully updated VirusScan DAT files to ${CURVER}. + else + echo "$0: unable to update VirusScan DAT files" + exitcode=1 fi + else + echo "$0: unable to fetch ${DAT_SITE}/${DAT_TAR}" + exitcode=1 fi fi + +cd / +rm -rf ${TMPDIR} +exit ${exitcode} diff --git a/security/uvscan-dat/pkg/DEINSTALL b/security/uvscan-dat/pkg/DEINSTALL new file mode 100644 index 00000000000..d57de4ec78d --- /dev/null +++ b/security/uvscan-dat/pkg/DEINSTALL @@ -0,0 +1,76 @@ +#!/bin/sh +# +# $NetBSD: DEINSTALL,v 1.1 2001/08/16 00:01:25 jlam Exp $ + +PKGNAME=$1 +STAGE=$2 + +CAT="@CAT@" +CMP="@CMP@" +RM="@RM@" +RMDIR="@RMDIR@" +TRUE="@TRUE@" + +SAMPLECONFDIR=${PKG_PREFIX}/share/uvscan +CONFDIR=${PKG_PREFIX}/libexec/uvscan +CONFFILES="@DATFILES@" + +case ${STAGE} in +DEINSTALL) + # Remove VirusScan data files if they don't differ from the + # default files. + # + for file in ${CONFFILES} + do + FILE=${CONFDIR}/${file} + BAKFILE=${CONFDIR}/${file}.bak + SAMPLEFILE=${SAMPLECONFDIR}/${file} + if ${CMP} -s ${FILE} ${SAMPLEFILE} + then + ${RM} -f ${FILE} + fi + if ${CMP} -s ${BAKFILE} ${SAMPLEFILE} + then + ${RM} -f ${BAKFILE} + fi + done + ;; + +POST-DEINSTALL) + modified_files='' + OLDFILES=`cd ${CONFDIR}; /bin/ls -1 *.bak *.old *.tar 2>/dev/null` + for file in ${CONFFILES} ${OLDFILES} + do + FILE=${CONFDIR}/${file} + if [ -f ${FILE} ] + then + modified_files="${modified_files} ${FILE}" + fi + done + + ${RMDIR} ${CONFDIR} 2>/dev/null || ${TRUE} + + if [ -n "${modified_files}" ] + then + ${CAT} << EOF +=========================================================================== +If you won't be using ${PKGNAME} any longer, you may want to remove +the following files created by the update_dat script: + +EOF + for file in ${modified_files} + do + echo " ${file}" + done + ${CAT} << EOF +=========================================================================== +EOF + fi + ;; + +*) + echo "Unexpected argument: ${STAGE}" + exit 1 + ;; +esac +exit 0 diff --git a/security/uvscan-dat/pkg/DESCR b/security/uvscan-dat/pkg/DESCR index 7196936b68c..5bf69d0094a 100644 --- a/security/uvscan-dat/pkg/DESCR +++ b/security/uvscan-dat/pkg/DESCR @@ -1,2 +1,2 @@ - This package contains the AntiVirus DAT files required for +This package contains the AntiVirus DAT files required for commercial and evaluation versions of uvscan. diff --git a/security/uvscan-dat/pkg/INSTALL b/security/uvscan-dat/pkg/INSTALL new file mode 100644 index 00000000000..92eabd96ab2 --- /dev/null +++ b/security/uvscan-dat/pkg/INSTALL @@ -0,0 +1,49 @@ +#!/bin/sh +# +# $NetBSD: INSTALL,v 1.1 2001/08/16 00:01:25 jlam Exp $ + +PKGNAME=$1 +STAGE=$2 + +CAT="@CAT@" +CP="@CP@" +MKDIR="@MKDIR@" + +SAMPLECONFDIR=${PKG_PREFIX}/share/uvscan +CONFDIR=${PKG_PREFIX}/libexec/uvscan +CONFFILES="@DATFILES@" + +case ${STAGE} in +PRE-INSTALL) + ;; + +POST-INSTALL) + ${MKDIR} ${CONFDIR} + echo "Installing VirusScan data files:" + for file in ${CONFFILES} + do + FILE=${CONFDIR}/${file} + SAMPLEFILE=${SAMPLECONFDIR}/${file} + if [ -f ${FILE} ] + then + echo " ${FILE} already exists" + else + echo " ${FILE}" + ${CP} ${SAMPLEFILE} ${FILE} + fi + done + ${CAT} << EOF + +=========================================================================== +The VirusScan data files may be updated to the latest versions from the +Network Associates Website (www.nai.com) by running the update_dat script. +=========================================================================== +EOF + ;; + +*) + echo "Unexpected argument: ${STAGE}" + exit 1 + ;; +esac +exit 0 diff --git a/security/uvscan-dat/pkg/PLIST b/security/uvscan-dat/pkg/PLIST index df9d85b5f15..686ef9d8d16 100644 --- a/security/uvscan-dat/pkg/PLIST +++ b/security/uvscan-dat/pkg/PLIST @@ -1,11 +1,11 @@ -@comment $NetBSD: PLIST,v 1.2 2000/06/27 10:18:07 rh Exp $ -libexec/uvscan/clean.dat -libexec/uvscan/internet.dat -libexec/uvscan/names.dat -libexec/uvscan/scan.dat +@comment $NetBSD: PLIST,v 1.3 2001/08/16 00:01:25 jlam Exp $ sbin/update_dat share/doc/uvscan/reseller.txt -share/doc/uvscan/readme.txt share/doc/uvscan/packing.lst -@dirrm libexec/uvscan -@dirrm share/doc/uvscan +share/uvscan/clean.dat +share/uvscan/internet.dat +share/uvscan/names.dat +share/uvscan/readme.txt +share/uvscan/scan.dat +@dirrm share/uvscan +@unexec rmdir %D/share/doc/uvscan 2>/dev/null || true -- cgit v1.2.3