summaryrefslogtreecommitdiff
path: root/debian/hotplug
blob: ada0b50bf8e742f36c3bc643bbe55e8c1094f1ab (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
39
40
41
42
43
44
45
#!/bin/sh
# hotplug agent script

DAEMON_NAME=ifplugd

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

[ -x $DAEMON ] || exit 0

HOTPLUGFUNCS=/etc/hotplug/hotplug.functions
[ -f $HOTPLUGFUNCS ] || exit 1
. $HOTPLUGFUNCS
DEBUG=yes export DEBUG

[ "$INTERFACE" ] || { mesg Bad invocation: \$INTERFACE is not set ; exit 1 ; }
case "$INTERFACE" in
	# ath* is for Atheros devices using the madwifi driver
	# pan* is for the Affix Bluetooth stack
	eth*|wlan*|ath*|pan*)
		:
		;;
	*)
		exit 0
		;;
esac

[ -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
			/etc/init.d/$DAEMON_NAME start $INTERFACE
			break
		fi
	done
	;;
remove|unregister)
	debug_mesg Stopping $DAEMON_NAME for $INTERFACE
	/etc/init.d/$DAEMON_NAME stop $INTERFACE
	;;
esac