3
# Source debconf library
4
. /usr/share/debconf/confmodule
6
# This conf script is capable of backing up
12
FRESHCLAMCONF='/etc/clamav/freshclam.conf'
14
if [ -n "$http_proxy" ];then
15
db_set clamav-freshclam/http_proxy "$http_proxy" || true
20
slurp_config "$FRESHCLAMCONF"
22
# Only show note if mirrors.txt is changed
24
if [ -e /var/lib/clamav/mirrors.txt ]; then
25
OLD_SUM=26d0b72130f60bce6e687d8a6eef93b7
26
NEW_SUM=`md5sum /var/lib/clamav/mirrors.txt | awk '{print $1}'`
27
if ! [ "$OLD_SUM" = "$NEW_SUM" ]; then
28
db_input high clamav-freshclam/mirrors.txt-note || true
32
# Set debconf values from config file
34
[ -f /var/lib/clamav/interface ] && Interface=`cat /var/lib/clamav/interface`
35
if [ -n "$Interface" ]; then
36
db_set clamav-freshclam/autoupdate_freshclam ifup.d || true
38
if [ -n "$Interface" ]; then
39
db_set clamav-freshclam/internet_interface "$Interface" || true
41
if [ -n "$DatabaseMirror" ]; then
42
if [ -e /usr/share/doc/clamav-freshclam/mirror-list.gz ]; then
43
if zgrep -q "$DatabaseMirror" /usr/share/doc/clamav-freshclam/mirror-list.gz;then
44
db_set clamav-freshclam/local_mirror `zgrep "$DatabaseMirror" /usr/share/doc/clamav-freshclam/mirror-list.gz` || true
46
db_set clamav-freshclam/local_mirror "$DatabaseMirror" || true
50
if [ -n "$HTTPProxyServer" ]; then
51
db_set clamav-freshclam/http_proxy "http://$HTTPProxyServer:$HTTPProxyPort/" || true
53
if [ -n "$HTTPProxyUsername" ]; then
54
db_set clamav-freshclam/proxy_user "$HTTPProxyUsername:$HTTPProxyPassword" || true
56
if [ -n "$Checks" ]; then
57
db_set clamav-freshclam/update_interval "$Checks" || true
59
if [ -n "$NotifyClamd" ]; then
60
db_set clamav-freshclam/NotifyClamd "$NotifyClamd" || true
67
STATE="autoupdate_freshclam"
70
Stateautoupdate_freshclam()
72
db_input medium clamav-freshclam/autoupdate_freshclam || true
74
db_metaget clamav-freshclam/autoupdate_freshclam value || true
75
if [ "$RET" = "ifup.d" ]; then
76
STATE="internet_interface"
85
Stateinternet_interface()
87
db_input high clamav-freshclam/internet_interface || true
91
STATE="autoupdate_freshclam"
97
db_input medium clamav-freshclam/local_mirror || true
99
STATE="autoupdate_freshclam"
101
db_metaget clamav-freshclam/local_mirror value || true
102
if [ -z "$RET" ]; then
103
db_set clamav-freshclam/local_mirror 'db.local.clamav.net' || true
112
db_input medium clamav-freshclam/http_proxy || true
116
db_metaget clamav-freshclam/http_proxy value || true
117
if [ -z "$RET" ]; then
118
STATE="update_interval"
127
db_input medium clamav-freshclam/proxy_user || true
131
STATE="update_interval"
135
Stateupdate_interval()
137
db_input low clamav-freshclam/update_interval || true
141
db_metaget clamav-freshclam/update_interval value || true
142
if [ -z "$RET" ]; then
143
db_set clamav-freshclam/update_interval 12 || true
145
STATE="notify_daemon"
151
db_input medium clamav-freshclam/NotifyClamd || true
153
STATE="update_interval"
159
# This is the statemachine that controls execution. All the 'real' work is
160
# performed by subfunctions above.
163
while [ "$STATE" != "End" ]; do
168
autoupdate_freshclam)
169
Stateautoupdate_freshclam
181
Stateinternet_interface