summaryrefslogtreecommitdiff
path: root/debian/ifplugd.udev.agent
blob: d632bffbd4dc0e7ef9157d3ba361582d16cfc97a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
# udev agent script

DAEMON_NAME=ifplugd

DAEMON=/usr/sbin/$DAEMON_NAME
CFG=/etc/default/$DAEMON_NAME

[ -x $DAEMON ] || exit 0

HOTPLUGFUNCS=/lib/udev/hotplug.functions

[ -f $HOTPLUGFUNCS ] || exit 1
. $HOTPLUGFUNCS
DEBUG=yes export DEBUG

[ "$INTERFACE" ] || { mesg Bad invocation: \$INTERFACE is not set ; exit 1 ; }

[ -f $CFG ] || { mesg No $DAEMON_NAME configuration file ; exit 1 ; }
. $CFG

for IF in $HOTPLUG_INTERFACES ; do
    if [ "$INTERFACE" = "$IF" -o "$IF" = "all" ] ; then
        case $ACTION in
        add|register)
            debug_mesg Invoking $DAEMON_NAME for $INTERFACE
            exec /etc/init.d/$DAEMON_NAME start $INTERFACE&
            ;;
        remove|unregister)
            debug_mesg Stopping $DAEMON_NAME for $INTERFACE
            exec /etc/init.d/$DAEMON_NAME stop $INTERFACE&
            ;;
        esac
        break
    fi
done