1994-11-16 07:51:45 +00:00
|
|
|
#!/stand/sh
|
|
|
|
#
|
1994-11-28 22:13:07 +00:00
|
|
|
# netinst.sh - configure the user's network.
|
1994-11-16 07:51:45 +00:00
|
|
|
#
|
|
|
|
# Written: November 11th, 1994
|
|
|
|
# Copyright (C) 1994 by Jordan K. Hubbard
|
|
|
|
#
|
|
|
|
# Permission to copy or use this software for any purpose is granted
|
|
|
|
# provided that this message stay intact, and at this location (e.g. no
|
|
|
|
# putting your name on top after doing something trivial like reindenting
|
|
|
|
# it, just to make it look like you wrote it!).
|
|
|
|
#
|
1994-12-02 21:05:27 +00:00
|
|
|
# $Id: netinst.sh,v 1.14 1994/12/02 15:52:55 jkh Exp $
|
1994-11-16 07:51:45 +00:00
|
|
|
|
1994-11-28 22:13:07 +00:00
|
|
|
if [ "${_NETINST_SH_LOADED_}" = "yes" ]; then
|
1994-11-16 07:51:45 +00:00
|
|
|
return 0
|
|
|
|
else
|
|
|
|
_NETINST_SH_LOADED_=yes
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Grab the miscellaneous functions.
|
1994-11-18 10:05:47 +00:00
|
|
|
. /stand/miscfuncs.sh
|
1994-11-16 07:51:45 +00:00
|
|
|
|
1994-11-21 08:33:56 +00:00
|
|
|
network_set_defaults()
|
|
|
|
{
|
1994-11-28 22:13:07 +00:00
|
|
|
HOSTNAME=""
|
|
|
|
DOMAIN=""
|
|
|
|
NETMASK="0xffffff00"
|
|
|
|
IPADDR="127.0.0.1"
|
|
|
|
IFCONFIG_FLAGS=""
|
|
|
|
REMOTE_HOSTIP=""
|
|
|
|
REMOTE_IPADDR=""
|
1994-12-02 15:52:55 +00:00
|
|
|
INTERFACE=""
|
1994-11-28 22:13:07 +00:00
|
|
|
SERIAL_INTERFACE="/dev/tty00"
|
|
|
|
SERIAL_SPEED="38400"
|
1994-11-21 08:33:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
network_basic_setup()
|
|
|
|
{
|
1994-11-28 22:13:07 +00:00
|
|
|
HOSTNAME=""
|
|
|
|
while [ "${HOSTNAME}" = "" ]; do
|
|
|
|
DEFAULT_VALUE=""
|
1994-11-21 08:33:56 +00:00
|
|
|
if ! network_dialog "What is the fully qualified name of this host?"; then return 1; fi
|
1994-11-28 22:13:07 +00:00
|
|
|
if [ "${ANSWER}" = "" ]; then
|
1994-11-21 08:33:56 +00:00
|
|
|
error "You must select a host name!"
|
|
|
|
continue
|
|
|
|
else
|
1994-12-01 20:00:32 +00:00
|
|
|
HOSTNAME=${ANSWER}
|
1994-11-21 08:33:56 +00:00
|
|
|
fi
|
|
|
|
done
|
1994-11-28 22:13:07 +00:00
|
|
|
echo ${HOSTNAME} > ${ETC}/myname
|
|
|
|
${HOSTNAME_CMD} ${HOSTNAME}
|
1994-11-21 08:33:56 +00:00
|
|
|
|
1994-11-28 22:13:07 +00:00
|
|
|
DEFAULT_VALUE=`echo ${HOSTNAME} | sed -e 's/[^.]*\.//' | grep \.`
|
1994-11-21 08:33:56 +00:00
|
|
|
if network_dialog "What is the domain name of this host (Internet, not YP/NIS)?"; then
|
1994-11-28 22:13:07 +00:00
|
|
|
DOMAIN=${ANSWER}
|
1994-11-21 08:33:56 +00:00
|
|
|
fi
|
|
|
|
|
1994-11-28 22:13:07 +00:00
|
|
|
DEFAULT_VALUE=${IPADDR}
|
|
|
|
if ! network_dialog "What is the IP address of this host?"; then return 1; fi
|
|
|
|
IPADDR=${ANSWER}
|
|
|
|
echo "${IPADDR} ${HOSTNAME} `echo ${HOSTNAME} | sed -e 's/\.${DOMAIN}//'`" >> ${ETC}/hosts
|
1994-11-21 08:33:56 +00:00
|
|
|
}
|
|
|
|
|
1994-11-16 07:51:45 +00:00
|
|
|
network_setup_ether()
|
|
|
|
{
|
1994-11-28 22:13:07 +00:00
|
|
|
dialog --title "Ethernet Interface Name" --menu \
|
|
|
|
"Please select the type of ethernet interface you have:\n" -1 -1 8 \
|
1994-11-16 07:51:45 +00:00
|
|
|
"ed0" "WD80x3, SMC, Novell NE[21]000 or 3C503 generic NIC at 0x280" \
|
|
|
|
"ed1" "Same as above, but at address 0x300 and IRQ 5" \
|
|
|
|
"ep0" "3COM 3C509 at address 0x300 and IRQ 10" \
|
|
|
|
"de0" "DEC PCI ethernet adapter (or compatible)" \
|
|
|
|
"ie0" "AT&T StarLan and EN100 family at 0x360 and IRQ 7" \
|
|
|
|
"is0" "Isolan 4141-0 or Isolink 4110 at 0x280 and IRQ 7" \
|
1994-12-02 15:52:55 +00:00
|
|
|
"le0" "DEC Etherworks ethernet adapter" \
|
1994-11-16 07:51:45 +00:00
|
|
|
"ze0" "PCMCIA IBM or National card at 0x300 and IRQ 5" \
|
|
|
|
2> ${TMP}/menu.tmp.$$
|
|
|
|
|
1994-11-28 22:13:07 +00:00
|
|
|
RETVAL=$?
|
|
|
|
INTERFACE=`cat ${TMP}/menu.tmp.$$`
|
1994-11-16 07:51:45 +00:00
|
|
|
rm -f ${TMP}/menu.tmp.$$
|
1994-11-28 22:13:07 +00:00
|
|
|
if ! handle_rval ${RETVAL}; then return 1; fi
|
|
|
|
}
|
|
|
|
|
|
|
|
network_setup_remote()
|
|
|
|
{
|
|
|
|
DEFAULT_VALUE="${REMOTE_IPADDR}"
|
|
|
|
if ! network_dialog "What is the IP number for the remote host?"; then
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
REMOTE_IPADDR=${ANSWER}
|
1994-11-16 07:51:45 +00:00
|
|
|
}
|
|
|
|
|
1994-11-28 22:13:07 +00:00
|
|
|
network_setup_serial()
|
1994-11-16 07:51:45 +00:00
|
|
|
{
|
1994-11-28 22:13:07 +00:00
|
|
|
network_setup_remote
|
|
|
|
INTERFACE=$1
|
|
|
|
|
|
|
|
DEFAULT_VALUE=${SERIAL_INTERFACE}
|
|
|
|
if ! network_dialog "What serial port do you wish to use?"; then
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
SERIAL_INTERFACE=${ANSWER}
|
|
|
|
|
|
|
|
DEFAULT_VALUE=${SERIAL_SPEED}
|
|
|
|
if ! network_dialog "What speed is the serial connection?"; then
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
SERIAL_SPEED=${ANSWER}
|
|
|
|
|
|
|
|
if dialog --title "Dial" --yesno \
|
|
|
|
"Do you need to dial the phone or otherwise talk to the modem?" \
|
|
|
|
-1 -1; then
|
1994-11-16 07:51:45 +00:00
|
|
|
mkdir -p /var/log
|
|
|
|
touch -f /var/log/aculog > /dev/null 2>&1
|
|
|
|
chmod 666 /var/log/aculog > /dev/null 2>&1
|
1994-11-28 22:13:07 +00:00
|
|
|
confirm \
|
|
|
|
"You may now dialog with your modem and set up the connection.
|
|
|
|
Be sure to disable DTR sensitivity (usually with AT&D0) or the
|
|
|
|
modem may hang up when you exit 'cu'. Use ~. to exit cu and
|
|
|
|
continue."
|
1994-11-16 07:51:45 +00:00
|
|
|
dialog --clear
|
1994-11-18 19:09:33 +00:00
|
|
|
# Grottyness to deal with a weird crunch bug.
|
|
|
|
if [ ! -f /stand/cu ]; then ln /stand/tip /stand/cu; fi
|
1994-11-28 22:13:07 +00:00
|
|
|
/stand/cu -l ${SERIAL_INTERFACE} -s ${SERIAL_SPEED}
|
1994-11-16 07:51:45 +00:00
|
|
|
dialog --clear
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
network_setup_plip()
|
|
|
|
{
|
1994-11-28 22:13:07 +00:00
|
|
|
network_setup_remote
|
|
|
|
INTERFACE=lp0
|
1994-11-16 07:51:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
network_setup()
|
|
|
|
{
|
1994-11-28 22:13:07 +00:00
|
|
|
DONE=0
|
|
|
|
while [ "${INTERFACE}" = "" ]; do
|
|
|
|
dialog --title "Set up network interface" --menu \
|
|
|
|
"Please select the type of network connection you have:\n" \
|
|
|
|
-1 -1 4 \
|
|
|
|
"Ether" "A supported ethernet card" \
|
1994-11-16 07:51:45 +00:00
|
|
|
"SLIP" "A point-to-point SLIP (Serial Line IP) connection" \
|
1994-11-28 22:13:07 +00:00
|
|
|
"PPP" "A Point-To-Point-Protocol connection" \
|
1994-11-18 11:01:33 +00:00
|
|
|
"PLIP" "A Parallel-Line IP setup (with standard laplink cable)" \
|
1994-11-16 07:51:45 +00:00
|
|
|
2> ${TMP}/menu.tmp.$$
|
|
|
|
|
1994-11-28 22:13:07 +00:00
|
|
|
RETVAL=$?
|
|
|
|
CHOICE=`cat ${TMP}/menu.tmp.$$`
|
1994-11-16 07:51:45 +00:00
|
|
|
rm -f ${TMP}/menu.tmp.$$
|
1994-11-28 22:13:07 +00:00
|
|
|
if ! handle_rval ${RETVAL}; then return 1; fi
|
|
|
|
case ${CHOICE} in
|
|
|
|
Ether) if ! network_setup_ether; then continue; fi ;;
|
|
|
|
SLIP) if ! network_setup_serial sl0; then continue; fi ;;
|
|
|
|
|
|
|
|
PPP) if ! network_setup_serial ppp0; then continue; fi ;;
|
|
|
|
|
|
|
|
PLIP) if ! network_setup_plip; then continue; fi ;;
|
|
|
|
esac
|
|
|
|
if [ "${INTERFACE}" = "" ]; then continue; fi
|
1994-11-16 07:51:45 +00:00
|
|
|
|
1994-11-21 08:33:56 +00:00
|
|
|
network_basic_setup
|
1994-11-16 07:51:45 +00:00
|
|
|
|
1994-11-28 22:13:07 +00:00
|
|
|
DEFAULT_VALUE="${NETMASK}"
|
1994-11-16 07:51:45 +00:00
|
|
|
if network_dialog "Please specify the netmask"; then
|
1994-11-28 22:13:07 +00:00
|
|
|
if [ "${ANSWER}" != "" ]; then
|
|
|
|
NETMASK=${ANSWER}
|
1994-11-16 07:51:45 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1994-11-28 22:13:07 +00:00
|
|
|
DEFAULT_VALUE=""
|
1994-12-02 21:05:27 +00:00
|
|
|
if network_dialog "Set extra flags to ${IFCONFIG_CMD}?"; then
|
1994-11-28 22:13:07 +00:00
|
|
|
IFCONFIG_FLAGS=${ANSWER}
|
1994-11-16 07:51:45 +00:00
|
|
|
fi
|
1994-11-28 22:13:07 +00:00
|
|
|
echo "Progress <${IFCONFIG_CMD} ${INTERFACE} ${IPADDR} ${REMOTE_IPADDR} netmask ${NETMASK} ${IFCONFIG_FLAGS}>" >/dev/ttyv1
|
|
|
|
if ! ${IFCONFIG_CMD} ${INTERFACE} ${IPADDR} ${REMOTE_IPADDR} netmask ${NETMASK} ${IFCONFIG_FLAGS} > /dev/ttyv1 2>&1 ; then
|
|
|
|
error "Unable to configure interface ${INTERFACE}"
|
|
|
|
IPADDR=""
|
|
|
|
INTERFACE=""
|
1994-11-16 07:51:45 +00:00
|
|
|
continue
|
|
|
|
fi
|
1994-11-28 22:13:07 +00:00
|
|
|
if [ "${INTERFACE}" = "sl0" ]; then
|
|
|
|
DEFAULT_VALUE=${SLATTACH_FLAGS}
|
|
|
|
if network_dialog "Set extra flags to ${SLATTACH_CMD}?"; then
|
|
|
|
SLATTACH_FLAGS=${ANSWER}
|
|
|
|
fi
|
|
|
|
${SLATTACH_CMD} ${SLATTACH_FLAGS} ${SERIAL_SPEED} ${SERIAL_INTERFACE}
|
|
|
|
progress ${SLATTACH_CMD} ${SLATTACH_FLAGS} ${SERIAL_SPEED} ${SERIAL_INTERFACE}
|
|
|
|
fi
|
|
|
|
if [ "${INTERFACE}" = "ppp0" ]; then
|
|
|
|
DEFAULT_VALUE=${PPPD_FLAGS}
|
|
|
|
if network_dialog "Set extra flags to ${PPPD}?"; then
|
|
|
|
PPPD_FLAGS=${ANSWER}
|
|
|
|
fi
|
|
|
|
${PPPD_CMD} ${PPPD_FLAGS} ${SERIAL_INTERFACE} ${SERIAL_SPEED} ${IPADDR}:${REMOTE_IPADDR}
|
|
|
|
progress ${PPPD_CMD} ${PPPD_FLAGS} ${SERIAL_INTERFACE} ${SERIAL_SPEED} ${IPADDR}:${REMOTE_IPADDR}
|
1994-11-16 07:51:45 +00:00
|
|
|
fi
|
1994-12-02 15:52:55 +00:00
|
|
|
echo "${IPADDR} ${REMOTE_IPADDR} netmask ${NETMASK} ${IFCONFIG_FLAGS}" > ${ETC}/hostname.${INTERFACE}
|
1994-11-28 22:13:07 +00:00
|
|
|
DEFAULT_VALUE=""
|
1994-11-16 07:51:45 +00:00
|
|
|
if network_dialog "If you have a default gateway, enter its IP address"; then
|
1994-11-28 22:13:07 +00:00
|
|
|
if [ "${ANSWER}" != "" ]; then
|
|
|
|
GATEWAY=${ANSWER}
|
|
|
|
${ROUTE_CMD} ${ROUTE_FLAGS} ${GATEWAY} > /dev/ttyv1 2>&1
|
|
|
|
progress ${ROUTE_CMD} ${ROUTE_FLAGS} ${GATEWAY}
|
|
|
|
echo ${GATEWAY} > ${ETC}/defaultrouter
|
1994-11-16 07:51:45 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1994-11-28 22:13:07 +00:00
|
|
|
DEFAULT_VALUE=""
|
1994-11-16 07:51:45 +00:00
|
|
|
if network_dialog "If you have a name server, enter its IP address"; then
|
1994-11-28 22:13:07 +00:00
|
|
|
if [ "${ANSWER}" != "" ]; then
|
|
|
|
NAMESERVER=${ANSWER}
|
|
|
|
echo "domain ${DOMAIN}" > ${ETC}/resolv.conf
|
|
|
|
echo "nameserver ${NAMESERVER}" >> ${ETC}/resolv.conf
|
1994-11-16 07:51:45 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
1994-11-18 16:27:54 +00:00
|
|
|
return 0
|
1994-11-16 07:51:45 +00:00
|
|
|
}
|