~ubuntu-branches/ubuntu/raring/clamav/raring

« back to all changes in this revision

Viewing changes to debian/clamav-freshclam-ifupdown

  • Committer: Bazaar Package Importer
  • Author(s): Stephen Gran
  • Date: 2008-09-05 17:25:34 UTC
  • mto: (0.35.3 sid)
  • mto: This revision was merged to the branch mainline in revision 51.
  • Revision ID: james.westby@ubuntu.com-20080905172534-2lxrdzafr26tqfkx
Tags: 0.94.dfsg-1
* New upstream version (closes: #497662, #497773)
  - lots of new options for clamd.conf
  - fixes CVEs CVE-2008-3912, CVE-2008-3913, CVE-2008-3914, and
    CVE-2008-1389
* No longer supports --unzip option, so typo is gone (closes: #496276)
* Translations:
  - sv (thanks Martin Bagge <brother@bsnet.se>) (closes: #491760)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# 2004-01-25, Thomas Lamy <thomas.lamy@in-online.net>
 
3
# From Magnus Ekdahl's <magnus@debian.org> clamav-freshclam-handledaemon(8)
 
4
 
 
5
set -e
 
6
 
 
7
[ -e /var/lib/clamav/interface ] || exit 0
 
8
 
 
9
INIT=/etc/init.d/clamav-freshclam
 
10
CLAMAV_CONF_FILE=/etc/clamav/clamd.conf
 
11
FRESHCLAM_CONF_FILE=/etc/clamav/freshclam.conf
 
12
 
 
13
INTERNETIFACE=`cat /var/lib/clamav/interface`
 
14
 
 
15
if grep -q freshclam /proc/*/stat 2>/dev/null; then
 
16
  IS_RUNNING=true
 
17
else
 
18
  IS_RUNNING=false
 
19
fi
 
20
 
 
21
# $IFACE is set by ifup/down, $PPP_IFACE by pppd 
 
22
[ -n "$PPP_IFACE" ] && IFACE=$PPP_IFACE
 
23
 
 
24
# This is sloppy - woody's pppd exports variables, while sid's passes them as 
 
25
# arguments and exports them.
 
26
 
 
27
if [ "$1" = "$IFACE" ]; then # We're called by sid's pppd
 
28
  shift 6                    # and we already know the interface
 
29
fi                           # Dump the arguments passed.
 
30
 
 
31
if [ -z "$1" ]; then
 
32
  case $(dirname "$0") in
 
33
    */if-up.d|*/ip-up.d)
 
34
    # Short circuit and exit early if freshclam is already running
 
35
    [ "$IS_RUNNING" = 'true' ] && exit 0
 
36
    for interface in $INTERNETIFACE; do
 
37
      if [ "$interface" = "$IFACE" ]; then
 
38
        FMODE=start
 
39
        break
 
40
      else
 
41
        FMODE=skip
 
42
      fi
 
43
    done
 
44
    ;;
 
45
    */if-down.d|*/ip-down.d)
 
46
    # Short circuit and exit early if freshclam is not already running
 
47
    [ "$IS_RUNNING" = 'false' ] && exit 0
 
48
    for interface in $INTERNETIFACE; do
 
49
      if [ "$interface" = "$IFACE" ]; then
 
50
        FMODE=stop
 
51
        break
 
52
      else
 
53
        FMODE=skip
 
54
      fi
 
55
    done
 
56
    ;;
 
57
    *)
 
58
    FMODE=skip
 
59
    ;;
 
60
  esac
 
61
else
 
62
  FMODE="$1"
 
63
fi
 
64
 
 
65
case "$FMODE" in
 
66
  start|stop)
 
67
  IFACE="$IFACE" $INIT $FMODE
 
68
  ;;
 
69
  skip)
 
70
  ;;
 
71
  *)
 
72
  echo "Usage: $0 {start|stop|skip}" >&2
 
73
  exit 1
 
74
  ;;
 
75
esac
 
76
 
 
77
exit 0
 
78