File: laptoplist.html

package info (click to toggle)
lg-issue20 2-2
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 2,456 kB
  • ctags: 144
  • sloc: makefile: 30; sh: 3
file content (126 lines) | stat: -rw-r--r-- 4,622 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<BODY BGCOLOR="#EEE1CC" TEXT="#000000" LINK="#0000FF" VLINK="#0020F0"
ALINK="#FF0000">

<P> <HR> <P> 

<pre>
#******************************************************************
#ident /etc/init.d/netenv Time-stamp: <97/07/04 11:13:44 bav>
#******************************************************************
#                           Gerd Bavendiek  bav@rw.sni.de  97-05-00
#
# This script is used to set up a file containing information about
# the actual network environment. This can be esp. useful for a
# laptop being used in multiple environment: at home, in the office,
# at a customers site.
#
# This is done as follows: When "lilo" prompts, type e.g.
# linux netoff=
# This sets up an shell variable "netoff", containing nothing. The
# kernel starts the init process with "netoff" as part of its
# environment, so does init. So this script can check for
# "netoff". Placing assignments in a file is a convenient way to
# enable user processes to deal with multiple environments (login
# provides user processes with a complete new environment, so they do
# not longer know about "netoff").
#
# I took "netoff=" just for convenient typing. Of course you can use
# something like "PROFILE=34" and scan for that ...
#
# Right now I use this mechanism for setting up my .fvwm95rc and my
# printing environment. My .fvwm95rc is pre-compiled by means of the
# variable "PROFILE". This way I can use one source for different
# displays and so on.
#
# As is this script eventually tries to set up a plip connection by
# executing /etc/init.d/plip. To be able to do so, it must be called
# after "kerneld" is started ! (One example: S12kerneld, ...
# S30netstd_misc, S40netenv, ....)
#
# Another hint regarding pcmcia:   
# My Debian GNU/Linux 1.2 used to set up the PCMCIA-Ethernet-Card in
# /etc/pcmcia/network.opts. I changed this slightly by simply
# . /tmp/netenv
# This way the assignments in /tmp/netenv are passed to the calling
# script. You HAVE to reorder the calling sequence of scripts in
# /etc/rc2.d. Example:
# S10sysklogd S12kerneld S15netstd_init S18netbase S19netenv S19pcmcia
#
# The profiles I defined are as follows:
# 1x Tower Home, system name "nana", network plip only.
# 2x Desktop Office, system name "zaza", Ethernet.
# 3x Laptop, system name "lulu".
# 30 at home, no Ethernet, eventually connected to tower via plip
# 31 in the office
# 32 at customer site 1
# 33 at customer site 2
#-------------------------------------------------------------------
NETENV=/tmp/netenv	# When located in /tmp, script must be called
                        # AFTER wiping out /tmp has been done ...

if [ `uname -n` = "nana" ]; then
   (
   echo "# Networkenvironment: Home Tower (Network-Interface: Plip)"
   echo "export PROFILE=10"
   ) > $NETENV
   /etc/init.d/plip start
elif [ `uname -n` = "zaza" ]; then
   (
   echo "# Networkenvironment: Office Desktop (Network-Interface: Ethernet)"
   echo "export PROFILE=20"

   echo "export RLPR_PRINTHOST=printer-off"
   echo "export PRINTER=pr1"
   ) > $NETENV
elif env | grep '^netoff=' > /dev/null; then
   (
   echo "# Networkenvironment: Laptop at office (Network-Interface: Ethernet)"
   echo "export PROFILE=31"
   echo "IPADDR=\"123.456.78.9\""
   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.78.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 "IPADDR=\"123.456.8.89\""
   echo "NETMASK=\"255.255.255.0\""
   echo "NETWORK=\"123.456.7.0\""
   echo "BROADCAST=\"123.456.7.255\""
   echo "GATEWAY=\"123.456.7.1\""

   echo "export RLPR_PRINTHOST=printer-etc"
   echo "export PRINTER=pr1"
   ) > $NETENV
else
   if [ `uname -n` = "lulu" ]; then # just to double check
      # We are at home, let's start the plip-Interface
      (
      echo "# Networkenvironment: Laptop at home (Network-Interface: Plip)"
      echo "export PROFILE=30"
      ) > $NETENV
      /etc/init.d/plip start
   fi
fi

chmod 644 $NETENV
</pre>
<!--===================================================================-->
<P> <hr> <P> 
<center><H5>Copyright &copy; 1997, Gerb Bavendiek<BR> 
Published in Issue 20 of the Linux Gazette, August 1997</H5></center>

<!--===================================================================-->
</BODY>
</HTML>