http://blog.funtoo.org/2009/06/initscripts-keeping-it-simple.html
The specific changes I'm looking at making (all together) are:
1) Upgrade to OpenRC 0.5.0+
2) Adding OpenResolv to Funtoo Core
3) Moving to minimal initscripts
4) Moving to dhcpcd 5.x
If you are using dhcp, all you need to do for network config is to add
/etc/init.d/dhcpcd
to your default runlevel (I think -- I'll be testing this, please test
dhcpd-5 too :)
Here is a sample net.eth0 (static config) I am using for testing,
which follows the
minimal approach:
#!/sbin/runscript
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
depend() {
provide net
after net.lo
}
IP=207.66.127.104
NM=255.255.255.0
GW=207.66.127.254
INT=eth0
start() {
ebegin "Configuring network interface $INT"
ifconfig $INT $IP netmask $NM up && \
route add default gw $GW $INT && \
resolvconf -a $INT << "EOF"
domain funtoo.org
nameserver 129.121.254.1
nameserver 129.121.254.2
EOF
eend $?
}
stop() {
ebegin "Shutting down network interface $INT"
resolvconf -d $INT && \
route del default gw $GW $INT && \
ifconfig $INT down
eend $?
}
As you can see, resolv.conf info is stored in the initscript, and this
works great with openresolv. What this means is that you don't write
directly to /etc/resolv.conf anymore.
Here is a sample net.lo:
#!/sbin/runscript
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
depend() {
provide net
}
start() {
ifconfig lo 127.0.0.1 netmask 255.0.0.0 up
route add -net 127.0.0.0 netmask 255.0.0.0 dev lo
}
stop() {
route del -net 127.0.0.0 netmask 255.0.0.0 dev lo
ifconfig lo down
}
Looking for feedback...
-Daniel
My dhcpcd.conf has:
nohook resolv.conf
and I leave my /etc/resolv.conf alone (my router incorrectly handles dns
servers).
For me, I don't really care what address my ethernet gets. Letting DHCP
take care of it whenever it is plugged in would be nice (it shouts at me
for not configuring it).
I would like to know (i.e. make it print) the IP address that I get.
For wireless, which I use more, I read that gentoo initscripts try to be
a bit too clever and freak it out. So, I wrote a script that sets it all
up.
#!/bin/sh
test "$1" -o -f /var/run/dhcpcd-ra0.pid && dhcpcd -x ra0
ifconfig ra0 up
iwconfig ra0 essid $(< ~/Desktop/essid) key $(< ~/Desktop/key) enc open
dhcpcd -s 192.168.2.2 -m 2 ra0
(Due to a bug in the hardware, I do not need to worry about turning
off the adapter)
I used to be near some WPA spots, in which I beefed up my script to:
#!/bin/sh
test "$1" -o -f /var/run/dhcpcd-ra0.pid && dhcpcd -x ra0
ifconfig ra0 up
wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant.conf -ira0 -Dwext -B \
|| killall -HUP wpa_supplicant
# wpa_supplicant has to be configured at each access point
dhcpcd -m 2 ra0
As you can see, I have quite a few variables. In a more generic script,
these variables should go into /etc/conf.d/net (or somewhere
otherwise suitable), because a small change to the initscript will
mean a user (umm... i mean system admin) will need to learn about the
horror of merging in dispatch-conf.
AFAIK, eglibc is a "glibc distribution", with doesn't make it any easier
or faster than ordinary glibc. Last time I checked, the major difference
is the maintainers and their patch-acceptance policy.
"Back to basics" would involve ANSI C's standard library (and POSIX
extensions optionally available) only, and a cat(1) that can read directories
and not "invisible" characters.
"Back to basics" can be interpreted in many different ways. For my
purposes, "back to basics" is the concept of putting the user in
direct control of their OS, and eliminating intermediate layers of
complexity when they don't add significant value, as these layers end
up becoming liabilities rather than assets over time (you need to
maintain them, they have their own bugs and limitations, etc.) If
significant amounts of code can be eliminated while functionality is
maintained or even improved, this is an indication that there is
bloat. Of course there are other factors to consider when deciding
whether or not to remove code - for Linux users, asking them to see
the commands that set up their network (and have direct control over
them) has other benefits besides just eliminating some unnecessary
code.
-Daniel