Simplifying the LFS Bootscripts

Alexander E. Patrakov patrakov at
Sat Jan 8 22:06:42 PST 2005

Nathan Coulson wrote:

<a suggestion to simplify the bootscripts>

For network, I suggest (sorry, that's only a draft, sample implementation is
not available yet, but should be trivial) the following configuration
mechanism that's simpler and has at least the same flexibility as the
existing one.

1) Each interface configuration resides in one file
in /etc/sysconfig/network-devices. Its name should be constructed as
follows: Optional 2-digit number for the ordering and some string that you
can pass to ifup. E.g., the following names are valid: 50eth0, 75sit1,
ppp0, wlan0, and you can provide eth0, sit1, ppp0, wlan0 as arguments to

2) The contents of this file should be as follows: Optional ONBOOT=yes_or_no
and (for the future) ONHOTPLUG=yes_or_no lines (checked by ifup, not
network), followed by user-written up() and down() functions that are valid
according to /bin/sh syntax rules and are supposed to be sourced from ifup.
Error checking is done in the ifup and ifdown scripts by doing a "trap ...
ERR" and notifying the caller if at least one error occurs.

E.g., consider this example for two IPv4 addresses and a static route:

# Begin /etc/sysconfig/network-devices/eth1


up() {
 ip link set eth1 up
 ip addr add broadcast dev eth1
 ip addr add broadcast dev eth1
 ip route add via

down() {
 ip route del via
 ip addr del broadcast dev eth1
 ip addr del broadcast dev eth1
 ip link set eth1 down

# End /etc/sysconfig/network-devices/eth1

Alexander E. Patrakov

More information about the lfs-dev mailing list