• Bug#267007: Working waproamd.hotplug script with ifrename support. (att

    From Karl Hegbloom@1:229/2 to All on Fri Aug 20 11:30:11 2004
    From: [email protected]

    Here's a working (debugged and tested) set of scripts for 'waproamd'.
    The identical changes work for 'ifplugd' as well, of course.


    #!/bin/sh
    # hotplug agent script

    DAEMON_NAME=waproamd

    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
    eth*|wlan*|ath*) # ath* is for Atheros devices using the madwifi driver
    :
    ;;
    *)
    exit 0
    ;;
    esac

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

    ORIGINTERFACE=$INTERFACE

    case $ACTION in
    add|register)
    if [ -x /sbin/ifrename ] && [ -r /etc/iftab ]; then
    debug_mesg invoke ifrename for $INTERFACE
    NEWNAME=`/sbin/ifrename -i $INTERFACE`
    if [ -n "$NEWNAME" ]; then
    debug_mesg iface $INTERFACE is remapped to $NEWNAME
    INTERFACE=$NEWNAME
    fi;
    fi
    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
    exit 0
    fi
    done
    if [ -n "$NEWNAME" ]; then
    debug_mesg invoke ifrename for $INTERFACE back to $ORIGINTERFACE
    NEWNAME=`/sbin/ifrename -i $INTERFACE -n $ORIGINTERFACE`
    if [ -n "$NEWNAME" ]; then
    debug_mesg iface $INTERFACE is remapped to $ORIGINTERFACE
    fi
    fi
    ;;
    remove|unregister)
    debug_mesg Stopping $DAEMON_NAME for $INTERFACE
    /etc/init.d/$DAEMON_NAME stop $INTERFACE
    ;;
    esac

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)