[csw-devel] SF.net SVN: gar:[2508] csw/mgar/pkg/clamav/trunk

bonivart at users.sourceforge.net bonivart at users.sourceforge.net
Wed Dec 10 15:19:01 CET 2008


Revision: 2508
          http://gar.svn.sourceforge.net/gar/?rev=2508&view=rev
Author:   bonivart
Date:     2008-12-10 14:19:01 +0000 (Wed, 10 Dec 2008)

Log Message:
-----------
clamav: more fixes

Modified Paths:
--------------
    csw/mgar/pkg/clamav/trunk/Makefile
    csw/mgar/pkg/clamav/trunk/checksums
    csw/mgar/pkg/clamav/trunk/files/CSWclamav.gspec

Added Paths:
-----------
    csw/mgar/pkg/clamav/trunk/files/CSWclamav.INSTALL.clamav-milter.CSW
    csw/mgar/pkg/clamav/trunk/files/CSWclamav.README.CSW
    csw/mgar/pkg/clamav/trunk/files/CSWclamav.checkinstall
    csw/mgar/pkg/clamav/trunk/files/CSWclamav.cswclamav-milter
    csw/mgar/pkg/clamav/trunk/files/CSWclamav.cswclamd
    csw/mgar/pkg/clamav/trunk/files/CSWclamav.postinstall
    csw/mgar/pkg/clamav/trunk/files/CSWclamav.preinstall
    csw/mgar/pkg/clamav/trunk/files/CSWclamav.preremove

Modified: csw/mgar/pkg/clamav/trunk/Makefile
===================================================================
--- csw/mgar/pkg/clamav/trunk/Makefile	2008-12-09 23:09:34 UTC (rev 2507)
+++ csw/mgar/pkg/clamav/trunk/Makefile	2008-12-10 14:19:01 UTC (rev 2508)
@@ -1,15 +1,14 @@
 # clamav, Peter Bonivart
 
 # files outside /opt/csw are not included, need to fix gspec and cswproto
-# split into multiple packages: clamav, libclamav
 # put libs in lib/32?
-# add depend files
-# add rc/smf support
+# add rc/smf support. cswclassutils?
 # add pre/post scripts
-# add etc/clamav-milter
+# add etc/clamav-milter?
 # add etc/clamd?
-# add doc/README.CSW, INSTALL.clamav-milter.CSW
 # check mantis bugs
+# + add doc/README.CSW, INSTALL.clamav-milter.CSW
+# + split into multiple packages: clamav, libclamav
 # + add re for update notification
 # + add contrib
 # + add html docs and some pdf:s
@@ -28,58 +27,68 @@
   the package is an anti-virus engine available in a form of shared library.
 endef
 
-MASTER_SITES = http://freshmeat.net/redir/clamav/29355/url_tgz/
+SF_PROJ = clamav
+MASTER_SITES = $(SF_MIRRORS)
+#MASTER_SITES = http://freshmeat.net/redir/clamav/29355/url_tgz/
 DISTFILES  = $(GARNAME)-$(GARVERSION).tar.gz
-DISTFILES += $(call admfiles,CSWclamav,)
+DISTFILES += $(call admfiles,CSWclamav,checkinstall preinstall postinstall preremove)
 DISTFILES += $(call admfiles,CSWlibclamav,)
 
-PKGFILES_CSWlibclamav  = $(libdir)/.*
-PKGFILES_CSWlibclamav += $(includedir)/.*
+SPKG_DESC_CSWclamav = Clam AntiVirus
+SPKG_DESC_CSWlibclamav = Clam AntiVirus Library
 
+REQUIRED_PKGS_CSWclamav = CSWlibclamav CSWlibgmp CSWzlib CSWbzip2 CSWiconv CSWcswclassutils
+REQUIRED_PKGS_CSWlibclamav = CSWlibgmp CSWzlib CSWbzip2 CSWiconv
+
 # We define upstream file regex so we can be notifed of new upstream software release
 UFILES_REGEX = $(GARNAME)-(\d+(?:\.\d+)*).tar.gz
 
-GARCOMPILER = GCC3
-GNU_CC_HOME = /opt/csw/gcc3
+SPKG_CLASSES = none cswinitsmf
 
+#GARCOMPILER = GCC3
+
 CONFIGURE_ARGS  = $(DIRPATHS)
-CONFIGURE_ARGS += --with-user=nobody
-CONFIGURE_ARGS += --with-group=nobody
+#CONFIGURE_ARGS += --with-user=nobody
+#CONFIGURE_ARGS += --with-group=nobody
+CONFIGURE_ARGS += --disable-clamav
 CONFIGURE_ARGS += --enable-milter
-CONFIGURE_ARGS += --with-sendmail=/opt/csw/lib/sendmail
+CONFIGURE_ARGS += --with-sendmail=$(libdir)/sendmail
 CONFIGURE_ARGS += --with-dbdir=/var/opt/csw/$(GARNAME)/db
 CONFIGURE_ARGS += --localstatedir=/var/opt/csw/$(GARNAME)
 
-include gar/category.mk
+EXTRA_MERGE_EXCLUDE_FILES = .*~ $(libdir)/.*\.a $(libdir)/.*\.la
 
+PKGFILES_CSWlibclamav  = $(libdir)/.*
+PKGFILES_CSWlibclamav += $(includedir)/.*
+
 SPKG_SOURCEURL = http://www.clamav.net/
 
