liloas bootmanager, I boot with an additional variable assignment. The kernel passes this to the init-processes shell environment. So all processes started by
initcan use it. Example:
This sets up the variable
netoff. It is assigned
nothing. I use it as a flag meaning "now I am in the
office". Booting with
means "now I am at customer site". Using lowercase
variable names is just for convenient typing. If you prefer,
you can use something like
The real work of processing this variables is done in my
/etc/init.d/netenv. Take a look at this code
NETENV=/tmp/netenv # When located in /tmp, script must be called # AFTER wiping out /tmp has been done ... ... elif env | grep '^netoff=' > /dev/null; then ( echo ""# Networkenvironment: Laptop at office (Network-Interface: Ethernet)" echo "export PROFILE=31" echo "IPADDR=\"123.456.78.123\"" echo "NETMASK=\"255.255.255.0\"" echo "NETWORK=\"123.456.78.0\"" echo "BROADCAST=\"123.456.78.255\"" echo "GATEWAY=\"123.456.78.1\"" echo "DOMAIN=\"rw.sni.de\"" echo "DNS_1=\"123.456.89.9\"" echo "export RLPR_PRINTHOST=printer-off" echo "export PRINTER=pr1" ) > $NETENV elif env | grep '^netetc=' > /dev/null; then ( echo "# Networkenvironment: Laptop at customer site (Network-Interface: Ethernet)" echo "export PROFILE=32" ... echo "export RLPR_PRINTHOST=printer-etc" echo "export PRINTER=pr1" ) > $NETENVOutput ist written to a world readable file. Scripts which shall use the assignments simply have to do something like
For further details you may refer to the included netenv.
As you can see from the code, I do assign not only network stuff, but
also a Variable
PROFILE as well as printing
stuff. This makes it possible, to have e.g. ONE
I would like to show you how to do that when I come back from my vacation.
So far !