1 |
eras 13/09/27 16:04:14 |
2 |
|
3 |
Added: clamd.conf-r1 clamd.initd-r6 |
4 |
Log: |
5 |
Version bump - bug #485728. Use ionice in init script - bug #469484. Add database update notice for first time clamav usage - bug #483284. |
6 |
|
7 |
(Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key 0x77F1F175586A3B1F) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 app-antivirus/clamav/files/clamd.conf-r1 |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-antivirus/clamav/files/clamd.conf-r1?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-antivirus/clamav/files/clamd.conf-r1?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: clamd.conf-r1 |
16 |
=================================================================== |
17 |
# Config file for /etc/init.d/clamd |
18 |
|
19 |
START_CLAMD=yes |
20 |
START_FRESHCLAM=yes |
21 |
CLAMD_NICELEVEL=3 |
22 |
FRESHCLAM_NICELEVEL=19 |
23 |
IONICE_LEVEL=2 |
24 |
|
25 |
|
26 |
|
27 |
1.1 app-antivirus/clamav/files/clamd.initd-r6 |
28 |
|
29 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-antivirus/clamav/files/clamd.initd-r6?rev=1.1&view=markup |
30 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-antivirus/clamav/files/clamd.initd-r6?rev=1.1&content-type=text/plain |
31 |
|
32 |
Index: clamd.initd-r6 |
33 |
=================================================================== |
34 |
#!/sbin/runscript |
35 |
# Copyright 1999-2013 Gentoo Foundation |
36 |
# Distributed under the terms of the GNU General Public License v2 |
37 |
# $Header: /var/cvsroot/gentoo-x86/app-antivirus/clamav/files/clamd.initd-r6,v 1.1 2013/09/27 16:04:14 eras Exp $ |
38 |
|
39 |
daemon_clamd="/usr/sbin/clamd" |
40 |
daemon_freshclam="/usr/bin/freshclam" |
41 |
daemon_milter="/usr/sbin/clamav-milter" |
42 |
|
43 |
extra_commands="logfix" |
44 |
|
45 |
depend() { |
46 |
use net |
47 |
provide antivirus |
48 |
} |
49 |
|
50 |
get_config() { |
51 |
clamconf | sed 's/["=]//g' | \ |
52 |
awk "{ |
53 |
if(\$0==\"Config file: $1.conf\") S=1 |
54 |
if(S==1&&\$0==\"\") { |
55 |
print \"$3\" |
56 |
exit |
57 |
} |
58 |
if(S==1&&\$1~\"^$2\$\") { |
59 |
print \$2!=\"disabled\"?\$2:\"$3\" |
60 |
exit |
61 |
} |
62 |
}" |
63 |
} |
64 |
|
65 |
start() { |
66 |
# populate variables and fix log file permissions |
67 |
logfix |
68 |
|
69 |
if [ "${START_CLAMD}" = "yes" ]; then |
70 |
checkpath --quiet --mode 755 \ |
71 |
--owner "${clamd_user}":"${clamd_user}" \ |
72 |
--directory `dirname ${clamd_socket}` |
73 |
if [ -S "${clamd_socket}" ]; then |
74 |
rm -f ${clamd_socket} |
75 |
fi |
76 |
ebegin "Starting clamd" |
77 |
start-stop-daemon --start --quiet \ |
78 |
--nicelevel ${CLAMD_NICELEVEL:-0} \ |
79 |
--ionice ${IONICE_LEVEL:-0} \ |
80 |
--exec ${daemon_clamd} |
81 |
eend $? "Failed to start clamd" |
82 |
fi |
83 |
|
84 |
if [ "${START_FRESHCLAM}" = "yes" ]; then |
85 |
checkpath --quiet --mode 755 \ |
86 |
--owner "${clamd_user}":"${clamd_user}" \ |
87 |
--directory `dirname ${clamd_socket}` |
88 |
ebegin "Starting freshclam" |
89 |
start-stop-daemon --start --quiet \ |
90 |
--nicelevel ${FRESHCLAM_NICELEVEL:-0} \ |
91 |
--ionice ${IONICE_LEVEL:-0} \ |
92 |
--exec ${daemon_freshclam} -- -d |
93 |
retcode=$? |
94 |
if [ ${retcode} = 1 ]; then |
95 |
eend 0 |
96 |
einfo "Virus databases are already up to date." |
97 |
else |
98 |
eend ${retcode} "Failed to start freshclam" |
99 |
fi |
100 |
fi |
101 |
|
102 |
if [ "${START_MILTER}" = "yes" ]; then |
103 |
if [ -z "${MILTER_CONF_FILE}" ]; then |
104 |
MILTER_CONF_FILE="/etc/clamav-milter.conf" |
105 |
fi |
106 |
|
107 |
ebegin "Starting clamav-milter" |
108 |
start-stop-daemon --start --quiet \ |
109 |
--nicelevel ${MILTER_NICELEVEL:-0} \ |
110 |
--ionice ${IONICE_LEVEL:-0} \ |
111 |
--exec ${daemon_milter} -- -c ${MILTER_CONF_FILE} |
112 |
eend $? "Failed to start clamav-milter" |
113 |
fi |
114 |
} |
115 |
|
116 |
stop() { |
117 |
if [ "${START_CLAMD}" = "yes" ]; then |
118 |
ebegin "Stopping clamd" |
119 |
start-stop-daemon --stop --quiet --name clamd |
120 |
eend $? "Failed to stop clamd" |
121 |
fi |
122 |
if [ "${START_FRESHCLAM}" = "yes" ]; then |
123 |
ebegin "Stopping freshclam" |
124 |
start-stop-daemon --stop --quiet --name freshclam |
125 |
eend $? "Failed to stop freshclam" |
126 |
fi |
127 |
if [ "${START_MILTER}" = "yes" ]; then |
128 |
ebegin "Stopping clamav-milter" |
129 |
start-stop-daemon --stop --quiet --name clamav-milter |
130 |
eend $? "Failed to stop clamav-milter" |
131 |
fi |
132 |
} |
133 |
|
134 |
logfix() { |
135 |
clamd_socket=$(get_config clamd LocalSocket /run/clamav/clamd.sock) |
136 |
clamd_user=$(get_config clamd User clamav) |
137 |
freshclam_user=$(get_config freshclam DatabaseOwner clamav) |
138 |
|
139 |
if [ "${START_CLAMD}" = "yes" ]; then |
140 |
# fix clamd log permissions |
141 |
# (might be clobbered by logrotate or something) |
142 |
local logfile=$(get_config clamd LogFile) |
143 |
if [ -n "${logfile}" ]; then |
144 |
checkpath --quiet \ |
145 |
--owner "${clamd_user}":"${clamd_user}" \ |
146 |
--mode 640 \ |
147 |
--file ${logfile} |
148 |
fi |
149 |
fi |
150 |
|
151 |
if [ "${START_FRESHCLAM}" = "yes" ]; then |
152 |
# fix freshclam log permissions |
153 |
# (might be clobbered by logrotate or something) |
154 |
local logfile=$(get_config freshclam UpdateLogFile) |
155 |
if [ -n "${logfile}" ]; then |
156 |
checkpath --quiet \ |
157 |
--owner "${freshclam_user}":"${freshclam_user}" \ |
158 |
--mode 640 \ |
159 |
--file ${logfile} |
160 |
fi |
161 |
fi |
162 |
} |