-pre-package:
-	@echo " ==> Pre-package for $(GARNAME)"
-	@echo "DESTDIR: $(DESTDIR)"
-	@echo "WORKSRC: $(WORKSRC)"
-	@echo "PKGROOT: $(PKGROOT)"
-	@find $(PKGROOT) -type f -name "*~" -exec rm {} \;
-	@find $(PKGROOT)/opt/csw/lib -type f -name "*.a" -exec rm {} \;
-	@find $(PKGROOT)/opt/csw/lib -type f -name "*.la" -exec rm {} \;
-	@ginstall -d $(PKGROOT)$(docdir)/$(GARNAME)/html
-	@ginstall -d $(PKGROOT)$(docdir)/$(GARNAME)/contrib
-	@ginstall -m 644 $(WORKSRC)/AUTHORS $(PKGROOT)$(docdir)/$(GARNAME)
-	@ginstall -m 644 $(WORKSRC)/BUGS $(PKGROOT)$(docdir)/$(GARNAME)
-	@ginstall -m 644 $(WORKSRC)/ChangeLog $(PKGROOT)$(docdir)/$(GARNAME)
-	@ginstall -m 644 $(WORKSRC)/docs/clamav-mirror-howto.pdf $(PKGROOT)$(docdir)/$(GARNAME)
-	@ginstall -m 644 $(WORKSRC)/docs/clamdoc.pdf $(PKGROOT)$(docdir)/$(GARNAME)
-	@ginstall -m 644 $(WORKSRC)/COPYING $(PKGROOT)$(docdir)/$(GARNAME)/LICENSE
-	@ginstall -m 644 $(WORKSRC)/FAQ $(PKGROOT)$(docdir)/$(GARNAME)
-	@ginstall -m 644 $(WORKSRC)/NEWS $(PKGROOT)$(docdir)/$(GARNAME)
-	@ginstall -m 644 $(WORKSRC)/docs/phishsigs_howto.pdf $(PKGROOT)$(docdir)/$(GARNAME)
-	@ginstall -m 644 $(WORKSRC)/README $(PKGROOT)$(docdir)/$(GARNAME)
-	@ginstall -m 644 $(WORKSRC)/docs/signatures.pdf $(PKGROOT)$(docdir)/$(GARNAME)
-	@ginstall -m 644 $(WORKSRC)/UPGRADE $(PKGROOT)$(docdir)/$(GARNAME)
-	@ginstall -m 644 $(WORKSRC)/contrib/clamdwatch/* $(PKGROOT)$(docdir)/$(GARNAME)/contrib
-	@ginstall -m 644 $(WORKSRC)/contrib/init/Solaris10/* $(PKGROOT)$(docdir)/$(GARNAME)/contrib
-	@ginstall -m 644 $(WORKSRC)/contrib/cleanup-partial.pl $(PKGROOT)$(docdir)/$(GARNAME)/contrib
-	@for file in $(WORKSRC)/docs/html/*; do \
-	   cp $$file $(PKGROOT)$(docdir)/$(GARNAME)/html ; \
-	 done
+include gar/category.mk
+
+DOCS  = AUTHORS BUGS ChangeLog
+DOCS += FAQ NEWS README UPGRADE
+DOCS += docs/clamav-mirror-howto.pdf
+DOCS += docs/clamdoc.pdf
+DOCS += docs/phishsigs_howto.pdf
+DOCS += docs/signatures.pdf
+
+DOCDEST = $(DESTDIR)$(docdir)/$(GARNAME)
+
+post-install-modulated:
+	@echo " ==> Post-install for $(GARNAME)"
+	@ginstall -d $(DESTDIR)/etc/opt/csw/init.d
+	@ginstall -m 755 $(FILEDIR)/CSWclamav.cswclamd $(DESTDIR)/etc/opt/csw/init.d/cswclamd
+	@ginstall -d $(DOCDEST)
+	@$(foreach DOC,$(DOCS),ginstall -m 644 $(WORKSRC)/$(DOC) $(DOCDEST);)
+	@ginstall -m 644 $(WORKSRC)/COPYING $(DOCDEST)/LICENSE
+	@ginstall -m 644 $(FILEDIR)/CSWclamav.INSTALL.clamav-milter.CSW $(DOCDEST)/INSTALL.clamav-milter.CSW
+	@ginstall -m 644 $(FILEDIR)/CSWclamav.README.CSW $(DOCDEST)/README.CSW
+	@ginstall -d $(DOCDEST)/contrib
+	@ginstall -m 644 $(WORKSRC)/contrib/clamdwatch/* $(DOCDEST)/contrib
+	@ginstall -m 644 $(WORKSRC)/contrib/init/Solaris10/* $(DOCDEST)/contrib
+	@ginstall -m 644 $(WORKSRC)/contrib/cleanup-partial.pl $(DOCDEST)/contrib
+	@ginstall -d $(DOCDEST)/html
+	@ginstall -m 644 $(WORKSRC)/docs/html/* $(DOCDEST)/html
+	@ginstall -d $(DESTDIR)$(docdir)/libclamav
+	@ginstall -m 644 $(WORKSRC)/COPYING $(DESTDIR)$(docdir)/libclamav/LICENSE
 	@$(MAKECOOKIE)

Modified: csw/mgar/pkg/clamav/trunk/checksums
===================================================================
--- csw/mgar/pkg/clamav/trunk/checksums	2008-12-09 23:09:34 UTC (rev 2507)
+++ csw/mgar/pkg/clamav/trunk/checksums	2008-12-10 14:19:01 UTC (rev 2508)
@@ -1,3 +1,7 @@
 1181e6d62341b84708f126cc353f7ebf  download/clamav-0.94.2.tar.gz
-df9572dc44907a1ceff3561f9b834e20  download/CSWclamav.gspec
+7d36b4328fa73af2b109169b923bc127  download/CSWclamav.gspec
+751ed376aeccb1664694b772c4b9640d  download/CSWclamav.checkinstall
+e355168073277baaf456eea620ff2760  download/CSWclamav.preinstall
+a82b60e7ee99d6a4ac6e80351ce7bf81  download/CSWclamav.postinstall
+526d5979cca3a3ebdf88c6ed33b8ec8d  download/CSWclamav.preremove
 6edc8660bde0b27d3676699eacb51884  download/CSWlibclamav.gspec

Added: csw/mgar/pkg/clamav/trunk/files/CSWclamav.INSTALL.clamav-milter.CSW
===================================================================
--- csw/mgar/pkg/clamav/trunk/files/CSWclamav.INSTALL.clamav-milter.CSW	                        (rev 0)
+++ csw/mgar/pkg/clamav/trunk/files/CSWclamav.INSTALL.clamav-milter.CSW	2008-12-10 14:19:01 UTC (rev 2508)
@@ -0,0 +1,124 @@
+INSTRUCTIONS
+
+Any references in this document made to /usr/local should be replaced with /opt/csw.  References to /etc/sysconfig should be replaced with /opt/csw/etc.
+
+Clamav is built with milter support.  For this to work, see the following notes from the INSTALL.clamav-milter document supplied with the clamav source.
+
+Solaris 8 doesn't have milter support so clamav-milter won't work unless you
+rebuild sendmail from source or install the CSW sendmail package.
+Solaris 9 has milter support in the supplied sendmail, but doesn't include
+libmilter so you can't develop milter applications on it. Go to sendmail.org,
+download the lastest sendmail, cd to libmilter and "make install" there.
+Needs -lresolv
+
+INSTALLATION
+
+See http://www.nmt.edu/~wcolburn/sendmail-8.12.5/libmilter/docs/sample.html
+
+Installations for RedHat Linux and it's derivatives such as YellowDog:
+	Add to /etc/mail/sendmail.mc:
+	INPUT_MAIL_FILTER(`clamav', `S=local:/var/run/clamav.sock, F=, T=S:4m;R:4m')dnl
+	define(`confINPUT_MAIL_FILTERS', `clamav')
+
+	Check entry in /usr/local/etc/clamav.conf of the form:
+	LocalSocket /var/run/clamd.sock
+	StreamSaveToDisk
+
+	If you already have a filter (such as spamassassin-milter from
+	http://savannah.nongnu.org/projects/spamass-milt) add it thus:
+	INPUT_MAIL_FILTER(`clamav', `S=local:/var/run/clamav.sock, F=, T=S:4m;R:4m')dnl
+	INPUT_MAIL_FILTER(`spamassassin', `S=local:/var/run/spamass.sock, F=, T=C:15m;S:4m;R:4m;E:10m')
+	define(`confINPUT_MAIL_FILTERS', `spamassassin,clamav')dnl
+
+You may find INPUT_MAIL_FILTERS is not needed on your machine, however it
+is recommended by the Sendmail documentation and I recommend going along
+with that.
+
+I suggest putting SpamAssassin first since you're more likely to get spam
+than a virus/worm sent to you.
+
+Add to /etc/sysconfig/clamav-milter
+	CLAMAV_FLAGS="--max-children=2 local:/var/run/clamav.sock"
+or if clamd is on a different machine
+	CLAMAV_FLAGS="--max-children=2 --server=192.168.1.9 local:/var/run/clamav.sock"
+
+You should have received a script to put into /etc/init.d with this software.
+
+CHANGE HISTORY
+
+Changes
+0.2:	4/3/03	clamfi_abort() now always calls pthread_mutex_unlock
+	5/3/03	Only send a bounce if -b is set
+		Version now uses -v not -V
+		--config-file couldn't be set by -c
+0.3	7/3/03	Enhanced the Solaris compile time comment
+		No need to save the return result of LogSyslog
+		Use LogVerbose
+0.4	9/3/03	Initialise dataSocket/cmdSocket correctly
+	10/3/03	Say why we don't connect() to clamd
+		Enhanced '-l' usage message
+0.5	18/3/03	Ported to FreeBSD 4.7
+		Source no longer in support, so remove one .. from
+		the build instructions
+		Corrected the use of strerror_r
+0.51	20/3/03	Mention StreamSaveToDisk in the installation
+		Added -s option which allows clamd to run on a
+		different machine from the milter
+0.52	20/3/03	-b flag now only stops the bounce, sends warning
+		to recipient and postmaster
+0.53	24/3/03	%d->%u in syslog call
+	27/3/03	tcpSocket is now of type in_port_t
+	27/3/03	Use PING/PONG
+0.54	23/5/03	Allow a range of IP addresses as outgoing ones
+		that need not be checked
+0.55	24/5/03	Use inet_ntop() instead of inet_ntoa()
+		Thanks to Krzysztof Oldzki <ole at ans.pl>
+0.60	11/7/03	Some TODOs done by Nigel Kukard <nkukard at lbsd.net>
+		Should stop a couple of remote chances of crashes
+0.60a	22/7/03	Tidied up message when sender is unknown
+0.60b	17/8/03	Optionally set postmaster address. Usually one uses
+		/etc/aliases, but not everyone want's to...
+0.60c	22/8/03	Another go at Solaris support
+0.60d	26/8/03	Removed superflous buffer and unneeded strerror call
+		ETIMEDOUT isn't an error, but should give a warning
+0.60e	09/9/03	Added -P and -q flags by "Nicholas M. Kirsch" <nick at kirsch.org>
+0.60f	17/9/03	Changed fprintf to fputs where possible
+		Redirect stdin from /dev/null, stdout&stderr to
+		/dev/console
+0.60g	26/9/03	Handle sendmail calling abort after calling cleanup
+		(Should never happen - but it does)
+		Added -noxheader patch from dirk.meyer at dinoex.sub.org
+0.60h	28/9/03	Support MaxThreads option in config file,
+		overriden by --max-children.
+		Patch from "Richard G. Roberto" <rgr at dedlegend.com>
+0.60i	30/9/03	clamfi_envfrom() now correctly returns SMFIS_TEMPFAIL,
+		in a few circumstances it used to return EX_TEMPFAIL
+		Patch from Matt Sullivan <matt at sullivan.gen.nz>
+0.60j	1/10/03	strerror_r doesn't work on Linux, attempting workaround
+		Added support for hard-coded list of email addresses
+		who's e-mail is not scanned
+0.60k	5/10/03	Only remove old UNIX domain socket if FixStaleSocket
+		is set
+0.60l	11/10/03 port is now unsigned
+		Removed remote possibility of crash if the target
+		e-mail address is very long
+		No longer calls clamdscan to get the version
+0.60m	12/10/03 Now does sanity check if using localSocket
+		Gets version info from clamd
+		Only reset fd's 0/1/2 if !ForeGround
+0.60n	22/10/03 Call pthread_cont_broadcast more often
+0.60o	31/10/03 Optionally accept all mails if scanning procedure
+		fails (Joe Talbott <josepht at cstone.net>)
+0.60p	5/11/03	Only call mutex_unlock when max_children is set
+		Tidy up the call to pthread_cond_timedwait
+0.60q	11/11/03 Fixed handling of % characters in e-mail addresses
+		pointed out by dotslash at snosoft.com
+
+BUG REPORTS
+
+Please send bug reports and/or comments to Nigel Horne <njh at despammed.com>
+
+TODO
+
+There are several ideas marked as TODO in the source code. If anyone has
+any other suggestions please feel free to contact me.

Added: csw/mgar/pkg/clamav/trunk/files/CSWclamav.README.CSW
===================================================================
--- csw/mgar/pkg/clamav/trunk/files/CSWclamav.README.CSW	                        (rev 0)
+++ csw/mgar/pkg/clamav/trunk/files/CSWclamav.README.CSW	2008-12-10 14:19:01 UTC (rev 2508)
@@ -0,0 +1,177 @@
+# 2008-12-10
+Version 0.94.2 is released. Packages CSWclamav and CSWlibclamav are now
+maintained by Peter Bonivart.
+
+# 02Jun2007
+Version 0.90.3 is released.
+Changes are made to the rc scripts to allow clmilter to not wait for clamd
+when clmilter is configured without --external.  PLEASE note that I have
+not fully tested clmilter without clamd.  If you are running Solaris 10
+or later, you will also need to create a custom version of the clamav-milter 
+service method file and remove the dependency for cswclamd.  See my notes
+below dated 05Feb2006 for instructions on creating a custom service method
+file.
+
+# 16Feb2007
+Version 0.90 is released.
+--enable-experimental is disabled due to a bug introduced after the last
+release candidate.
+
+The rc script is changed to relocate the pid file to /opt/csw/var/clamav.
+If you run clamav without root access, please run the following.
+`chown <clamav user>:<clamav group> /opt/csw/var/clamav
+The rc script is changed to allow the startup options and config file
+to be located in /etc/opt/csw
+
+*** IMPORTANT ***
+You must change clamd.conf to match the new syntax.  Boolean options must
+state yes or no and not be left blank.  I recommend renaming your old
+clamd.conf to old-clamd.conf; `cp clamd.conf.CSW clamd.conf` and making
+your changes again.  Note that the directory for the pid file and log files
+now defaults to /opt/csw/var/clamav.
+*** END OF IMPORTANT ***
+
+# 07Jan2007
+The 'specificdeamonname' for this package is changed to only clamav.
+Please change any entries that you have made in csw.conf
+The scripts determine whether or not a clamd and clamav-milter is needed.
+
+# 14Dec2006
+clamd.conf has a new option - MailMaxRecursion
+Package installation is using csw.conf, if available, to determine whether
+  or not to start the daemons.
+See http://www.blastwave.org/standards/csw.conf.html for details.
+The 'specificdaemonname' for this package is clamd and clamav-milter. 
+
+# 16Oct2006
+freshclam.conf has option OnOutdatedExecute command added.
+
+# 05Feb2006
+# IMPORTANT changes with the Feb 2006 revision to version 0.88
+# For Solaris 8 and 9:
+	If you are using clamd and/or clamav-milter, the daemons
+	are now stopped on subsequent package upgrades and started
+	with this package install.
+
+# For Solaris 10 and later:
+	SMF processing is added for clamd and clamav-milter
+	Configuration file /opt/csw/etc/clamd is used to determine
+	whether or not to run clamd.  This feature has not changed.
+	The same is true for clamav-milter, except that the relevant
+	file is /opt/csw/etc/clamav-milter.
+
+	There are two types of files used by SMF.  The service
+	method file is located in /opt/csw/lib/svc/method.  The
+        service manifest is located in /opt/csw/var/svc/manifest and
+	subdirectory application for clamav.
+
+	Service method and manifest files are provided with the package.
+        If you want to do something different, create custom files with
+        specific names and the package scripts will use them instead. 
+	If you do create custom versions of these files, please test
+	them before running pkg-get.  If there is an error in a custom
+	file, pkgadd will fail.
+
+	The custom files must be named:
+	/opt/csw/lib/svc/method/svc-clamd.custom
+	/opt/csw/lib/svc/method/svc-clamav-milter.custom
+	/opt/csw/var/svc/manifest/application/clamd.custom.xml
+	/opt/csw/var/svc/manifest/application/clamav-milter.custom.xml
+
+	You may supply custom versions of any or all of these files.
+	If there is not a custom file available and a set of files are
+	needed because a service is activated, the package scripts will
+	use the standard files installed with the package and name them
+	accordingly.
+
+	To remove the installed service defintion and replace with your
+	own, do the following (using the clamd manifest as the example).
+	Create:  /opt/csw/var/svc/manifest/application/clamd.custom.xml
+	Permissions should be 0644 root bin:
+		chown root:bin \
+		  /opt/csw/var/svc/manifest/application/clamd.custom.xml
+		chmod 0644 \
+		  /opt/csw/var/svc/manifest/application/clamd.custom.xml
+	Copy:	 cp -p /opt/csw/var/svc/manifest/application/clamd.custom.xml \
+		/opt/csw/var/svc/manifest/application/clamd.xml
+	Removal: svcadm disable cswclamd
+		 svccfg delete cswclamd
+	Install: svccfg import /opt/csw/var/svc/manifest/application/clamd.xml
+		 svcadm enable cswclamd
+
+	The supplied manifests have clamav-milter depending on clamd.
+	If you need clamav-milter, this is the recommended usage and
+	requires /opt/csw/etc/clamav-milter to define the '--external'
+	switch.
+
+	The FMRI for clamd is svc:/application/cswclamd (or cswclamd).
+	The FMRI for clamav-milter is svc/application/cswclamav-milter
+	(or cswclamav-milter).
+
+# TO DO:
+	I want to allow more flexibility with clamd and clamav-milter
+	option definition.  Currently, you are limited to what you put
+	on a single line in clamd and/or clamav-milter in /opt/csw/etc.
+	This works, but it could be more flexible and readable.  Maybe
+	next time:>
+
+
+# 27Jan2005
+# IMPORTANT changes with version 0.81
+# There are a few changes in the configuration files.  So please
+#   compare the /opt/csw/etc/*.CSW files with your working copies.
+# clamav-milter now uses libclamav by default.  This means that you
+#   do not need to have clamd running if you only use clamav-milter.
+#   The sample clamav-milter.CSW file is changed to the old behavior.
+#   You decide what you are comfortable with.  I will be running the
+#   old method until maybe the next release or until I am more familiar
+#   with this new option.
+
+# 21Sep2004
+# IMPORTANT changes with version 0.80
+# /opt/csw/etc/clamav.conf is renamed to /opt/csw/etc/clamd.conf
+#   Postinstall will do the rename, if the file exists.
+#
+# If this is the first migration to 0.80 from a previous version:
+#   YOU MUST review the changes in clamd.conf.CSW.  
+# If you have StreamSaveToDisk enabled, it must be disabled or removed.
+#
+# YOU MUST review the changes in freshclam.conf.CSW.  There are new options.
+
+# 15Jun2004
+# Please compare your configuration files with the *.CSW versions in
+     /opt/csw/etc/.  There are some minor changes to the defaults.
+     The bad symlink for /etc/rc2.d/S77cswclamd is fixed.
+     The cswclamav-milter script now removes the old socket.  Note
+     that clamd socket removal can be done by enabling the FixStaleSocket
+     option in clamav.conf.
+     There are several ways to use this pkg, i.e., with clamd, with
+     clamav-milter.  Some options need to be changed to setup an
+     environment.  Please click the 'View news and info' buttom at
+     http://www.blastwave.org/packages.php/clamav to review the setup
+     that I use to run clamd and clamav-milter with freshclam running
+     from crontab.
+
+# *** IMPORTANT ***
+1) Freshclam is no longer run as a daemon.  Please create a crontab entry
+     to run freshclam when you desire.
+2) You MUST change /opt/csw/etc/freshclam.conf as needed for your installation
+     and run freshclam before proceeding.
+3) There are different ways to run clamav.  To use clamav as a sendmail
+     milter, copy the config files clamav.conf.CSW and clamav-milter.CSW
+     in /opt/csw/etc to the same names without the .CSW.  Add the milter
+     setup to your sendmail configuration file.
+4) Change the configuration files as required for your installation.
+     The configuration files that you create are not touched when a
+     new version of clamav is installed.  Therefore remember to run
+     a diff between your version and the .CSW version, which is the
+     new version.  There could be new features added and the config
+     files are normally the way these new features are activated.
+5) Clamav should be run as a non-root user.  Change the directory 
+     /opt/csw/share/clamav and the *.cvd files in this directory to
+     be owned by this user.  Also change /opt/csw/etc/clamav.conf
+     accordingly.
+6) The startup scripts run clamd if the file /opt/csw/etc/clamd exists.
+     You can change the startup options by changing /opt/csw/etc/clamd.
+     A sample file is provided.  The same is true for clamav-milter.
+# See additional files README, FAQ, INSTALL for more information.

Added: csw/mgar/pkg/clamav/trunk/files/CSWclamav.checkinstall
===================================================================
--- csw/mgar/pkg/clamav/trunk/files/CSWclamav.checkinstall	                        (rev 0)
+++ csw/mgar/pkg/clamav/trunk/files/CSWclamav.checkinstall	2008-12-10 14:19:01 UTC (rev 2508)
@@ -0,0 +1,55 @@
+# checkinstall script for Clamav
+# Verify that group and user clamav exists
+#
+ADDUSER=0
+ADDGROUP=0
+# Next, verify that group clamav exists.
+# First check target machines group file, THEN check
+# NIS/NIS+/whatever
+
+/usr/bin/grep '^clamav:' /etc/group >/dev/null
+if [ $? -ne 0 ] ; then
+	/usr/bin/getent group clamav >/dev/null
+	if [ $? -ne 0 ] ; then
+		NEEDGROUP=1
+        fi
+fi
+
+if [ "$NEEDGROUP" = 1 ] ; then
+	echo "***"
+	echo "Group clamav must exist for this package install."
+	echo "clamav group will be added."
+	ADDGROUP=1
+else
+	echo "clamav group detected"
+fi
+# Next, verify that user clamav exists.
+# First check target machines password file, THEN check
+# NIS/NIS+/whatever
+
+/usr/bin/grep '^clamav:' /etc/passwd >/dev/null
+if [ $? -ne 0 ] ; then
+	/usr/bin/getent passwd clamav >/dev/null
+	if [ $? -ne 0 ] ; then
+		NEEDUSER=1
+        fi
+fi
+
+if [ "$NEEDUSER" = 1 ] ; then
+	echo "***"
+	echo "User clamav must exist for this package install."
+	echo "clamav user will be added."
+	ADDUSER=1
+else
+	echo "clamav user detected"
+fi
+
+# Make env variables available to other packaging scripts
+
+cat >$1 <<!
+
+ADDGROUP='$ADDGROUP'
+ADDUSER='$ADDUSER'
+!
+
+exit 0

Added: csw/mgar/pkg/clamav/trunk/files/CSWclamav.cswclamav-milter
===================================================================
--- csw/mgar/pkg/clamav/trunk/files/CSWclamav.cswclamav-milter	                        (rev 0)
+++ csw/mgar/pkg/clamav/trunk/files/CSWclamav.cswclamav-milter	2008-12-10 14:19:01 UTC (rev 2508)
@@ -0,0 +1,109 @@
+#!/bin/sh
+#
+# clamav-milter This script starts and stops the clamav-milter daemon
+#
+# description: clamav-milter is a daemon which hooks into sendmail and routes
+#              email messages to clamav
+# processname: clamav-milter
+# modified for CSW usage
+# 2007-02-16   Allow the options file to be located in /etc/opt/csw/
+# 2007-03-04   Wait up to 30 seconds for clamd to start before leaving
+#              this script.
+# 2007-06-02   Do not wait for clamd if etc/clamd does not exist.
+
+. /lib/svc/share/smf_include.sh
+
+CLAMAV_MILTER="/etc/opt/csw/clamav-milter"
+
+if [ ! -f "$CLAMAV_MILTER" ] ; then
+    CLAMAV_MILTER="/opt/csw/etc/clamav-milter"
+fi
+
+# Local clamav-milter options
+if [ -f "$CLAMAV_MILTER" ]; then
+    CLAMAV_FLAGS=`cat "$CLAMAV_MILTER"`
+fi
+
+if [ ! -f /opt/csw/sbin/clamav-milter ]; then
+    exit 0
+fi
+
+usingclamd=no
+if [ -f /opt/csw/etc/clamd ] -o [ -f /etc/opt/csw/clamd ] ; then usingclamd=yes ; fi
+
+PATH=/usr/sbin:/usr/bin:/opt/csw/sbin:/opt/csw/bin
+
+start() {
+    if [ -f /opt/csw/etc/clamav-milter ]; then
+        echo "Starting clamav-milter "
+        if /bin/test -S /opt/csw/share/clamav/clmilter.sock ; then
+            rm -f /opt/csw/share/clamav/clmilter.sock
+        fi
+        if /bin/test -S /opt/csw/var/clamav/clmilter.sock ; then
+             rm -f /opt/csw/var/clamav/clmilter.sock
+        fi
+        if /bin/test -S /var/opt/csw/clamav/clmilter.sock ; then
+             rm -f /var/opt/csw/clamav/clmilter.sock
+        fi
+	# clamd must be available
+	# but only if clamd is in use
+	if [ $usingclamd = yes ] ; then
+	    COUNT=`expr 0`
+	    clsock=`grep '^LocalSocket' /opt/csw/etc/clamd.conf |awk '{print $2;}'`
+	    while [ x = x ]
+	      do
+	      if [ "$COUNT" -eq 30 ] ; then
+		  break
+	      fi
+	      if /bin/test -S "$clsock" ; then
+		  break
+	      fi
+	      sleep 1
+	      COUNT=`expr $COUNT + 1`
+	    done
+	
+	    if [ "$COUNT" -eq 30 ] ; then
+		echo "Unable to start clamav-milter.  clamd process is not available."
+	    else
+		/opt/csw/sbin/clamav-milter ${CLAMAV_FLAGS}
+	    fi
+	else
+	    /opt/csw/sbin/clamav-milter ${CLAMAV_FLAGS}
+	fi
+    fi
+}
+
+stop() {
+        echo "Stopping clamav-milter "
+	/usr/bin/pkill clamav-milter
+        if /bin/test -S /opt/csw/share/clamav/clmilter.sock ; then
+            rm -f /opt/csw/share/clamav/clmilter.sock
+        fi
+        if /bin/test -S /var/opt/csw/clamav/clmilter.sock ; then
+             rm -f /var/opt/csw/clamav/clmilter.sock
+        fi
+        if /bin/test -S /opt/csw/var/clamav/clmilter.sock ; then
+             rm -f /opt/csw/var/clamav/clmilter.sock
+        fi
+}
+
+# See how we were called.
+case "$1" in
+  start)
+        # Start daemon.
+	start
+        ;;
+  stop)
+        # Stop daemon.
+	stop
+        ;;
+  restart|reload)
+	stop
+	start
+        ;;
+  *)
+        echo "Usage: $0 {start|stop|reload|restart}"
+        exit 1
+esac
+
+exit $?


Property changes on: csw/mgar/pkg/clamav/trunk/files/CSWclamav.cswclamav-milter
___________________________________________________________________
Added: svn:executable
   + *

Added: csw/mgar/pkg/clamav/trunk/files/CSWclamav.cswclamd
===================================================================
--- csw/mgar/pkg/clamav/trunk/files/CSWclamav.cswclamd	                        (rev 0)
+++ csw/mgar/pkg/clamav/trunk/files/CSWclamav.cswclamd	2008-12-10 14:19:01 UTC (rev 2508)
@@ -0,0 +1,86 @@
+#!/bin/sh
+#
+# clamd	  Start/Stop the clam antivirus daemon.
+#
+# description: clamd is a standard UNIX program that scans for Viruses.
+# processname: clamd
+# config: /opt/csw/etc/clamd.conf
+# pidfile: /opt/csw/share/clamav/clamd.pid
+# modified for CSW
+# 2007-02-16 Note that the pid file is now in /opt/csw/var/clamav. So, you
+#   may need to fix permissions on that directory.
+#   The clamd file (used to send options to clamd) may now be in
+#   /etc/opt/csw/.  Using this file, you may specify a different location
+#   for the config file.  For example, -c /etc/opt/csw/clamd.conf.  Put
+#   all options on one line.
+# 2007-04-14 PidFile name and User are obtained from clamd.conf.  If
+#   the directory does not exist, it is created by this script.
+# 2007-10-27 Fix restart script
+
+. /lib/svc/share/smf_include.sh
+
+prog="clamd"
+progdir="/opt/csw/sbin"
+
+pidfile=`grep '^PidFile' /opt/csw/etc/clamd.conf |awk '{print $2;}'`
+piddir=`dirname $pidfile`
+if [ ! -d $piddir ]; then
+    clamuser=`grep '^User' /opt/csw/etc/clamd.conf |awk '{print $2;}'`
+    mkdir -p $piddir
+    chown $clamuser $piddir
+fi
+
+OPTIONS_FILE="/etc/opt/csw/clamd"
+if [ ! -f $OPTIONS_FILE ] ; then
+	OPTIONS_FILE="/opt/csw/etc/clamd"
+fi
+if [ ! -f "$OPTIONS_FILE" ]; then
+    exit 0
+fi
+
+# Local clamd config
+if [ -f "$OPTIONS_FILE" ] ; then
+    CLAMD_FLAGS=`cat "$OPTIONS_FILE"`
+fi
+
+PATH=/usr/sbin:/usr/bin:/opt/csw/sbin:/opt/csw/bin
+
+start() {
+	echo "Starting $prog "
+	$progdir/$prog ${CLAMD_FLAGS}
+}
+
+stop() {
+	echo "Stopping $prog "
+	/usr/bin/kill `head -1 $pidfile`
+}
+
+restart() {
+	/usr/bin/kill `head -1 $pidfile`
+	start
+}
+
+reload() {
+	echo "Reloading clam daemon configuration: "
+	pkill -HUP $prog
+}
+
+case "$1" in
+  start)
+	start
+	;;
+  stop)
+	stop
+	;;
+  restart)
+	restart
+	;;
+  reload)
+	reload
+	;;
+  *)
+	echo $"Usage: $0 {start|stop|status|reload|restart}"
+	exit 1
+esac
+
+exit $?


Property changes on: csw/mgar/pkg/clamav/trunk/files/CSWclamav.cswclamd
___________________________________________________________________
Added: svn:executable
   + *

Modified: csw/mgar/pkg/clamav/trunk/files/CSWclamav.gspec
===================================================================
--- csw/mgar/pkg/clamav/trunk/files/CSWclamav.gspec	2008-12-09 23:09:34 UTC (rev 2507)
+++ csw/mgar/pkg/clamav/trunk/files/CSWclamav.gspec	2008-12-10 14:19:01 UTC (rev 2508)
@@ -1,6 +1,8 @@
 %var            bitname clamav
 %var            pkgname CSWclamav
 %include        url file://%{PKGLIB}/csw_dyndepend.gspec
+%prototype:merge
+f cswinitsmf    /etc/opt/csw/init.d/cswclamd 0755 root bin
 %copyright
 
 Please see /opt/csw/share/doc/clamav/copyright for license information.

Added: csw/mgar/pkg/clamav/trunk/files/CSWclamav.postinstall
===================================================================
--- csw/mgar/pkg/clamav/trunk/files/CSWclamav.postinstall	                        (rev 0)
+++ csw/mgar/pkg/clamav/trunk/files/CSWclamav.postinstall	2008-12-10 14:19:01 UTC (rev 2508)
@@ -0,0 +1,74 @@
+# Postinstall script for clamav
+# 2007-01-07 Add csw.conf support
+#   The specific daemon name is clamav
+#
+
+# If /opt/csw/etc/clamav.conf exists, move it to /opt/csw/etc/clamd.conf
+if [ -f /opt/csw/etc/clamav.conf ]; then
+        /usr/bin/mv /opt/csw/etc/clamav.conf /opt/csw/etc/clamd.conf
+	echo '  Moved /opt/csw/etc/clamav.conf to /opt/csw/etc/clamd.conf'
+fi
+
+# Determine whether or not clamd and clamav-milter is needed
+usingclamd=no
+usingclmilter=no
+if [ -f /opt/csw/etc/clamd ] -o [ -f /etc/opt/csw/clamd ] ; then usingclamd=yes ; fi
+if [ -f /opt/csw/etc/clamav-milter ] -o [ -f /etc/opt/csw/clamav-milter ] ; then usingclmilter=yes ; fi
+
+# Plug PKG_INSTALL_ROOT if not available
+if [ "$PKG_INSTALL_ROOT" = "" ] ; then PKG_INSTALL_ROOT=/ ; fi
+
+# If available, assign user for /opt/csw/share/clamav directory
+CONF_FILE="/etc/opt/csw/clamd.conf"
+if [ ! -f "$CONF_FILE" ] ; then
+        CONF_FILE="/opt/csw/etc/clamd.conf"
+        if [ ! -f "$CONF_FILE" ] ; then
+                CONF_FILE=""
+        fi
+fi
+if [ x"$CONF_FILE" != x ] ; then
+   clamuser=`grep '^User' "$CONF_FILE" |awk '{print $2;}'`
+   if [ x$clamuser != x ] ; then
+      chown $clamuser /opt/csw/share/clamav
+   fi
+fi
+
+# daemons are started by default
+enable_daemon=yes
+
+# Source csw.conf, if it exists
+if [ -f $PKG_INSTALL_ROOT/opt/csw/etc/csw.conf ] ; then
+  . $PKG_INSTALL_ROOT/opt/csw/etc/csw.conf
+fi
+if [ -f $PKG_INSTALL_ROOT/etc/opt/csw/csw.conf ] ; then
+  . $PKG_INSTALL_ROOT/etc/opt/csw/csw.conf
+fi
+
+# If defined, autoenable for the specific daemon name takes precedence
+if [ "$autoenable_clamav" = "no" ] ; then
+  enable_daemon=no
+elif [ "$autoenable_daemons" = "no" -a ! -n "$autoenable_clamav" ] ; then
+  enable_daemon=no
+fi
+
+# Start selected daemons
+if [ "$enable_daemon" = "yes" ] ; then
+
+  # clamd is first
+  if [ $usingclamd = yes ] ; then
+    if [ $smf = no ] ; then
+       /etc/init.d/cswclamd start 2>&1
+    else
+       /usr/sbin/svcadm enable svc:application/cswclamd 2>&1
+    fi
+  fi
+
+fi
+
+# Display message
+echo '***'
+echo '*** See README.CSW in /opt/csw/share/doc/clamav for changes.**'
+echo '*** For first time version 0.90 installs - Please see README.CSW.""'
+echo '*** See http://www.blastwave.org/standards/csw.conf.html for'
+echo '    details on using csw.conf to enable/disable daemons.**'
+echo '***'

Added: csw/mgar/pkg/clamav/trunk/files/CSWclamav.preinstall
===================================================================
--- csw/mgar/pkg/clamav/trunk/files/CSWclamav.preinstall	                        (rev 0)
+++ csw/mgar/pkg/clamav/trunk/files/CSWclamav.preinstall	2008-12-10 14:19:01 UTC (rev 2508)
@@ -0,0 +1,23 @@
+# preinstall for clamav
+# Add the user and group clamav if told to by checkinstall script.
+
+# If installing on a filesystem that is not running the OS, exit this script.
+if [ ! x"$PKG_INSTALL_ROOT" = x"" -a ! x"$PKG_INSTALL_ROOT" = x"/" ] ; then exit 0 ; fi
+
+if [ x"$PKG_INSTALL_ROOT" = x"" ] ; then
+    PKG_INSTALL_ROOT="/"
+fi
+
+MYHOME=/var/spool
+
+if [ "$ADDGROUP" = "1" ] ; then
+	chroot $PKG_INSTALL_ROOT /usr/sbin/groupadd clamav
+	echo "Added clamav group."
+fi
+if [ "$ADDUSER" = "1" ] ; then
+	chroot $PKG_INSTALL_ROOT /usr/sbin/useradd -g clamav clamav
+	chroot $PKG_INSTALL_ROOT /usr/sbin/usermod -c "Clamav user" -d $MYHOME -s /bin/false clamav
+	echo "Added clamav user."
+fi
+
+exit 0

Added: csw/mgar/pkg/clamav/trunk/files/CSWclamav.preremove
===================================================================
--- csw/mgar/pkg/clamav/trunk/files/CSWclamav.preremove	                        (rev 0)
+++ csw/mgar/pkg/clamav/trunk/files/CSWclamav.preremove	2008-12-10 14:19:01 UTC (rev 2508)
@@ -0,0 +1,27 @@
+# clamav - preremove script
+#
+# Stop clamav if it is running.
+
+# Determine whether or not clamd and clamav-milter is running
+haveclamd=no
+haveclmilter=no
+
+if [ -f /opt/csw/etc/clamd ] || [ -f /etc/opt/csw/clamd ] ; then haveclamd=yes ; fi
+if [ -f /opt/csw/etc/clamav-milter ] || [ -f /etc/opt/csw/clamav-milter ] ; then haveclmilter=yes ; fi
+
+# Determine whether or not SMF is available
+smf=no
+if [ -f /usr/sbin/svccfg -a -f /usr/sbin/svcadm ] ; then smf=yes ; fi
+
+  if [ $haveclamd=yes ] ; then
+    echo "Shutting down clamd"
+    if [ $smf = yes ]
+	then
+    	# Disable service
+	/usr/sbin/svcadm disable -s svc:application/cswclamd:default >/dev/null 2>&1
+    else
+	/etc/init.d/cswclamd stop >/dev/null 2>&1
+    fi
+  fi
+
+exit 0


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list