Simplifying the LFS Bootscripts

Alexander E. Patrakov patrakov at ums.usu.ru
Mon Jan 10 04:19:07 PST 2005


Alexander E. Patrakov wrote:

> # Begin /etc/sysconfig/network-devices/eth1
(this is a config file supposed to be witten by the user in full)
> up() {
>  ip link set eth1 up
>  ip addr add 192.168.0.101/24 broadcast 192.168.0.255 dev eth1
>  ip addr add 192.168.0.102/24 broadcast 192.168.0.255 dev eth1
>  ip route add 192.168.0.0/16 via 192.168.0.1
> }

(reorder as needed, add interface-specific firewalling rules and whatever
else you like in your copy of this file)

This got too many answers to deal with each separately. Replying in random
order to some of them. Questions about the issues which can be solved by
customizing your own copy of up() and/or the template in the book are left
out.

1) Nathan Coulson wrote:

> it does seem easier just to tell a user to replace 
> his /etc/rc.d/init.d/network file. 

Would be true if there were no plans to support network
hotplug: /sbin/hotplug calls "ifup eth1", and, in response to this, only
eth1 should be upped. So scripts for different interfaces should be kept
separate.

2) Ian Molton wrote:

> Archaic wrote:
> > We aren't asking the readers to write the bootscripts, so this statement
> > seems irrelevant.
> 
> if we dont expect the reader to write the bootscripts, why are we 
> dumbing them down?

Good point. But we can't support everything if we don't defer that to the
user (i.e. there will be always valid feature requests like zillion types
of tunnels). So I split my original proposal into separate ones that can be
accepted or rejected almost independently:

A) interface ordering - may be needed for tunnels; see below

B) the "custom" service in the original bootscripts so for really rare,
non-generic and unsupported out of the box situations I could (instead of
digging in the current infrastructure) write something like:

# begin /etc/sysconfig/network-devices/ifconfig.eth1/cool-feature
ONBOOT=yes
SERVICE=custom
up() { set-up-this-cool-feature }
down() { remove-this-cool-feature }
# end /etc/sysconfig/network-devices/ifconfig.eth1/cool-feature

C) (seems already rejected, but I'll mention it anyway) Make this "custom"
service the only service in existence.

3) Ian molton said that ordering of network interfaces is never needed.
Counter-example: any kind of a userspace (e.g. ppp-over-ssh) tunnel. I
know, that's beyond BLFS, but we already have a feature request for
debian-style PREUP and POSTUP statements (an alternative way to order
interfaces) in this thread, from Mario Fetka (and that can be implemented
in my proposal just by letting Mario to write new lines at the beginning
and at the end of the up() function). However, this PREUP/POSTUP way
doesn't allow to bring up the main interface and the tunnel separately,
that's why I prefer numbering.

4) Ian Molton wrote about the current scripts:

> The content ... makes setting up an interface easy without needing to know 
> what all the underlying tools are up to. 

That's what I call "magic" and what I don't like. Your opinion may differ.
As for more possibility for typos, I don't have any opinion. Once I even
made a typo in the IP address. Moreover, if we don't care about the
reader's knowledge, why the switch to iproute2 from (working) net-tools?

5) Ian Molton wrote that it's a good idea to move the "ip link set $iface
up" to some outer script. Mixed opinion here.

A) This alone doesn't invalidate the proposal to make the reader write most
of the commands, it only adjusts the example.

B) This is in fact impossible. "ip link set ppp1 up" is not a valid command.

Also an side note: current network scripts seem to model MS Windows 2000
network settings closely. Is this intentional?

-- 
Alexander E. Patrakov



More information about the lfs-dev mailing list