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 [ -f "$FRESHCLAMCONF" ]; then
15
for variable in `egrep -v '^[[:space:]]*(#|$)' "$FRESHCLAMCONF" | awk '{print $1}'`; do
16
value=`grep ^$variable $FRESHCLAMCONF | head -n1 | sed -e s/$variable\ *//`
17
if ! [ "$value" = "$variable" -o "$value" = "" ]; then
18
export "$variable"="$value"
20
export "$variable"="true"
25
# Only show note if mirrors.txt is changed
27
if [ -e /var/lib/clamav/mirrors.txt ]; then
28
OLD_SUM=26d0b72130f60bce6e687d8a6eef93b7
29
NEW_SUM=`md5sum /var/lib/clamav/mirrors.txt | awk '{print $1}'`
30
if ! [ "$OLD_SUM" = "$NEW_SUM" ]; then
31
db_input high clamav-freshclam/mirrors.txt-note || true
35
# Set debconf values from config file
37
if [ -f /var/lib/clamav/interface ]; then
38
Interface=`cat /var/lib/clamav/interface`
40
if [ -n "$Interface" ]; then
41
db_set clamav-freshclam/autoupdate_freshclam ifup.d || true
43
if [ -n "$Interface" ]; then
44
db_set clamav-freshclam/internet_interface "$Interface" || true
46
if [ -n "$DatabaseMirror" ]; then
47
db_set clamav-freshclam/mirrors "$DatabaseMirror" || true
49
if [ -n "$HTTPProxyServer" ]; then
50
db_set clamav-freshclam/http_proxy "$HTTPProxyServer:$HTTPProxyPort" || true
52
if [ -n "$HTTPProxyUsername" ]; then
53
db_set clamav-freshclam/proxy_user "$HTTPProxyUsername:$HTTPProxyPassword" || true
55
if [ -n "$Checks" ]; then
56
db_set clamav-freshclam/update_interval "$Checks" || true
58
if [ -n "$NotifyClamd" ]; then
59
db_set clamav-freshclam/NotifyClamd "$NotifyClamd" || true
66
STATE="autoupdate_freshclam"
69
Stateautoupdate_freshclam()
71
db_input medium clamav-freshclam/autoupdate_freshclam || true
73
db_metaget clamav-freshclam/autoupdate_freshclam value || true
74
if [ "$RET" = "ifup.d" ]; then
75
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/mirrors || true
99
STATE="autoupdate_freshclam"
101
db_metaget clamav-freshclam/mirrors value || true
102
if [ -z "$RET" ]; then
103
db_set clamav-freshclam/mirrors 'database.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