ports/77495: new port: security/sav

Gary Hayers gary at hayers.net
Mon Feb 14 11:20:19 UTC 2005


>Number:         77495
>Category:       ports
>Synopsis:       new port: security/sav
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb 14 11:20:18 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Gary Hayers
>Release:        FreeBSD 4.11-STABLE i386
>Organization:
hayers.net
>Environment:
FreeBSD thor.hayers.net 4.11-STABLE FreeBSD 4.11-STABLE #18: Tue Jan 25 23:17:19 GMT 2005     root at thor.hayers.net:/usr/obj/usr/src/sys/Thor  i386
>Description:
      Submission of new port Sophos Anti Virus
>How-To-Repeat:
      
>Fix:
      # This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	sav
#	sav/pkg-install
#	sav/files
#	sav/files/300.sav-update.sh
#	sav/pkg-descr
#	sav/Makefile2
#	sav/pkg-message
#	sav/distinfo
#	sav/Makefile
#	sav/pkg-plist
#
echo c - sav
mkdir -p sav > /dev/null 2>&1
echo x - sav/pkg-install
sed 's/^X//' >sav/pkg-install << 'END-of-sav/pkg-install'
X#!/bin/sh
X
XPREFIX=${PKG_PREFIX:-%%PREFIX%%}
X
Xconfig_file=/etc/sav.conf
Xsav_install_dir=%%DATADIR%%
X
XUSER=sweep
XGROUP=sweep
X
Xif [ "$2" = "PRE-INSTALL" ]; then
Xif ! pw groupshow "$GROUP" 2>/dev/null 1>&2; then
X	if pw groupadd $GROUP; then
X		echo "=> Added group \"$GROUP\"."
X	else
X                echo "=> Adding group \"$GROUP\" failed..."
X                exit 1
X        fi
Xfi
X
Xif ! pw usershow "$USER" 2>/dev/null 1>&2; then
X        if pw useradd $USER -g $GROUP -h - \
X                -s "/sbin/nologin" -d "/nonexistent" \
X                -c "Sophos Sweep"
X        then
X                echo "=> Added user \"$USER\"."
X        else
X                echo "=> Adding user \"$USER\" failed..."
X                exit 1
X        fi
Xfi
Xfi # PRE-INSTALL
X
Xif [ "$2" = "POST-INSTALL" ]; then
Xif [ ! -e "${config_file}" ]; then
X	echo -n "=> Creating ${config_file} ... "
X	if echo "SAV virus data directory = ${sav_install_dir}" >>"${config_file}"; then
X		echo "done."
X	else
X		echo "failed."
X		echo "To complete setup, you must add the line:"
X		echo "SAV virus data directory = ${sav_install_dir}"
X		echo "to ${config_file}"
X	fi
Xelse
X	echo "=> Skipping creation of ${config_file}"
Xfi
X
X${PREFIX}/etc/periodic/daily/300.sav-update
X
Xfi # POST-INSTALL
X
Xexit 0
END-of-sav/pkg-install
echo c - sav/files
mkdir -p sav/files > /dev/null 2>&1
echo x - sav/files/300.sav-update.sh
sed 's/^X//' >sav/files/300.sav-update.sh << 'END-of-sav/files/300.sav-update.sh'
X#!/bin/sh
X#
X# $Id$
X
X# Our defaults
X#
Xdaily_sav_update_enable="YES"
Xdaily_sav_update_version="%%IDEVERSION%%"
Xdaily_sav_update_urlpat="http://downloads.sophos.com/downloads/ide/%%update_version%%_ides.zip"
Xdaily_sav_update_target="%%DATADIR%%"
Xdaily_sav_update_restarts=""
X
X# If there is a global system configuration file, suck it in.
X#
Xif [ -r /etc/defaults/periodic.conf ]
Xthen
X	. /etc/defaults/periodic.conf
X	source_periodic_confs
Xfi
X
Xset -e
X
Xcase "$daily_sav_update_enable" in
X    [Yy][Ee][Ss])
X	echo ""
X	echo "Running Sophos Antivirus updates:"
X
X	if [ "$daily_sav_update_version" -le 0 ]
X	then
X		echo '$daily_sav_update_enable is enabled but' \
X		    '$daily_sav_update_version is nonpositive'
X		rc=2
X	elif [ -z "$daily_sav_update_urlpat" ]
X	then
X		echo '$daily_sav_update_enable is enabled but' \
X		    '$daily_sav_update_urlpat is not set'
X		rc=2
X	elif [ -z "$daily_sav_update_target" ]
X	then
X		echo '$daily_sav_update_enable is enabled but' \
X		    '$daily_sav_update_target is not set'
X		rc=2
X	elif [ ! -d $daily_sav_update_target ]
X	then
X		echo '$daily_sav_update_enable is enabled but' \
X		     "$daily_sav_update_target" "doesn't exist"
X		rc=2
X	else
X		IDEURL=`echo $daily_sav_update_urlpat | sed -e "s/%%update_version%%/${daily_sav_update_version}/"`
X		UNPACK_DIR=`mktemp -d -t vdl${daily_sav_update_version}`
X		[ -t 0 ] || BE_QUIET="-q"
X
X		case "$UNPACK_DIR" in
X		    /*/vdl${daily_sav_update_version}.*)
X			echo "fetching updates for version $daily_sav_update_version from $IDEURL"
X			fetch $BE_QUIET -a -o ${UNPACK_DIR}/idefile.zip $IDEURL || exit 3
X
X			echo "unzipping IDEs and installing to $daily_sav_update_target"
X			%%LOCALBASE%%/bin/unzip $BE_QUIET ${UNPACK_DIR}/idefile.zip -d $UNPACK_DIR || exit 3
X			rm -f ${daily_sav_update_target}/*.ide || exit 3
X			install -m 444 ${UNPACK_DIR}/*.ide $daily_sav_update_target || exit 3
X
X			rm ${UNPACK_DIR}/*.ide ${UNPACK_DIR}/idefile.zip || exit 3
X			rmdir $UNPACK_DIR || exit 3
X
X			for _r in ${daily_sav_update_restarts}; do
X				${_r} restart
X			done
X			;;
X		    *)
X			echo "path sanitycheck error: mktemp gave us $UNPACK_DIR"
X			rc=0;;
X		esac
X	fi
X	;;
X
X    *)	rc=0;;
Xesac
X
Xexit $rc
END-of-sav/files/300.sav-update.sh
echo x - sav/pkg-descr
sed 's/^X//' >sav/pkg-descr << 'END-of-sav/pkg-descr'
XSophos Anti-Virus is a commercial virus scanning and disinfection
Xsystem.  Included are the InterCheck server, the Sweep commandline
Xtool, and the SAVI C library.
X
XThis port installs resources to automatically update virus definitions.
X
XWWW: http://www.sophos.com/
END-of-sav/pkg-descr
echo x - sav/Makefile2
sed 's/^X//' >sav/Makefile2 << 'END-of-sav/Makefile2'
XPORTNAME=	sav
XPORTVERSION=	unknown
XCATEGORIES=	security
XDISTNAME=	freebsd.elf
XEXTRACT_SUFX=	.tar.Z
X
XCOMMENT=	Rule-breaking makefile to support version autodetection.
XIGNOREFILES=	freebsd.elf.tar.Z
XIGNORE=		"Do not run this directly"
X
X.include <bsd.port.mk>
X
XVERSIONFILE=	${WRKDIRPREFIX}${.CURDIR}/version.inc
XDISTFILE=	${DISTDIR}/${DISTNAME}${EXTRACT_SUFX}
X
X.if exists(${DISTFILE})
X${VERSIONFILE}: ${DISTFILE}
X	@(PORTVERSION=`tar ztf "${DISTFILE}" sav-install/vdl-*.dat \
X		| sed -e 's/.*vdl-\(.*\).dat/\1/'`; \
X	 LIBVERSION=`tar ztf "${DISTFILE}" sav-install/libsavi.so.3.* \
X		| sed -e 's/.*libsavi.so.3.\(.*\)/\1/'`; \
X	 IDEVERSION=`echo $$PORTVERSION|tr -cd [:digit:]`; \
X	 [ "$$IDEVERSION" = "" ] && exit; \
X	 echo PORTVERSION=$$PORTVERSION >${VERSIONFILE}; \
X	 echo LIBVERSION=$$LIBVERSION >>${VERSIONFILE}; \
X	 echo IDEVERSION=$$IDEVERSION >>${VERSIONFILE}; \
X	 echo $$PORTVERSION)
X.else
X${VERSIONFILE}:
X
X.endif
END-of-sav/Makefile2
echo x - sav/pkg-message
sed 's/^X//' >sav/pkg-message << 'END-of-sav/pkg-message'
XPeriodic updates have been installed.  They are enabled by default.
XTo disable, you will need to add daily_sav_update_enable="NO" to
X/etc/periodic.conf.
END-of-sav/pkg-message
echo x - sav/distinfo
sed 's/^X//' >sav/distinfo << 'END-of-sav/distinfo'
XMD5 (freebsd.elf.tar.Z) = IGNORE
END-of-sav/distinfo
echo x - sav/Makefile
sed 's/^X//' >sav/Makefile << 'END-of-sav/Makefile'
X# Ports collection makefile for:	sav
X# Date created:				5 Jan 2004
X# Whom:					Joshua Goodall <joshua at roughtrade.net>
X#
X# $FreeBSD$
X#
X
XPORTNAME=	sav
XPORTVERSION=	${MAKE} -f Makefile2 "${WRKDIRPREFIX}${.CURDIR}/version.inc"
XPORTREVISION=	1
XCATEGORIES=	security
XMASTER_SITES=	# fetch manually
XDISTNAME=	freebsd.elf
XEXTRACT_SUFX=	.tar.Z
X
XMAINTAINER=	Gary at Hayers.net
XCOMMENT=	Sophos Anti-Virus system
X
XRUN_DEPENDS+=	${LOCALBASE}/bin/unzip:${PORTSDIR}/archivers/unzip
XLIB_DEPENDS+=	c.3:${PORTSDIR}/misc/compat3x
X
XMAN1=		sweep.1 icheckd.1
XMAN5=		icheckd.conf.5
X
X# Since Sophos have a single download that updates periodically (every few
X# weeks, if they stick to their published monthly schedule), this port
X# detects the supplied version using the name of the VDL (virus description)
X# file.
X#
X# As a result we have this construct to pull in PORTVERSION:
X#
X.if !exists(${WRKDIRPREFIX}${.CURDIR}/version.inc)
XPORTVERSION!=	${PORTVERSION}
X.if !exists(${WRKDIRPREFIX}${.CURDIR}/version.inc)
X.error no version.inc created
X.endif
X.else
X.include "${WRKDIRPREFIX}${.CURDIR}/version.inc"
X.endif
X
XUSE_SUBMAKE=	yes
XRESTRICTED=	"Commercial software"
XIGNOREFILES=	freebsd.elf.tar.Z
XNO_CDROM=	${RESTRICTED}
XONLY_FOR_ARCHS=	i386
XINSTALLS_SHLIB=	yes
XWRKSRC=		${WRKDIR}/sav-install
XPKGINSTALL=	${WRKDIR}/pkg-install
XNO_BUILD=	yes
X
XSED_SCRIPT=	-e 's|%%PREFIX%%|${PREFIX}|g' \
X		-e 's|%%DATADIR%%|${DATADIR}|g' \
X		-e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
X		-e 's|%%IDEVERSION%%|${IDEVERSION}|g'
X
XPLIST_SUB+=	LIBVERSION=${LIBVERSION}
X
X.include <bsd.port.pre.mk>
X
X.if !exists(${DISTDIR}/${DISTNAME}${EXTRACT_SUFX})
XECHO_MSG=/usr/bin/printf
XIGNORE=:\n\
XSAV cannot be automatically fetched due to licensing restrictions.\n\
XYou must manually obtain the \"FreeBSD version 3+ on Intel\" version\n\
Xfrom http://www.sophos.com/support/updates/ - once ${DISTFILES} has\n\
Xbeen downloaded, move it to ${DISTDIR} and then restart this build.\n
X.endif
X
Xpost-patch:
X	@${SED} ${SED_SCRIPT} ${PKGDIR}/pkg-install >${PKGINSTALL}
X	@${SED} ${SED_SCRIPT} ${FILESDIR}/300.sav-update.sh >${WRKDIR}/300.sav-update.sh
X
Xpre-install:
X	@${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
X
Xdo-install:
X	@(cd ${INSTALL_WRKSRC}; ./install.sh -d ${PREFIX} -s ${DATADIR} -so -nssi)
X	@${INSTALL_SCRIPT} -d ${PREFIX}/etc/periodic/daily
X	@${INSTALL_SCRIPT} ${WRKDIR}/300.sav-update.sh ${PREFIX}/etc/periodic/daily/300.sav-update
X
Xpost-install:
X	@${FIND} -P ${DATADIR} -not -type d 2>/dev/null | \
X		${SED} -ne 's,^${PREFIX}/,,p' | ${GREP} -v '\.ide$$' >> ${TMPPLIST}
X	@${ECHO} @dirrm ${DATADIR:S/${PREFIX}\///} >> ${TMPPLIST}
X	@${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
X
Xpost-clean:
X	@${RM} -f ${WRKDIRPREFIX}${.CURDIR}/version.inc
X
X.include <bsd.port.post.mk>
END-of-sav/Makefile
echo x - sav/pkg-plist
sed 's/^X//' >sav/pkg-plist << 'END-of-sav/pkg-plist'
Xbin/icheckd
Xbin/sweep
Xetc/periodic/daily/300.sav-update
Xlib/libsavi.so
Xlib/libsavi.so.2
Xlib/libsavi.so.3
Xlib/libsavi.so.3.%%LIBVERSION%%
X at dirrm etc/periodic/daily
X at dirrm etc/periodic
END-of-sav/pkg-plist
exit


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list