lilo
as bootmanager, I boot with an additional variable assignment. The kernel passes this to the init-processes shell environment. So all processes started by init
can use it. Example:
linux netoff=
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 linux netetc= means "now I am at customer site". Using lowercase variable names is just for convenient typing. If you prefer, you can use something like NETENVIRON=123
.
The real work of processing this variables is done in my /etc/init.d/netenv
. Take a look at this code fragment:
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
. /tmp/netenv
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 .fvwm95rc
.
I would like to show you how to do that when I come back from my vacation.
So far !
Kind regards
Gerd