#!/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