Gentoo Archives: gentoo-user

From: Neil Bothwick <neil@××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Configure eth0 when plugged and de-configure ath0
Date: Fri, 02 Mar 2007 20:08:37
Message-Id: 20070302200125.0028505d@krikkit.digimed.co.uk
1 On Fri, 02 Mar 2007 19:29:33 +0100, Alexander Skwar wrote:
2
3 > I'd like to setup my notebook so, that when I plugin a cable to
4 > eth0, eth0 should be configured and ath0 (WLAN) should be de-configured
5 > (ie. "eselect rc stop net.ath0" should be run). And as soon as a
6 > cable is unplugged from eth0, net.eth0 should be deconfigured and
7 > net.ath0 should be deconfigured.
8
9 emerge ifplugd then use the functions in /etc/conf.d/net to do what you
10 want. This is what I use, where eth0 is the wired interface and eth1 is
11 wireless.
12
13 ##############################################################################
14 # ADVANCED CONFIGURATION
15 #
16 # ${IFACE} is set to the interface being brought up/down
17 # ${IFVAR} is ${IFACE} converted to variable name bash allows
18
19 preup() {
20 if [ ${IFACE} == "eth0" ]; then
21 /etc/init.d/net.eth1 --quiet status && touch /tmp/eth0_paused_eth1 && /etc/init.d/net.eth1 pause fi
22 return 0
23 }
24
25 postdown() {
26 if [ ${IFACE} == "eth0" ]; then
27 if [ -f /tmp/eth0_paused_eth1 ] && /etc/init.d/net.eth0 status | grep --quiet inactive ; then rm -f /tmp/eth0_paused_eth1
28 /etc/init.d/net.eth1 start
29 fi
30 fi
31 return 0
32 }
33
34
35
36 --
37 Neil Bothwick
38
39 Mw msç ``¤­

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
[gentoo-user] Re: Configure eth0 when plugged and de-configure ath0 Alexander Skwar <listen@×××××××××××××××.name>