Annotation of src/etc/netstart, Revision 1.1.1.1
1.1 deraadt 1: #!/bin/sh -
2: #
3: # $NetBSD: netstart,v 1.21 1995/10/08 18:11:40 thorpej Exp $
4: # @(#)netstart 5.9 (Berkeley) 3/30/91
5:
6: # set these to "NO" to turn them off. otherwise, they're used as flags
7: routed_flags=-q
8: rarpd_flags=NO # for 'normal' use: rarpd_flags="-a"
9: bootparamd_flags=NO # for 'normal' use: bootparamd_flags=""
10: rbootd_flags=NO # for 'normal' use: rbootd_flags=""
11: sendmail_flags=NO # for 'normal' use: sendmail_flags="-bd -q30m"
12: named_flags=NO # for 'normal' use: named_flags=""
13: timed_flags=
14:
15: # set the following to "YES" to turn them on
16: rwhod=NO
17: nfs_server=NO
18: nfs_client=NO
19: gated=NO
20: kerberos_server=NO
21: amd=NO
22:
23: # miscellaneous other flags
24: # only used if the appropriate server is marked YES above
25: gated_flags=
26: amd_dir=/amd # AMD's mount directory
27: amd_master=/etc/amd/master # AMD 'master' map
28:
29: # /etc/myname contains my symbolic name
30: #
31: hostname=`cat /etc/myname`
32: hostname $hostname
33: if [ -f /etc/defaultdomain ]; then
34: domainname `cat /etc/defaultdomain`
35: fi
36:
37: # configure all of the interfaces which we know about.
38: # do this by reading /etc/hostname.* files, where * is the name
39: # of a given interface.
40: #
41: # these files are formatted like the following, but with no # at the
42: # beginning of the line
43: #
44: # addr_family hostname netmask broadcast_addr options
45: # dest dest_addr
46: #
47: # addr_family is the address family of the interface, generally inet
48: # hostname is the host name that belongs to the interface, in /etc/hosts.
49: # netmask is the network mask for the interface.
50: # broadcast_addr is the broadcast address for the interface
51: # options are misc. options to ifconfig for the interface.
52: #
53: # dest is simply the string "dest" (no quotes, though) if the interface
54: # has a "destination" (i.e. it's a point-to-point link, like SLIP).
55: # dest_addr is the hostname of the other end of the link, in /etc/hosts
56: #
57: # the only required contents of the file are the addr_family field
58: # and the hostname.
59:
60: (
61: tmp="$IFS"
62: IFS="$IFS."
63: set -- `echo /etc/hostname*`
64: IFS=$tmp
65: unset tmp
66:
67: while [ $# -ge 2 ] ; do
68: shift # get rid of "hostname"
69: (
70: read af name mask bcaddr extras
71: read dt dtaddr
72:
73: if [ ! -n "$name" ]; then
74: echo "/etc/hostname.$1: invalid network configuration file"
75: exit
76: fi
77:
78: cmd="ifconfig $1 $af $name "
79: if [ "${dt}" = "dest" ]; then cmd="$cmd $dtaddr"; fi
80: if [ -n "$mask" ]; then cmd="$cmd netmask $mask"; fi
81: if [ -n "$bcaddr" -a "X$bcaddr" != "XNONE" ]; then
82: cmd="$cmd broadcast $bcaddr";
83: fi
84: cmd="$cmd $extras"
85:
86: $cmd
87: ) < /etc/hostname.$1
88: shift
89: done
90: )
91:
92: # set the address for the loopback interface
93: ifconfig lo0 inet localhost
94:
95: # use loopback, not the wire
96: route add $hostname localhost
97:
98: # /etc/mygate, if it exists, contains the name of my gateway host
99: # that name must be in /etc/hosts.
100: if [ -f /etc/mygate ]; then
101: route add default `cat /etc/mygate`
102: fi