move socket file and pid from /var/run/clamav to /run/clamav
systemd switch [release 0.98.4-4mamba;Thu Jul 24 2014]
This commit is contained in:
parent
c7a64c1fc3
commit
bac9b0aa3f
@ -36,7 +36,7 @@ diff -Nru clamav-0.94.2.orig/etc/clamd.conf clamav-0.94.2/etc/clamd.conf
|
||||
# daemon (main thread).
|
||||
# Default: disabled
|
||||
-#PidFile /var/run/clamd.pid
|
||||
+PidFile /var/run/clamav/clamd.pid
|
||||
+PidFile /run/clamav/clamd.pid
|
||||
|
||||
# Optional path to the global temporary directory.
|
||||
# Default: system specific (usually /tmp or /var/tmp).
|
||||
@ -45,19 +45,10 @@ diff -Nru clamav-0.94.2.orig/etc/clamd.conf clamav-0.94.2/etc/clamd.conf
|
||||
# Path to a local socket file the daemon will listen on.
|
||||
# Default: disabled (must be specified by a user)
|
||||
-#LocalSocket /tmp/clamd.socket
|
||||
+LocalSocket /var/run/clamav/clamd.socket
|
||||
+LocalSocket /run/clamav/clamd.sock
|
||||
|
||||
# Sets the group ownership on the unix socket.
|
||||
# Default: disabled (the primary group of the user running clamd)
|
||||
@@ -119,7 +117,7 @@
|
||||
|
||||
# Maximum number of threads running at the same time.
|
||||
# Default: 10
|
||||
-#MaxThreads 20
|
||||
+#MaxThreads 10
|
||||
|
||||
# Waiting for data from a client socket will timeout after this time (seconds).
|
||||
# Value of 0 disables the timeout.
|
||||
@@ -162,11 +160,11 @@
|
||||
|
||||
# Follow directory symlinks.
|
@ -6,7 +6,7 @@
|
||||
# description: Clam AntiVirus Daemon is a TCP/IP or unix domain
|
||||
# socket protocol server.
|
||||
# processname: clamd
|
||||
# pidfile: /var/run/clamav/clamd.pid
|
||||
# pidfile: /run/clamav/clamd.pid
|
||||
# config: /etc/clamd.conf
|
||||
|
||||
# Source function library.
|
||||
|
10
clamav-clamd.service
Normal file
10
clamav-clamd.service
Normal file
@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=clamav daemon
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
PIDFile=/run/clamav/clamd.pid
|
||||
ExecStart=/usr/sbin/clamd -c /etc/clamd.conf
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -5,7 +5,7 @@
|
||||
# chkconfig: 2345 80 30
|
||||
# description: Clam AntiVirus Database Update Daemon.
|
||||
# processname: freshclamd
|
||||
# pidfile: /var/run/clamav/freshclam.pid
|
||||
# pidfile: /run/clamav/freshclam.pid
|
||||
# config: /etc/freshclam.conf
|
||||
# config: /etc/clamd.conf
|
||||
|
||||
@ -14,17 +14,14 @@
|
||||
|
||||
NAME=freshclam
|
||||
DAEMON=/usr/bin/$NAME
|
||||
DAEMONPID=/var/run/clamav/$NAME.pid
|
||||
DAEMONPID=/run/clamav/$NAME.pid
|
||||
DAEMONCONF=/etc/freshclam.conf
|
||||
OPTIONS="--config-file=$DAEMONCONF --quiet --daemon --pid=/var/run/clamav/freshclam.pid"
|
||||
OPTIONS="--config-file=$DAEMONCONF --quiet --daemon --pid=/run/clamav/freshclam.pid"
|
||||
|
||||
CLAMVDCONF=/etc/clamd.conf
|
||||
|
||||
[ -x $DAEMON ] || exit 0
|
||||
|
||||
# Source networking configuration.
|
||||
[ -r /etc/sysconfig/network ] && . /etc/sysconfig/network
|
||||
|
||||
[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
|
||||
|
||||
# check if the clamv conf file is present
|
||||
|
10
clamav-freshclamd.service
Normal file
10
clamav-freshclamd.service
Normal file
@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=clamav updater
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
PIDFile=/run/clamav/freshclam.pid
|
||||
ExecStart=/usr/bin/freshclam -d -p /run/clamav/freshclam.pid
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
95
clamav.spec
95
clamav.spec
@ -7,7 +7,7 @@
|
||||
|
||||
Name: clamav
|
||||
Version: 0.98.4
|
||||
Release: 3mamba
|
||||
Release: 4mamba
|
||||
Summary: Clam AntiVirus is a GPL anti-virus toolkit for UNIX
|
||||
Group: Applications/Security
|
||||
Vendor: openmamba
|
||||
@ -21,7 +21,9 @@ Source2: %{name}-clamd.logrotate
|
||||
Source3: %{name}-freshclam.initscript
|
||||
Source4: %{name}-freshclam.logrotate
|
||||
#Source5: http://db.local.clamav.net/daily.cvd
|
||||
Patch: %{name}-0.98-config.patch
|
||||
Source6: clamav-clamd.service
|
||||
Source7: clamav-freshclamd.service
|
||||
Patch0: %{name}-0.98.4-config.patch
|
||||
Patch1: %{name}-0.98-freshclam_config.patch
|
||||
License: GPL
|
||||
## AUTOBUILDREQ-BEGIN
|
||||
@ -83,7 +85,7 @@ This package contains the static %{libname} library and its header files.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch -p1
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
#cp %{SOURCE5} database/daily.cvd
|
||||
|
||||
@ -103,13 +105,10 @@ install -d %{buildroot}%{_var}/log/%{name}
|
||||
touch %{buildroot}%{_var}/log/%{name}/clamd.log
|
||||
touch %{buildroot}%{_var}/log/%{name}/freshclam.log
|
||||
|
||||
# pid file stuff
|
||||
install -d %{buildroot}%{_var}/run/%{name}
|
||||
|
||||
# install needed initscripts and logrotate files
|
||||
install -D -m755 %{S:1} %{buildroot}%{_initrddir}/clamd
|
||||
#install -D -m755 %{S:1} %{buildroot}%{_initrddir}/clamd
|
||||
install -D -m644 %{S:2} %{buildroot}%{_sysconfdir}/logrotate.d/clamd
|
||||
install -D -m755 %{S:3} %{buildroot}%{_initrddir}/freshclam
|
||||
#install -D -m755 %{S:3} %{buildroot}%{_initrddir}/freshclam
|
||||
install -D -m644 %{S:4} %{buildroot}%{_sysconfdir}/logrotate.d/freshclam
|
||||
|
||||
install -d %{buildroot}%{_var}/lib/%{name}
|
||||
@ -117,6 +116,15 @@ install -d %{buildroot}%{_var}/lib/%{name}
|
||||
mv %{buildroot}%{_sysconfdir}/clamd.conf.sample %{buildroot}%{_sysconfdir}/clamd.conf
|
||||
mv %{buildroot}%{_sysconfdir}/freshclam.conf.sample %{buildroot}%{_sysconfdir}/freshclam.conf
|
||||
|
||||
install -d %{buildroot}%{_unitdir}
|
||||
install -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/clamd.service
|
||||
install -m 0644 %{SOURCE7} %{buildroot}%{_unitdir}/freshclamd.service
|
||||
|
||||
install -d %{buildroot}%{_prefix}/lib/tmpfiles.d
|
||||
cat > %{buildroot}%{_prefix}/lib/tmpfiles.d/clamav.conf << _EOF
|
||||
d /run/clamav 711 %{clamav_usr} %{clamav_grp}
|
||||
_EOF
|
||||
|
||||
%clean
|
||||
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
|
||||
|
||||
@ -124,61 +132,56 @@ mv %{buildroot}%{_sysconfdir}/freshclam.conf.sample %{buildroot}%{_sysconfdir}/f
|
||||
/usr/sbin/groupadd %{clamav_grp} -g %{clamav_gid} &>/dev/null
|
||||
/usr/sbin/useradd %{clamav_usr} -c "Clam AntiVirus" -s /bin/false \
|
||||
-u %{clamav_uid} -g %{clamav_grp} &>/dev/null
|
||||
exit 0
|
||||
:
|
||||
|
||||
%post
|
||||
if [ $1 -eq 1 ]; then
|
||||
# new install
|
||||
/sbin/chkconfig --add freshclam
|
||||
/sbin/service freshclam start
|
||||
fi
|
||||
if [ $1 -ge 1 ]; then
|
||||
systemctl -q daemon-reload
|
||||
systemd-tmpfiles --create clamav.conf
|
||||
systemctl -q enable freshclamd
|
||||
systemctl -q start freshclamd
|
||||
elif [ $1 -ge 1 ]; then
|
||||
systemctl -q daemon-reload
|
||||
systemd-tmpfiles --create clamav.conf
|
||||
systemctl -q try-restart freshclamd
|
||||
# remove /0 file created by error in initscript
|
||||
[ -e /0 ] && rm -f /0
|
||||
fi
|
||||
exit 0
|
||||
|
||||
%postun
|
||||
if [ $1 -eq 1 ]; then
|
||||
# update
|
||||
/sbin/service freshclam condrestart
|
||||
fi
|
||||
exit 0
|
||||
:
|
||||
|
||||
%preun
|
||||
if [ $1 -eq 0 ]; then
|
||||
# erase
|
||||
service freshclam stop
|
||||
/sbin/chkconfig --del freshclam
|
||||
systemctl -q stop freshclamd
|
||||
systemctl -q disable freshclamd
|
||||
/usr/sbin/userdel %{clamav_usr} 2>/dev/null
|
||||
fi
|
||||
exit 0
|
||||
:
|
||||
|
||||
%post -n clamd
|
||||
if [ $1 -eq 1 ]; then
|
||||
# new install
|
||||
/sbin/chkconfig --add clamd
|
||||
/sbin/service freshclam start
|
||||
#[ -x %{_bindir}/freshclam ] && %{_bindir}/freshclam
|
||||
systemctl -q daemon-reload
|
||||
systemd-tmpfiles --create clamav.conf
|
||||
systemctl -q enable clamd
|
||||
systemctl -q start freshclamd
|
||||
sleep 5
|
||||
/sbin/service clamd start
|
||||
systemctl -q start clamd
|
||||
elif [ $1 -gt 1 ]; then
|
||||
systemctl -q daemon-reload
|
||||
systemd-tmpfiles --create clamav.conf
|
||||
systemctl -q try-restart clamd
|
||||
fi
|
||||
exit 0
|
||||
|
||||
%postun -n clamd
|
||||
if [ $1 -eq 1 ]; then
|
||||
# update
|
||||
/sbin/service clamd condrestart
|
||||
fi
|
||||
exit 0
|
||||
:
|
||||
|
||||
%preun -n clamd
|
||||
if [ $1 -eq 0 ]; then
|
||||
# erase
|
||||
/sbin/service clamd stop
|
||||
/sbin/chkconfig --del clamd
|
||||
systemctl -q stop clamd
|
||||
systemctl -q disable clamd
|
||||
fi
|
||||
exit 0
|
||||
:
|
||||
|
||||
%post -n %{libname} -p /sbin/ldconfig
|
||||
%postun -n %{libname} -p /sbin/ldconfig
|
||||
@ -193,15 +196,14 @@ exit 0
|
||||
%{_bindir}/freshclam
|
||||
%{_bindir}/sigtool
|
||||
#%{_datadir}/clamav/*.cvd
|
||||
%{_initrddir}/freshclam
|
||||
%config(noreplace) %{_sysconfdir}/clamd.conf
|
||||
%config(noreplace) %{_sysconfdir}/freshclam.conf
|
||||
%config(noreplace) %{_sysconfdir}/logrotate.d/freshclam
|
||||
%{_prefix}/lib/tmpfiles.d/clamav.conf
|
||||
%{_unitdir}/freshclamd.service
|
||||
%dir %attr(0755,%{clamav_usr},%{clamav_grp}) %{_var}/lib/%{name}
|
||||
#%ghost %{_var}/lib/%{name}/daily.cvd
|
||||
#%ghost %{_var}/lib/%{name}/mani.cvd
|
||||
%dir %attr(0755,%{clamav_usr},%{clamav_grp}) %{_var}/log/%{name}
|
||||
%dir %attr(0755,%{clamav_usr},%{clamav_grp}) %{_var}/run/%{name}
|
||||
%ghost %attr(0644,%{clamav_usr},%{clamav_grp}) %{_var}/log/%{name}/freshclam.log
|
||||
%{_mandir}/man1/clamconf.*
|
||||
%{_mandir}/man1/clamdscan.*
|
||||
@ -218,10 +220,11 @@ exit 0
|
||||
|
||||
%files -n clamd
|
||||
%defattr(-,root,root)
|
||||
%config(noreplace) %{_sysconfdir}/clamd.conf
|
||||
%config(noreplace) %{_sysconfdir}/logrotate.d/clamd
|
||||
%{_sbindir}/clamd
|
||||
%{_bindir}/clamdtop
|
||||
%{_initrddir}/clamd
|
||||
%config(noreplace) %{_sysconfdir}/logrotate.d/clamd
|
||||
%{_unitdir}/clamd.service
|
||||
%ghost %attr(0644,%{clamav_usr},%{clamav_grp}) %{_var}/log/%{name}/clamd.log
|
||||
%{_mandir}/man1/clamdtop.*
|
||||
%{_mandir}/man8/clamd.*
|
||||
@ -241,6 +244,10 @@ exit 0
|
||||
%doc BUGS ChangeLog NEWS README
|
||||
|
||||
%changelog
|
||||
* Thu Jul 24 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 0.98.4-4mamba
|
||||
- move socket file and pid from /var/run/clamav to /run/clamav
|
||||
- systemd switch
|
||||
|
||||
* Thu Jul 24 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 0.98.4-3mamba
|
||||
- rebuilt with correct dbdir (--with-dbdir=%{_localstatedir}/lib/clamav/)
|
||||
- make /var/lib/clamav world readable to work with amavis
|
||||
|
Loading…
Reference in New Issue
Block a user