Gentoo Archives: gentoo-dev

From: Martin Schlemmer <azarah@g.o>
To: stroller@×××××××.com
Cc: Gentoo-Dev <gentoo-dev@g.o>
Subject: Re: [gentoo-dev] init.d net scripts & Bash wierdness - idiot in distress
Date: Sat, 22 Mar 2003 23:00:37
Message-Id: 1048373695.4164.5.camel@nosferatu.lan
In Reply to: [gentoo-dev] init.d net scripts & Bash wierdness - idiot in distress by Stroller
1 On Sat, 2003-03-22 at 23:35, Stroller wrote:
2
3 > I then decided to be "clever" and edit a copy of the
4 > /etc/init.d/net.eth0 script, and so my new net.br0 (or net.br1 or
5 > whatever) script takes the name of it's ${IFACE} from its own filename &
6 > gets it's other parameters from /etc/config.d/net.br0 (or br1 &c).
7 >
8 > Unfortunately, for some reason my new script doesn't seem to read the
9 > gateway="br0/192.168.1.1" line from the config.d file, and I can't work
10 > out why not. If I use my dumb script the gateway is allocated correctly,
11 > but not when I try to read parameters from file.
12 >
13
14 My best bet from looking at it quickly, is that you still have 'gateway'
15 set in /etc/conf.d/net. If you look at /sbin/runscript.sh, you will
16 see:
17
18 ----------------------------------------------------------------
19 # Source configuration files.
20 # (1) Source /etc/conf.d/basic to get common configuration.
21 # (2) Source /etc/conf.d/${myservice} to get initscript-specific
22 # configuration (if it exists).
23 # (3) Source /etc/conf.d/net if it is a net.* service
24 # (4) Source /etc/rc.conf to pick up potentially overriding
25 # configuration, if the system administrator chose to put it
26 # there (if it exists).
27
28 [ -e /etc/conf.d/basic ] && source /etc/conf.d/basic
29
30 [ -e "/etc/conf.d/${myservice}" ] && source
31 "/etc/conf.d/${myservice}"
32
33 [ -e /etc/conf.d/net ] && \
34 [ "${myservice%%.*}" = "net" ] && \
35 [ "${myservice##*.}" != "${myservice}" ] && source /etc/conf.d/net
36
37 [ -e /etc/rc.conf ] && source /etc/rc.conf
38 -----------------------------------------------------------------
39
40 Thus, it sources your /etc/conf.d/net.br0, and then sources
41 /etc/conf.d/net, which resets 'gateway' again, and makes the
42 '[ "${gateway%/*}" = "${IFACE}" ]' bit always fail.
43
44 As I see it, you have two simple choices (other than hacking
45 things to pieces):
46
47 1) Use something other than 'gateway' for the br0 script.
48
49 2) Do not set gateway in /etc/conf.d/net
50
51
52
53 Regards,
54
55 --
56
57 Martin Schlemmer
58 Gentoo Linux Developer, Desktop/System Team Developer
59 Cape Town, South Africa

Attachments

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