~ubuntu-branches/ubuntu/intrepid/firestarter/intrepid

« back to all changes in this revision

Viewing changes to debian/firestarter.NetworkManagerDispatcher

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Le Folgoc
  • Date: 2007-05-20 12:01:00 UTC
  • Revision ID: james.westby@ubuntu.com-20070520120100-tntesrqlaux7z8dx
Tags: 1.0.3-2ubuntu2
* LP: #42759
  - debian/firestarter.NetworkManagerDispatcher: script to let NetworkManager
    start/stop the firewall when the interface goes up/down
  - debian/control: suggests network-manager
  - debian/rules: installs firestarter.NetworkManagerDispatcher to
    /etc/NetworkManager/dispatcher.d/50firestarter

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh -e
 
2
# Script to dispatch NetworkManager events
 
3
#
 
4
# Starts firestarter when NetworkManager fiddles with interfaces.
 
5
 
 
6
if [ -z "$1" ]; then
 
7
    echo "$0: called with no interface" 1>&2
 
8
    exit 1;
 
9
fi
 
10
 
 
11
# Check whether firestarter is configured or not
 
12
FS_CONFIG=/etc/firestarter/configuration
 
13
 
 
14
if [ ! -e $FS_CONFIG ]; then
 
15
    echo "$0: firestarter configuration not found" 1>&2
 
16
    exit 1;
 
17
fi
 
18
 
 
19
. $FS_CONFIG 1>&2
 
20
 
 
21
# Check whether this interface is defined as protected in firestarter config
 
22
if [ "$1" != "$IF" ]; then
 
23
    echo "$0: $1 not protected by firestarter" 1>&2
 
24
    exit 1;
 
25
fi
 
26
 
 
27
# Check the current status of firestarter
 
28
FS_STATUS=1;
 
29
if [ -e /var/lock/subsys/firestarter ] || [ -e /var/lock/firestarter ]; then
 
30
    FS_STATUS=0;
 
31
fi
 
32
 
 
33
case "$2" in
 
34
    up)
 
35
        if [ "$FS_STATUS" -gt 0 ]; then
 
36
             /etc/init.d/firestarter start;
 
37
        fi
 
38
        ;;
 
39
    down)
 
40
        if [ "$FS_STATUS" -eq 0 ]; then
 
41
             /etc/init.d/firestarter stop;
 
42
        fi
 
43
        ;;
 
44
    pre-up)
 
45
        ;;
 
46
    post-down)
 
47
        ;;
 
48
    *)
 
49
        echo "$0: called with unknown action \`$2'" 1>&2
 
50
        exit 1
 
51
        ;;
 
52
esac