Drop clamd@scann.service file, change /var/run to /run
This commit is contained in:
parent
a36b088446
commit
7513dffb61
21
clamav.spec
21
clamav.spec
@ -1,7 +1,7 @@
|
||||
Name: clamav
|
||||
Summary: End-user tools for the Clam Antivirus scanner
|
||||
Version: 0.101.4
|
||||
Release: 5
|
||||
Release: 6
|
||||
License: GPLv2
|
||||
URL: https://www.clamav.net/
|
||||
Source0: https://www.clamav.net/downloads/production/clamav-%version.tar.gz
|
||||
@ -10,7 +10,6 @@ Source2: clamd.logrotate
|
||||
Source3: main-58.cvd
|
||||
Source4: daily-25550.cvd
|
||||
Source5: bytecode-330.cvd
|
||||
Source6: clamd-gen
|
||||
Source7: freshclam-sleep
|
||||
Source8: freshclam.sysconfig
|
||||
Source9: clamav-update.crond
|
||||
@ -153,8 +152,8 @@ install -d libclamunrar{,_iface}
|
||||
touch libclamunrar/{Makefile.in,all,install}
|
||||
|
||||
sed -ri -e 's!^#?(LogFile ).*!#\1/var/log/clamd.<SERVICE>!g' \
|
||||
-e 's!^#?(LocalSocket ).*!#\1/var/run/clamd.<SERVICE>/clamd.sock!g' \
|
||||
-e 's!^(#?PidFile ).*!\1/var/run/clamd.<SERVICE>/clamd.pid!g' \
|
||||
-e 's!^#?(LocalSocket ).*!#\1%{_rundir}/clamd.<SERVICE>/clamd.sock!g' \
|
||||
-e 's!^(#?PidFile ).*!\1%{_rundir}/clamd.<SERVICE>/clamd.pid!g' \
|
||||
-e 's!^#?(User ).*!\1<USER>!g' \
|
||||
-e 's!^#?(AllowSupplementaryGroups|LogSyslog).*!\1 yes!g' \
|
||||
-e 's! /usr/local/share/clamav,! %_var/lib/clamav,!g' etc/clamd.conf.sample
|
||||
@ -215,7 +214,6 @@ install -D -m 0644 -p %SOURCE5 $RPM_BUILD_ROOT%_var/lib/clamav/bytecode.cvd
|
||||
install -D -m 0644 -p %SOURCE1 _doc_server/clamd.sysconfig
|
||||
install -D -m 0644 -p %SOURCE2 _doc_server/clamd.logrotate
|
||||
install -D -m 0644 -p etc/clamd.conf.sample _doc_server/clamd.conf
|
||||
install -m 0755 -p %SOURCE6 $RPM_BUILD_ROOT%_datadir/%name/
|
||||
install -D -p _doc_server/* $RPM_BUILD_ROOT%_datadir/%name/template
|
||||
install -D -p -m 0644 %SOURCE15 $RPM_BUILD_ROOT%_unitdir/clamd@.service
|
||||
install -D -m 0644 -p %SOURCE10 $RPM_BUILD_ROOT%_sysconfdir/logrotate.d/clamav-update
|
||||
@ -237,7 +235,6 @@ sed -e 's!<SERVICE>!scan!g;s!<USER>!clamscan!g' \
|
||||
etc/clamd.conf.sample > $RPM_BUILD_ROOT%_sysconfdir/clamd.d/scan.conf
|
||||
|
||||
install -D -p -m 0644 %SOURCE13 $RPM_BUILD_ROOT%_sysconfdir/init/clamd.scan.conf
|
||||
install -D -p -m 0644 %SOURCE14 $RPM_BUILD_ROOT%_unitdir/clamd@scan.service
|
||||
|
||||
cat << EOF > $RPM_BUILD_ROOT%_tmpfilesdir/clamd.scan.conf
|
||||
d %_rundir/clamd.scan 0710 clamscan virusgroup
|
||||
@ -287,16 +284,15 @@ usermod clamscan -a -G virusgroup
|
||||
exit 0
|
||||
|
||||
%post -n clamd
|
||||
%systemd_post clamd@.service
|
||||
[ -L /etc/systemd/system/multi-user.target.wants/clamd@scan.service ] &&
|
||||
ln -sf /usr/lib/systemd/system/clamd@.service /etc/systemd/system/multi-user.target.wants/clamd@scan.service || :
|
||||
%systemd_post clamd@scan.service
|
||||
/bin/systemd-tmpfiles --create %_tmpfilesdir/clamd.scan.conf || :
|
||||
|
||||
%preun -n clamd
|
||||
%systemd_preun clamd@.service
|
||||
%systemd_preun clamd@scan.service
|
||||
|
||||
%postun -n clamd
|
||||
%systemd_postun_with_restart clamd@.service
|
||||
%systemd_postun_with_restart clamd@scan.service
|
||||
|
||||
%post update
|
||||
@ -352,7 +348,7 @@ test -e %_var/log/clamav-milter.log || {
|
||||
%files devel
|
||||
%_includedir/*
|
||||
%_libdir/*.so
|
||||
%_datadir/%name/{template,clamd-gen}
|
||||
%_datadir/%name/template
|
||||
%_libdir/pkgconfig/*
|
||||
%_bindir/clamav-config
|
||||
|
||||
@ -388,7 +384,7 @@ test -e %_var/log/clamav-milter.log || {
|
||||
%files -n clamd
|
||||
%doc _doc_server/*
|
||||
%_sbindir/clamd
|
||||
%_unitdir/clamd@{scan,}.service
|
||||
%_unitdir/clamd@.service
|
||||
|
||||
%config(noreplace) %_sysconfdir/clamd.d/scan.conf
|
||||
%ghost %_rundir/clamd.scan/clamd.sock
|
||||
@ -408,6 +404,9 @@ test -e %_var/log/clamav-milter.log || {
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Sep 21 2020 chengzihan <chengzihan2@huawei.com> - 0.101.4-6
|
||||
- Drop clamd@scann.service file, change /var/run to /run
|
||||
|
||||
* Thu Mar 12 2020 wutao <wutao61@huawei.com> - 0.101.4-5
|
||||
- Type:N/A
|
||||
- ID:N/A
|
||||
|
||||
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
|
||||
Loading…
x
Reference in New Issue
Block a user