Merge branch 'el6' into el5
Conflicts: .gitignore clamav.spec clamd-wrapper sources
This commit is contained in:
commit
98d8227630
5
.gitignore
vendored
5
.gitignore
vendored
@ -1 +1,6 @@
|
||||
<<<<<<< HEAD
|
||||
clamav-0.95.1-norar.tar.bz2
|
||||
=======
|
||||
clamav-0.95.3-norar.tar.bz2
|
||||
/clamav-0.97-clean.tar.bz2
|
||||
>>>>>>> el6
|
||||
|
@ -1,11 +0,0 @@
|
||||
--- clamav-0.91.2/clamd/dazukoio_compat12.c.open 2007-03-06 14:38:06.000000000 +0100
|
||||
+++ clamav-0.91.2/clamd/dazukoio_compat12.c 2007-08-25 12:36:30.000000000 +0200
|
||||
@@ -89,7 +89,7 @@ int dazukoRegister_TS_compat12(struct da
|
||||
if (dazuko->device < 0)
|
||||
{
|
||||
|
||||
- dazuko->device = open("/dev/dazuko", 0);
|
||||
+ dazuko->device = open("/dev/dazuko", O_RDONLY);
|
||||
if (dazuko->device < 0)
|
||||
return -1;
|
||||
|
@ -1,29 +0,0 @@
|
||||
--- clamav-0.92/libclamav.pc.in.private
|
||||
+++ clamav-0.92/libclamav.pc.in
|
||||
@@ -6,6 +6,6 @@ includedir=@includedir@
|
||||
Name: libclamav
|
||||
Description: A GPL virus scanner
|
||||
Version: @LIBCLAMAV_VERSION@
|
||||
-Libs: -L${libdir} -lclamav @LIBCLAMAV_LIBS@
|
||||
-Cflags: -I${includedir} @CFLAGS@
|
||||
-
|
||||
+Libs: -L${libdir} -lclamav
|
||||
+Libs.private: -L${libdir} -lclamav @LIBCLAMAV_LIBS@
|
||||
+Cflags: -I${includedir}
|
||||
--- clamav-0.92/clamav-config.in.private
|
||||
+++ clamav-0.92/clamav-config.in
|
||||
@@ -54,12 +54,8 @@ while test $# -gt 0; do
|
||||
usage 0
|
||||
;;
|
||||
|
||||
- --cflags)
|
||||
- echo -I@includedir@ @CFLAGS@
|
||||
- ;;
|
||||
-
|
||||
- --libs)
|
||||
- echo -L@libdir@ @LIBCLAMAV_LIBS@
|
||||
+ (--cflags|--libs)
|
||||
+ ${PKG_CONFIG:-pkg-config} "$1" libclamav
|
||||
;;
|
||||
|
||||
*)
|
@ -1,13 +0,0 @@
|
||||
Index: clamav-0.95rc1/shared/optparser.c
|
||||
===================================================================
|
||||
--- clamav-0.95rc1.orig/shared/optparser.c
|
||||
+++ clamav-0.95rc1/shared/optparser.c
|
||||
@@ -211,7 +211,7 @@ const struct clam_option clam_options[]
|
||||
|
||||
{ "ExitOnOOM", NULL, 0, TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMD, "Stop the daemon when libclamav reports an out of memory condition.", "yes" },
|
||||
|
||||
- { "Foreground", NULL, 0, TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMD | OPT_FRESHCLAM | OPT_MILTER, "Don't fork into background.", "no" },
|
||||
+ { "Foreground", "nofork", 0, TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMD | OPT_FRESHCLAM | OPT_MILTER, "Don't fork into background.", "no" },
|
||||
|
||||
{ "Debug", NULL, 0, TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMD | OPT_FRESHCLAM, "Enable debug messages in libclamav.", "no" },
|
||||
|
@ -1,39 +0,0 @@
|
||||
Index: clamav-0.95rc1/clamav-milter/clamav-milter.c
|
||||
===================================================================
|
||||
--- clamav-0.95rc1.orig/clamav-milter/clamav-milter.c
|
||||
+++ clamav-0.95rc1/clamav-milter/clamav-milter.c
|
||||
@@ -287,7 +287,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
if((opt = optget(opts, "PidFile"))->enabled) {
|
||||
FILE *fd;
|
||||
- mode_t old_umask = umask(0006);
|
||||
+ mode_t old_umask = umask(0022);
|
||||
|
||||
if((fd = fopen(opt->strarg, "w")) == NULL) {
|
||||
logg("!Can't save PID in file %s\n", opt->strarg);
|
||||
Index: clamav-0.95rc1/shared/output.c
|
||||
===================================================================
|
||||
--- clamav-0.95rc1.orig/shared/output.c
|
||||
+++ clamav-0.95rc1/shared/output.c
|
||||
@@ -250,7 +250,7 @@ int logg(const char *str, ...)
|
||||
#endif
|
||||
if(logg_file) {
|
||||
if(!logg_fp) {
|
||||
- old_umask = umask(0037);
|
||||
+ old_umask = umask(0077);
|
||||
if((logg_fp = fopen(logg_file, "at")) == NULL) {
|
||||
umask(old_umask);
|
||||
#ifdef CL_THREAD_SAFE
|
||||
Index: clamav-0.95rc1/freshclam/freshclam.c
|
||||
===================================================================
|
||||
--- clamav-0.95rc1.orig/freshclam/freshclam.c
|
||||
+++ clamav-0.95rc1/freshclam/freshclam.c
|
||||
@@ -102,7 +102,7 @@ static void writepid(const char *pidfile
|
||||
{
|
||||
FILE *fd;
|
||||
int old_umask;
|
||||
- old_umask = umask(0006);
|
||||
+ old_umask = umask(0022);
|
||||
if((fd = fopen(pidfile, "w")) == NULL) {
|
||||
logg("!Can't save PID to file %s: %s\n", pidfile, strerror(errno));
|
||||
} else {
|
BIN
clamav-0.97-clean.tar.bz2
Normal file
BIN
clamav-0.97-clean.tar.bz2
Normal file
Binary file not shown.
58
clamav-milter.init
Normal file
58
clamav-milter.init
Normal file
@ -0,0 +1,58 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Startup script for the Clamav Milter Daemon
|
||||
#
|
||||
# chkconfig: 2345 77 23
|
||||
# description: clamav-milter is a daemon which hooks into sendmail \
|
||||
# and routes email messages to clamav.
|
||||
# processname: clamav-milter
|
||||
# pidfile: /var/run/clamav/clamav-milter.pid
|
||||
# config: /etc/sysconfig/clamav-milter
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
# Source networking configuration.
|
||||
. /etc/sysconfig/network
|
||||
|
||||
[ -x /usr/sbin/clamav-milter ] || exit 0
|
||||
|
||||
# Local clamav-milter config
|
||||
CLAMAV_FLAGS=
|
||||
test -f /etc/sysconfig/clamav-milter && . /etc/sysconfig/clamav-milter
|
||||
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting Clamav Milter Daemon: "
|
||||
daemon clamav-milter $CLAMAV_FLAGS $SOCKET_ADDRESS
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/clamav-milter
|
||||
;;
|
||||
stop)
|
||||
echo -n "Stopping Clamav Milter Daemon: "
|
||||
killproc clamav-milter
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/clamav-milter
|
||||
;;
|
||||
status)
|
||||
status clamav-milter
|
||||
RETVAL=$?
|
||||
;;
|
||||
restart|reload)
|
||||
$0 stop
|
||||
$0 start
|
||||
RETVAL=$?
|
||||
;;
|
||||
condrestart)
|
||||
[ -e /var/lock/subsys/clamd ] && restart
|
||||
RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
echo "Usage: clamav-milter {start|stop|status|restart|reload|condrestart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
@ -1,103 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# clamav-milter This script starts and stops the clamav-milter daemon
|
||||
#
|
||||
# chkconfig: - 79 40
|
||||
#
|
||||
# description: clamav-milter is a daemon which hooks into sendmail and routes \
|
||||
# email messages for virus scanning with ClamAV
|
||||
# processname: clamav-milter
|
||||
# pidfile: /var/lock/subsys/clamav-milter
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
# Source networking configuration.
|
||||
. /etc/sysconfig/network
|
||||
|
||||
# Local clamav-milter config
|
||||
CLAMAV_FLAGS=
|
||||
test -f /etc/sysconfig/clamav-milter && . /etc/sysconfig/clamav-milter
|
||||
|
||||
# Check that networking is up.
|
||||
[ ${NETWORKING} = "no" ] && exit 0
|
||||
|
||||
PATH=$PATH:/usr/bin:/usr/local/sbin:/usr/local/bin
|
||||
|
||||
RETVAL=0
|
||||
|
||||
# Clamav-milter must have write access to the pid file, /var/run is not suitable
|
||||
default_pidfile=
|
||||
[ -d /var/run/clamav-milter ] && default_pidfile=/var/run/clamav-milter/clamav-milter.pid
|
||||
[ -d /var/clamav ] && default_pidfile=/var/clamav/clamav-milter.pid
|
||||
pidfile=${PIDFILE:-$default_pidfile}
|
||||
|
||||
lockfile=/var/lock/subsys/clamav-milter
|
||||
|
||||
start() {
|
||||
echo -n "Starting clamav-milter: "
|
||||
# Don't allow files larger than 25M to be created, to limit DoS
|
||||
# Needs to be large enough to extract the signature files
|
||||
ulimit -f 25600
|
||||
if [ ! -z $pidfile ]; then
|
||||
CLAMAV_PID=--pidfile=${pidfile}
|
||||
PID=`pidofproc -p ${pidfile} clamav-milter`
|
||||
else
|
||||
CLAMAV_PID=
|
||||
PID=`pidofproc clamav-milter`
|
||||
fi
|
||||
[ -n "$PID" ] && echo " already running!" && return 1
|
||||
LANG= daemon clamav-milter $CLAMAV_PID ${CLAMAV_FLAGS}
|
||||
RETVAL=$?
|
||||
[ ! -z $pidfile -a -f $pidfile ] && sed -i -e 's/-//' $pidfile
|
||||
echo
|
||||
test $RETVAL -eq 0 && touch ${lockfile}
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n "Shutting down clamav-milter: "
|
||||
if [ ! -z $pidfile ]; then
|
||||
killproc -p ${pidfile} clamav-milter
|
||||
else
|
||||
killproc clamav-milter
|
||||
fi
|
||||
RETVAL=$?
|
||||
echo
|
||||
test $RETVAL -eq 0 && rm -f ${lockfile} ${pidfile}
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
# Start daemon.
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
# Stop daemon.
|
||||
stop
|
||||
;;
|
||||
restart|reload)
|
||||
restart
|
||||
;;
|
||||
condrestart)
|
||||
test -f ${lockfile} && restart || :
|
||||
;;
|
||||
status)
|
||||
if [ ! -z $pidfile ]; then
|
||||
status -p ${pidfile} clamav-milter
|
||||
else
|
||||
status clamav-milter
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|reload|restart|condrestart|status}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
@ -1,38 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
# Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Usage: clamav-notify-servers
|
||||
|
||||
CFGFILE=/etc/sysconfig/clamav-servers
|
||||
BASE=/var/lock/subsys/clamd.
|
||||
INITRDDIR=/etc/init.d
|
||||
|
||||
ok=1
|
||||
|
||||
f=/usr/sbin/clamav-notify-servers.local
|
||||
test ! -e "$f" || . "$f"
|
||||
|
||||
for i in ${BASE}*; do
|
||||
test -e "$i" || continue
|
||||
|
||||
srv=${INITRDDIR}/clamd.${i##${BASE}}
|
||||
test -e "$srv" || continue
|
||||
|
||||
"$srv" reload || ok=
|
||||
done >/dev/null
|
||||
|
||||
test "$ok"
|
@ -1,6 +0,0 @@
|
||||
## Adjust this line...
|
||||
MAILTO=root,postmaster,webmaster,clamav
|
||||
|
||||
## It is ok to execute it as root; freshclam drops privileges and becomes
|
||||
## user 'clamav' as soon as possible
|
||||
0 */3 * * * root /usr/share/clamav/freshclam-sleep
|
@ -1,4 +0,0 @@
|
||||
/var/log/freshclam.log {
|
||||
monthly
|
||||
notifempty
|
||||
}
|
58
clamav.init
Executable file
58
clamav.init
Executable file
@ -0,0 +1,58 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Startup script for the Clam AntiVirus Daemon
|
||||
#
|
||||
# chkconfig: 2345 61 39
|
||||
# description: Clam AntiVirus Daemon is a TCP/IP or socket protocol \
|
||||
# server.
|
||||
# processname: clamd
|
||||
# pidfile: /var/run/clamav/clamd.pid
|
||||
# config: /etc/clamav.conf
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
# Source networking configuration.
|
||||
. /etc/sysconfig/network
|
||||
|
||||
[ -x /usr/sbin/clamd ] || exit 0
|
||||
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting Clam AntiVirus Daemon: "
|
||||
daemon clamd
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/clamd
|
||||
;;
|
||||
stop)
|
||||
echo -n "Stopping Clam AntiVirus Daemon: "
|
||||
killproc clamd
|
||||
rm -f /var/clamav/clamd.socket
|
||||
rm -f /var/run/clamav/clamav.pid
|
||||
RETVAL=$?
|
||||
echo
|
||||
### heres the fix... we gotta remove the stale files on restart
|
||||
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/clamd
|
||||
;;
|
||||
status)
|
||||
status clamd
|
||||
RETVAL=$?
|
||||
;;
|
||||
restart|reload)
|
||||
$0 stop
|
||||
$0 start
|
||||
RETVAL=$?
|
||||
;;
|
||||
condrestart)
|
||||
[ -e /var/lock/subsys/clamd ] && restart
|
||||
RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
echo "Usage: clamd {start|stop|status|restart|reload|condrestart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
||||
|
1382
clamav.spec
1382
clamav.spec
File diff suppressed because it is too large
Load Diff
58
clamd-README
58
clamd-README
@ -1,58 +0,0 @@
|
||||
To create individual clamd-instance take the following files and
|
||||
modify/copy them in the suggested way:
|
||||
|
||||
clamd.conf:
|
||||
* set LogFile, PidFile, LocalSocket and User to suitable values
|
||||
* place this file into /etc/clamd.d with an unique service-name;
|
||||
e.g. as /etc/clamd.d/<SERVICE>.conf
|
||||
|
||||
To make logfile rotation work properly, the LogFile should be
|
||||
writable for the assigned User. Recommended way to reach this, is
|
||||
to:
|
||||
* make it owned by the User's *group*
|
||||
* assign at least 0620 (u+rw,g+w) permissions
|
||||
|
||||
A suitable command might be
|
||||
| # touch <logfile>
|
||||
| # chgrp <user> <logfile>
|
||||
| # chmod 0620 <logfile>
|
||||
|
||||
NEVER use 'clamav' as the user since he can modify the database.
|
||||
This is the user who is running the application; e.g. for mimedefang
|
||||
(http://www.roaringpenguin.com/mimedefang), the user might be
|
||||
'defang'.Theoretically, distinct users could be used, but it must be
|
||||
made sure that the application-user can write into the socket-file,
|
||||
and that the clamd-user can access the files asked by the
|
||||
application to be checked.
|
||||
|
||||
|
||||
clamd.logrotate:
|
||||
* set the correct value for the logfile
|
||||
* place it into /etc/logrotate.d
|
||||
|
||||
clamd.sysconfig:
|
||||
* set the name of the config-file and the local socket
|
||||
* copy it to /etc/sysconfig/clamd.<SERVICE>
|
||||
|
||||
clamd.init:
|
||||
* set the service-name
|
||||
* place it into /etc/init.d/ with an unique name and activate it
|
||||
(e.g. with /sbin/chkconfig clamd.<SERVICE> on)
|
||||
|
||||
Additionally, a symlink must be set to clamd in a way like
|
||||
| # ln -s clamd /usr/sbin/clamd.<SERVICE>
|
||||
and the directory for the socket file must be created (see 'LocalSocket'
|
||||
in clamd.conf)
|
||||
| # mkdir -p /var/run/clamd.<SERVICE>
|
||||
|
||||
|
||||
This directory must be writable by the 'User' chosen in the config-file.
|
||||
|
||||
|
||||
|
||||
[Disclaimer:
|
||||
this file and the script/configfiles are not part of the official
|
||||
clamav package.
|
||||
|
||||
Please send complaints and comments to
|
||||
mailto:enrico.scholz@informatik.tu-chemnitz.de!]
|
269
clamd-gen
269
clamd-gen
@ -1,269 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
# Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
function showHelp()
|
||||
{
|
||||
echo \
|
||||
$"Usage: clamd-gen --service=<SERVICE> --version=<VERSION> --release=<RELEASE>
|
||||
--license=<LICENSE> --username=>USERNAME>
|
||||
"
|
||||
exit 0
|
||||
}
|
||||
|
||||
function rpm.generatePreamble()
|
||||
{
|
||||
cat <<EOF
|
||||
%{!?release_func:%define release_func() %1%{?dist}}
|
||||
# The name of the minit service
|
||||
%define minitsvcdir %minitdir/services/%name
|
||||
# The configuration file for the SysV initservice
|
||||
%define conffile %_sysconfdir/clamd.d/%service.conf
|
||||
# The directory, where the milter socket will be placed into; this
|
||||
# socket will be named clamd.sock
|
||||
%define rundir /var/run/clamd.%service
|
||||
# The name of the logfile
|
||||
%define logfile /var/log/clamd.%service
|
||||
# The user under whose id, the clamd shall be running. This user must
|
||||
# be able to read the files from the base-service and is usually
|
||||
# created there.
|
||||
%define username $USERNAME
|
||||
# The packagename of the service
|
||||
%define service $SERVICE
|
||||
# The service name as used by the system's initscripts; usually this
|
||||
# is %service
|
||||
%define baseservice %service
|
||||
|
||||
%define __chkconfig /sbin/chkconfig
|
||||
%define minitdir %_sysconfdir/minit
|
||||
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
function rpm.generateHeader()
|
||||
{
|
||||
cat <<EOF
|
||||
Summary: Clamav server for '%service'
|
||||
Name: clamd.%service
|
||||
Version: $VERSION
|
||||
Release: %release_func $RELEASE
|
||||
Epoch: 0
|
||||
License: $LICENSE
|
||||
Group: System Environment/Daemons
|
||||
BuildRoot: %_tmppath/%name-%version-%release-root
|
||||
BuildArch: noarch
|
||||
Requires: init(%name)
|
||||
Requires(pre): %service
|
||||
Requires: clamav-server
|
||||
BuildRequires: clamav-devel
|
||||
|
||||
%package sysv
|
||||
Summary: SysV initscripts for a %service clamav-server
|
||||
Group: System Environment/Daemons
|
||||
Provides: init(%name) = sysv
|
||||
Conflicts: init(%name) < sysv
|
||||
Conflicts: init(%name) > sysv
|
||||
Requires: clamav-server-sysv
|
||||
Requires(post): %name = %epoch:%version-%release
|
||||
Requires(post): diffutils mktemp %__chkconfig
|
||||
Requires(preun): %__chkconfig
|
||||
Requires(pre): %_initrddir
|
||||
Requires(postun): %_initrddir
|
||||
|
||||
%package minit
|
||||
Summary: minit initscripts for a %service clamav-server
|
||||
Group: System Environment/Daemons
|
||||
Provides: init(%name) = minit
|
||||
Conflicts: init(%name) < minit
|
||||
Conflicts: init(%name) > minit
|
||||
Requires(post): %name = %epoch:%version-%release
|
||||
Requires(post): diffutils mktemp
|
||||
Requires(pre): minit-setup
|
||||
Requires(postun): minit-setup
|
||||
Requires(triggers): minit-tools
|
||||
|
||||
|
||||
%description
|
||||
Basic setup for a clamav server for '%service'.
|
||||
|
||||
|
||||
%description sysv
|
||||
Basic setup for a clamav server for '%service'.
|
||||
|
||||
This package contains initscripts for SysV based systems.
|
||||
|
||||
|
||||
%description minit
|
||||
Basic setup for a clamav server for '%service'.
|
||||
|
||||
This package contains initscripts for minit based systems.
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
function rpm.genBody()
|
||||
{
|
||||
cat <<"XEOFX"
|
||||
%prep
|
||||
%build
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
%__install -d -m755 $RPM_BUILD_ROOT{%minitsvcdir,%_sbindir,%rundir,/var/log}
|
||||
|
||||
d=/usr/share/clamav/template
|
||||
|
||||
function subst
|
||||
{
|
||||
src=$d/$1
|
||||
dst=$RPM_BUILD_ROOT$2
|
||||
|
||||
%__install -d -m755 $(dirname "$dst")
|
||||
sed -e 's!^\(#?LogFile \).*!\1%logfile!g;
|
||||
s!^#?\(LocalSocket \).*!\1%rundir/clamd.sock!g;
|
||||
s!^#?\(PidFile \).*!\1%rundir/clamd.pid!g;
|
||||
s!<SERVICE>!%service!g;
|
||||
s!<USER>!%username!g;' "$src" >"$dst"
|
||||
chmod --reference "$src" "$dst"
|
||||
}
|
||||
|
||||
subst clamd.conf %conffile
|
||||
subst clamd.logrotate %_sysconfdir/logrotate.d/clamd.%service
|
||||
|
||||
%if 0%{!?_without_sysv:1}
|
||||
subst clamd.sysconfig %_sysconfdir/sysconfig/clamd.%service
|
||||
subst clamd.init %_initrddir/clamd.%service
|
||||
%endif
|
||||
|
||||
ln -s clamd $RPM_BUILD_ROOT%_sbindir/clamd.%service
|
||||
|
||||
touch $RPM_BUILD_ROOT%logfile
|
||||
touch $RPM_BUILD_ROOT%rundir/clamd.sock
|
||||
|
||||
%if 0%{!?_without_minit:1}
|
||||
ln -s %_sbindir/clamd.%service $RPM_BUILD_ROOT%minitsvcdir/run
|
||||
touch $RPM_BUILD_ROOT%minitsvcdir/respawn
|
||||
cat <<EOF >$RPM_BUILD_ROOT%minitsvcdir/params
|
||||
-c
|
||||
%conffile
|
||||
EOF
|
||||
%endif
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
|
||||
%triggerin minit -- %baseservice
|
||||
minit-svc add services/clamd.%service services/%baseservice/
|
||||
|
||||
%triggerun minit -- %baseservice
|
||||
test "$1" != 0 -a "$2" != 0 || \
|
||||
minit-svc del services/clamd.%service services/%baseservice/
|
||||
|
||||
|
||||
%post minit
|
||||
d=$(mktemp /tmp/clamd.%service.XXXXXX)
|
||||
sed -e 's!^#Foreground!Foreground!' "%conffile" >"$d"
|
||||
grep -q '^Foreground' $d || echo 'Foreground' >>$d
|
||||
cmp -s "$d" %conffile || cat "$d" >"%conffile"
|
||||
rm -f "$d"
|
||||
|
||||
%post sysv
|
||||
d=$(mktemp /tmp/clamd.%service.XXXXXX)
|
||||
sed -e 's!^Foreground!#Foreground!' "%conffile" >"$d"
|
||||
cmp -s "$d" %conffile || cat "$d" >"%conffile"
|
||||
rm -f "$d"
|
||||
|
||||
%__chkconfig --add %name
|
||||
|
||||
|
||||
%preun sysv
|
||||
test "$1" != 0 || %__chkconfig --del %name
|
||||
|
||||
XEOFX
|
||||
}
|
||||
|
||||
|
||||
function rpm.genFiles
|
||||
{
|
||||
cat <<"EOF"
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc
|
||||
%config(noreplace) %verify(not size md5 mtime) %attr(0620,root,%username) %logfile
|
||||
%config(noreplace) %verify(not mtime) %conffile
|
||||
%config(noreplace) %verify(not mtime) %_sysconfdir/logrotate.d/clamd.%service
|
||||
%_sbindir/clamd.%service
|
||||
%dir %attr(0700,%username,root) %rundir
|
||||
%ghost %rundir/clamd.sock
|
||||
|
||||
|
||||
%if 0%{!?_without_sysv:1}
|
||||
%files sysv
|
||||
%defattr(-,root,root,-)
|
||||
%config %verify(not mtime) %_initrddir/clamd.%service
|
||||
%config(noreplace) %verify(not mtime) %_sysconfdir/sysconfig/clamd.%service
|
||||
%endif
|
||||
|
||||
|
||||
%if 0%{!?_without_minit:1}
|
||||
%files minit
|
||||
%defattr(-,root,root,-)
|
||||
%dir %minitsvcdir
|
||||
%config(noreplace) %verify(not mtime) %minitsvcdir/params
|
||||
%config %minitsvcdir/run
|
||||
%minitsvcdir/respawn
|
||||
%endif
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
SERVICE=
|
||||
VERSION=
|
||||
RELEASE=
|
||||
LICENSE=
|
||||
USERNAME=
|
||||
tmp=$(getopt -o '' --long service:,version:,release:,license:,username:,help -n "$0" -- "$@") || exit 1
|
||||
eval set -- "$tmp"
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
(--help) showHelp $0;;
|
||||
(--service) SERVICE=$2; shift;;
|
||||
(--version) VERSION=$2; shift;;
|
||||
(--release) RELEASE=$2; shift;;
|
||||
(--license) LICENSE=$2; shift;;
|
||||
(--username) USERNAME=$2; shift;;
|
||||
(--) shift; break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
for i in SERVICE VERSION RELEASE LICENSE USERNAME; do
|
||||
eval tmp=\$${i}
|
||||
test "$tmp" || {
|
||||
echo $"No value for $i specified; assuming @${i}@" >&2;
|
||||
eval $i=@${i}@;
|
||||
}
|
||||
done
|
||||
|
||||
|
||||
rpm.generatePreamble
|
||||
rpm.generateHeader
|
||||
rpm.genBody
|
||||
rpm.genFiles
|
@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# chkconfig: - 75 25
|
||||
# description: The clamd server running for <SERVICE>
|
||||
|
||||
CLAMD_SERVICE=<SERVICE>
|
||||
. /usr/share/clamav/clamd-wrapper
|
@ -1,9 +0,0 @@
|
||||
/var/log/clamd.<SERVICE> {
|
||||
monthly
|
||||
notifempty
|
||||
missingok
|
||||
|
||||
postrotate
|
||||
killall -HUP clamd.<SERVICE> 2>/dev/null || :
|
||||
endscript
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
#CLAMD_CONFIGFILE=/etc/clamd.d/<SERVICE>.conf
|
||||
#CLAMD_SOCKET=/var/run/clamd.<SERVICE>/clamd.sock
|
||||
#CLAMD_OPTIONS=
|
@ -1,57 +0,0 @@
|
||||
#! /bin/bash
|
||||
# Copyright (C) 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
FRESHCLAM_MOD=$[ 3*60 ] # 3 hours
|
||||
|
||||
f=/etc/sysconfig/freshclam
|
||||
test ! -e "$f" || . "$f"
|
||||
|
||||
|
||||
case x"$1" in
|
||||
(xnow) FRESHCLAM_DELAY=0;;
|
||||
(x|xrandom) : ${FRESHCLAM_DELAY:=$[ 0x`hostid` ]};;
|
||||
(*) FRESHCLAM_DELAY=$1;;
|
||||
esac
|
||||
|
||||
set -e
|
||||
|
||||
case $FRESHCLAM_DELAY in
|
||||
(disabled-warn)
|
||||
echo $"\
|
||||
WARNING: update of clamav database is disabled; please see
|
||||
'$f'
|
||||
for information how to enable the periodic update resp. how to turn
|
||||
off this message." >&2
|
||||
exit 1
|
||||
;;
|
||||
|
||||
(disabled)
|
||||
exit 0
|
||||
;;
|
||||
|
||||
(*)
|
||||
let FRESHCLAM_MOD*=60
|
||||
sleep $[ (FRESHCLAM_DELAY % FRESHCLAM_MOD + FRESHCLAM_MOD) % FRESHCLAM_MOD ]
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
/usr/bin/freshclam --quiet && {
|
||||
test -x /usr/sbin/clamav-notify-servers && \
|
||||
exec /usr/sbin/clamav-notify-servers || \
|
||||
:
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
## When changing the periodicity of freshclam runs in the crontab,
|
||||
## this value must be adjusted also. Its value is the timespan between
|
||||
## two subsequent freshclam runs in minutes. E.g. for the default
|
||||
##
|
||||
## | 0 */3 * * * ...
|
||||
##
|
||||
## crontab line, the value is 180 (minutes).
|
||||
# FRESHCLAM_MOD=
|
||||
|
||||
## A predefined value for the delay in seconds. By default, the value is
|
||||
## calculated by the 'hostid' program. This predefined value guarantees
|
||||
## constant timespans of 3 hours between two subsequent freshclam runs.
|
||||
##
|
||||
## This option accepts two special values:
|
||||
## 'disabled-warn' ... disables the automatic freshclam update and
|
||||
## gives out a warning
|
||||
## 'disabled' ... disables the automatic freshclam silently
|
||||
# FRESHCLAM_DELAY=
|
||||
|
||||
|
||||
### !!!!! REMOVE ME !!!!!!
|
||||
### REMOVE ME: By default, the freshclam update is disabled to avoid
|
||||
### REMOVE ME: network access without prior activation
|
||||
FRESHCLAM_DELAY=disabled-warn # REMOVE ME
|
Loading…
Reference in New Issue
Block a user