summaryrefslogtreecommitdiff
path: root/debian/ifplugd.udev.agent
blob: b90ede1c971dce60e9f08cc9d2cd3b7762eb67c1 (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
37
38
#!/bin/sh
# hotplug agent script

DAEMON_NAME=ifplugd

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

[ -x $DAEMON ] || exit 0

# for old hotplug:
#HOTPLUGFUNCS=/etc/hotplug/hotplug.functions
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

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