126 lines
4.3 KiB
HTML
126 lines
4.3 KiB
HTML
<!--startcut ==========================================================-->
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<title>Using a Laptop in Different Environments Issue 20</title>
|
|
</HEAD>
|
|
<BODY BGCOLOR="#EEE1CC" TEXT="#000000" LINK="#0000FF" VLINK="#0020F0"
|
|
ALINK="#FF0000">
|
|
<!--endcut ============================================================-->
|
|
|
|
<H4>
|
|
"Linux Gazette...<I>making Linux just a little more fun!</I>"
|
|
</H4>
|
|
|
|
<P> <HR> <P>
|
|
<!--===================================================================-->
|
|
|
|
<center>
|
|
<H2>Using a Laptop in Different Environments</H2>
|
|
<H4>By Gerd Bavendiek,
|
|
<a href="mailto:bav@rw.sni.de">bav@rw.sni.de</a></H4>
|
|
</center>
|
|
<P><HR><P>
|
|
<h1>Do you use a laptop at home ? In the office ? At a customers
|
|
site ?</h1>
|
|
If yes, you should read on. I would like to show you how I integrate
|
|
my laptop in different network environments. The basic idea is really
|
|
simple. Using <code>lilo</code> as bootmanager, I boot with an
|
|
additional variable assignment. The kernel passes this to the
|
|
init-processes shell environment. So all processes started by
|
|
<code>init</code> can use it. Example:
|
|
<p>
|
|
<code>linux netoff=</code>
|
|
<p>
|
|
This sets up the variable <code>netoff</code>. It is assigned
|
|
nothing. I use it as a flag meaning <i>"now I am in the
|
|
office"</i>. Booting with
|
|
|
|
<tt>linux netetc=</tt>
|
|
|
|
means <i>"now I am at customer site"</i>. Using lowercase
|
|
variable names is just for convenient typing. If you prefer,
|
|
you can use something like <code>NETENVIRON=123</code>.
|
|
<p>
|
|
The real work of processing this variables is done in my
|
|
<code>/etc/init.d/netenv</code>. Take a look at this code
|
|
fragment:
|
|
<pre>
|
|
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"
|
|
) > $NETENV
|
|
</pre>
|
|
Output ist written to a world readable file. Scripts which shall use
|
|
the assignments simply have to do something like
|
|
<p>
|
|
<code>. /tmp/netenv</code>
|
|
<p>
|
|
For further details you may refer to the included
|
|
<a href="./laptoplist.html">netenv</a>.
|
|
<p>
|
|
As you can see from the code, I do assign not only network stuff, but
|
|
also a Variable <code>PROFILE</code> as well as printing
|
|
stuff. This makes it possible, to have e.g. <b>ONE</b>
|
|
<code>.fvwm95rc</code>.
|
|
<p>
|
|
I would like to show you how to do that when I come back from my
|
|
vacation.
|
|
<p>
|
|
So far !
|
|
<p>
|
|
Kind regards
|
|
<p>
|
|
Gerd
|
|
<hr>
|
|
<address><a href="mailto:bav@rw.sni.de">Gerd Bavendiek</a></address>
|
|
|
|
|
|
|
|
<!--===================================================================-->
|
|
<P> <hr> <P>
|
|
<center><H5>Copyright © 1997, Gerd Bavendiek<BR>
|
|
Published in Issue 20 of the Linux Gazette, August 1997</H5></center>
|
|
|
|
<!--===================================================================-->
|
|
<P> <hr> <P>
|
|
<A HREF="./index.html"><IMG ALIGN=BOTTOM SRC="../gx/indexnew.gif"
|
|
ALT="[ TABLE OF CONTENTS ]"></A>
|
|
<A HREF="../index.html"><IMG ALIGN=BOTTOM SRC="../gx/homenew.gif"
|
|
ALT="[ FRONT PAGE ]"></A>
|
|
<A HREF="./lyx.html"><IMG SRC="../gx/back2.gif"
|
|
ALT=" Back "></A>
|
|
<A HREF="./wkndmech.html"><IMG SRC="../gx/fwd.gif" ALT=" Next "></A>
|
|
<P> <hr> <P>
|
|
<!--startcut ==========================================================-->
|
|
</BODY>
|
|
</HTML>
|
|
<!--endcut ============================================================-->
|
|
|