3 # netinst - configure the user's network.
5 # Written: November 11th, 1994
6 # Copyright (C) 1994 by Jordan K. Hubbard
8 # Permission to copy or use this software for any purpose is granted
9 # provided that this message stay intact, and at this location (e.g. no
10 # putting your name on top after doing something trivial like reindenting
11 # it, just to make it look like you wrote it!).
13 # $Id: netinst.sh,v 1.6 1994/11/18 16:27:54 jkh Exp $
15 if [ "$_NETINST_SH_LOADED_" = "yes" ]; then
18 _NETINST_SH_LOADED_=yes
21 # Set some useful variables.
24 ROUTE_FLAGS="add default"
26 # Grab the miscellaneous functions.
31 dialog $clear --title "Ethernet Interface Name" \
32 --menu "Please select the type of ethernet interface you have:\n\n" \
34 "ed0" "WD80x3, SMC, Novell NE[21]000 or 3C503 generic NIC at 0x280" \
35 "ed1" "Same as above, but at address 0x300 and IRQ 5" \
36 "ep0" "3COM 3C509 at address 0x300 and IRQ 10" \
37 "de0" "DEC PCI ethernet adapter (or compatible)" \
38 "ie0" "AT&T StarLan and EN100 family at 0x360 and IRQ 7" \
39 "is0" "Isolan 4141-0 or Isolink 4110 at 0x280 and IRQ 7" \
40 "ze0" "PCMCIA IBM or National card at 0x300 and IRQ 5" \
44 interface=`cat ${TMP}/menu.tmp.$$`
45 rm -f ${TMP}/menu.tmp.$$
46 if ! handle_rval $retval; then return 1; fi
53 if ! network_dialog "What is the IP number for the remote host?"; then return 1; fi
57 default_value=$serial_interface
58 if ! network_dialog "What is the name of the serial interface?"; then return 1; fi
59 serial_interface=$answer
61 default_value=$serial_speed
62 if ! network_dialog "What speed is the serial interface?"; then return 1; fi
66 if dialog $clear --title "Dial" --yesno "Do you need to dial the phone or otherwise talk to the modem?" -1 -1; then
68 touch -f /var/log/aculog > /dev/null 2>&1
69 chmod 666 /var/log/aculog > /dev/null 2>&1
70 confirm "You may now dialog with your modem and set up the slip connection.\nBe sure to disable DTR sensitivity (usually with AT&D0) or the modem may\nhang up when you exit 'cu'. Use ~. to exit cu and continue."
72 # Grottyness to deal with a weird crunch bug.
73 if [ ! -f /stand/cu ]; then ln /stand/tip /stand/cu; fi
74 /stand/cu -l $serial_interface -s $serial_speed
82 if ! network_dialog "What is the IP number for the remote host?"; then return 1; fi
90 while [ "$interface" = "" ]; do
92 dialog $clear --title "Set up network interface" \
93 --menu "Please select the type of network connection you have:\n\n" \
95 "ether" "A supported ethernet card" \
96 "SLIP" "A point-to-point SLIP (Serial Line IP) connection" \
97 "PLIP" "A Parallel-Line IP setup (with standard laplink cable)" \
101 choice=`cat ${TMP}/menu.tmp.$$`
102 rm -f ${TMP}/menu.tmp.$$
103 if ! handle_rval $retval; then return 1; fi
106 if ! network_setup_ether; then continue; fi
110 if ! network_setup_slip; then continue; fi
114 if ! network_setup_plip; then continue; fi
117 if [ "$interface" = "" ]; then continue; fi
121 if ! network_dialog "What is the fully qualified name of this host?"; then clear="--clear"; return 1; fi
123 echo $hostname > /etc/myname
126 default_value=`echo $hostname | sed -e 's/[^.]*\.//'`
127 if network_dialog "What is the domain name of this host (Internet, not YP/NIS)?"; then
132 if ! network_dialog "What is the IP address of this host?"; then clear="--clear"; return 1; fi
135 echo "$ipaddr $hostname `echo $hostname | sed -e 's/\.$domain//'`" >> /etc/hosts
137 default_value="$netmask"
138 if network_dialog "Please specify the netmask"; then
139 if [ "$answer" != "" ]; then
145 if network_dialog "Any extra flags to ifconfig?" ; then
146 ifconfig_flags=$answer
148 echo "Progress <$IFCONFIG $interface $ipaddr $remote_hostip netmask $netmask $ifconfig_flags>" >/dev/ttyv1
149 if ! $IFCONFIG $interface $ipaddr $remote_hostip netmask $netmask $ifconfig_flags > /dev/ttyv1 2>&1 ; then
150 error "Unable to configure interface $interface"
151 ipaddr=""; interface=""
154 if [ "$interface" = "sl0" ]; then
155 slattach -a -s $serial_speed $serial_interface
157 echo "$ipaddr $remote_hostip netmask $netmask $ifconfig_flags" > /etc/hostname.$interface
159 if network_dialog "If you have a default gateway, enter its IP address"; then
160 if [ "$answer" != "" ]; then
162 echo "Progress <$ROUTE $ROUTE_FLAGS $gateway>" > /dev/ttyv1 2>&1
163 $ROUTE $ROUTE_FLAGS $gateway > /dev/ttyv1 2>&1
164 echo $gateway > /etc/defaultrouter
169 if network_dialog "If you have a name server, enter its IP address"; then
170 if [ "$answer" != "" ]; then
172 echo "domain $domain" > /etc/resolv.conf
173 echo "nameserver $nameserver" >> /etc/resolv.conf