On Fri, 02 Mar 2007 19:29:33 +0100, Alexander Skwar wrote:

> I'd like to setup my notebook so, that when I plugin a cable to
> eth0, eth0 should be configured and ath0 (WLAN) should be de-configured
> (ie. "eselect rc stop net.ath0" should be run). And as soon as a
> cable is unplugged from eth0, net.eth0 should be deconfigured and
> net.ath0 should be deconfigured.

emerge ifplugd then use the functions in /etc/conf.d/net to do what you
want. This is what I use, where eth0 is the wired interface and eth1 is
wireless.

##############################################################################
# ADVANCED CONFIGURATION
# 
# ${IFACE} is set to the interface being brought up/down
# ${IFVAR} is ${IFACE} converted to variable name bash allows

preup() {
        if [ ${IFACE} == "eth0" ]; then
                /etc/init.d/net.eth1 --quiet status && touch 
/tmp/eth0_paused_eth1 && /etc/init.d/net.eth1 pause fi
        return 0
}

postdown() {
        if [ ${IFACE} == "eth0" ]; then
                if [ -f /tmp/eth0_paused_eth1 ] && /etc/init.d/net.eth0 status 
| grep --quiet inactive ; then rm -f /tmp/eth0_paused_eth1
                        /etc/init.d/net.eth1 start 
                        fi
                fi
        return 0
}



-- 
Neil Bothwick

Mw msç ``¤­

Attachment: signature.asc
Description: PGP signature

Reply via email to