diff options
Diffstat (limited to 'release/netinst.sh')
-rw-r--r-- | release/netinst.sh | 227 |
1 files changed, 125 insertions, 102 deletions
diff --git a/release/netinst.sh b/release/netinst.sh index c66d11f..a3feb18 100644 --- a/release/netinst.sh +++ b/release/netinst.sh @@ -1,6 +1,6 @@ #!/stand/sh # -# netinst - configure the user's network. +# netinst.sh - configure the user's network. # # Written: November 11th, 1994 # Copyright (C) 1994 by Jordan K. Hubbard @@ -10,186 +10,209 @@ # putting your name on top after doing something trivial like reindenting # it, just to make it look like you wrote it!). # -# $Id: netinst.sh,v 1.10 1994/11/21 08:33:56 jkh Exp $ +# $Id: netinst.sh,v 1.11 1994/11/22 06:50:13 jkh Exp $ -if [ "$_NETINST_SH_LOADED_" = "yes" ]; then +if [ "${_NETINST_SH_LOADED_}" = "yes" ]; then return 0 else _NETINST_SH_LOADED_=yes fi -# Set some useful variables. -IFCONFIG=ifconfig -ROUTE=route -ROUTE_FLAGS="add default" - # Grab the miscellaneous functions. . /stand/miscfuncs.sh network_set_defaults() { - hostname="" - domain="" - ipaddr="127.0.0.1" - serial_interface="/dev/tty00" + HOSTNAME="" + DOMAIN="" + NETMASK="0xffffff00" + IPADDR="127.0.0.1" + IFCONFIG_FLAGS="" + REMOTE_HOSTIP="" + REMOTE_IPADDR="" + INTERFACE=lo0 + SERIAL_INTERFACE="/dev/tty00" + SERIAL_SPEED="38400" } network_basic_setup() { - hostname="" - while [ "$hostname" = "" ]; do - default_value="" + HOSTNAME="" + while [ "${HOSTNAME}" = "" ]; do + DEFAULT_VALUE="" if ! network_dialog "What is the fully qualified name of this host?"; then return 1; fi - if [ "$answer" = "" ]; then + if [ "${ANSWER}" = "" ]; then error "You must select a host name!" continue else - hostname=$answer + HOSTNAME=$answer fi done - echo $hostname > /etc/myname - hostname $hostname + echo ${HOSTNAME} > ${ETC}/myname + ${HOSTNAME_CMD} ${HOSTNAME} - default_value=`echo $hostname | sed -e 's/[^.]*\.//'` + DEFAULT_VALUE=`echo ${HOSTNAME} | sed -e 's/[^.]*\.//' | grep \.` if network_dialog "What is the domain name of this host (Internet, not YP/NIS)?"; then - domain=$answer + DOMAIN=${ANSWER} fi - 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 + 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 } network_setup_ether() { - dialog $clear --title "Ethernet Interface Name" \ - --menu "Please select the type of ethernet interface you have:\n" \ - -1 -1 7 \ + dialog --title "Ethernet Interface Name" --menu \ + "Please select the type of ethernet interface you have:\n" -1 -1 8 \ "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" \ + "le0" "DEC Etherworks ethernet adapter" "ze0" "PCMCIA IBM or National card at 0x300 and IRQ 5" \ 2> ${TMP}/menu.tmp.$$ - retval=$? - interface=`cat ${TMP}/menu.tmp.$$` + RETVAL=$? + INTERFACE=`cat ${TMP}/menu.tmp.$$` rm -f ${TMP}/menu.tmp.$$ - if ! handle_rval $retval; then return 1; fi + 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} } -network_setup_slip() +network_setup_serial() { - csave=$clear - clear="" - default_value="" - if ! network_dialog "What is the IP number for the remote host?"; then return 1; fi - remote_hostip=$answer - interface=sl0 - - default_value=$serial_interface - if ! network_dialog "What is the name of the serial interface?"; then return 1; fi - serial_interface=$answer - - default_value=$serial_speed - if ! network_dialog "What speed is the serial interface?"; then return 1; fi - serial_speed=$answer - clear="$csave" - - if dialog $clear --title "Dial" --yesno "Do you need to dial the phone or otherwise talk to the modem?" -1 -1; then + 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 mkdir -p /var/log touch -f /var/log/aculog > /dev/null 2>&1 chmod 666 /var/log/aculog > /dev/null 2>&1 - 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." + 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." dialog --clear # Grottyness to deal with a weird crunch bug. if [ ! -f /stand/cu ]; then ln /stand/tip /stand/cu; fi - /stand/cu -l $serial_interface -s $serial_speed + /stand/cu -l ${SERIAL_INTERFACE} -s ${SERIAL_SPEED} dialog --clear fi } network_setup_plip() { - default_value="" - if ! network_dialog "What is the IP number for the remote host?"; then return 1; fi - remote_hostip=$answer - interface=lp0 + network_setup_remote + INTERFACE=lp0 } network_setup() { - done=0 - while [ "$interface" = "" ]; do - dialog $clear --title "Set up network interface" \ - --menu "Please select the type of network connection you have:\n" \ - -1 -1 3 \ - "ether" "A supported ethernet card" \ + 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" \ "SLIP" "A point-to-point SLIP (Serial Line IP) connection" \ + "PPP" "A Point-To-Point-Protocol connection" \ "PLIP" "A Parallel-Line IP setup (with standard laplink cable)" \ 2> ${TMP}/menu.tmp.$$ - retval=$? - choice=`cat ${TMP}/menu.tmp.$$` + RETVAL=$? + CHOICE=`cat ${TMP}/menu.tmp.$$` rm -f ${TMP}/menu.tmp.$$ - if ! handle_rval $retval; then return 1; fi - case $choice in - ether) - if ! network_setup_ether; then continue; fi - ;; - - SLIP) - if ! network_setup_slip; then continue; fi - ;; - - PLIP) - if ! network_setup_plip; then continue; fi - ;; - esac - if [ "$interface" = "" ]; then continue; fi + 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 network_basic_setup - default_value="$netmask" + DEFAULT_VALUE="${NETMASK}" if network_dialog "Please specify the netmask"; then - if [ "$answer" != "" ]; then - netmask=$answer + if [ "${ANSWER}" != "" ]; then + NETMASK=${ANSWER} fi fi - default_value="" - if network_dialog "Any extra flags to ifconfig?" ; then - ifconfig_flags=$answer + DEFAULT_VALUE="" + if network_dialog "Set extra flags to ${IFCONFIG}?"; then + IFCONFIG_FLAGS=${ANSWER} fi - echo "Progress <$IFCONFIG $interface $ipaddr $remote_hostip netmask $netmask $ifconfig_flags>" >/dev/ttyv1 - if ! $IFCONFIG $interface $ipaddr $remote_hostip netmask $netmask $ifconfig_flags > /dev/ttyv1 2>&1 ; then - error "Unable to configure interface $interface" - ipaddr=""; interface="" + 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="" continue fi - if [ "$interface" = "sl0" ]; then - slattach -a -s $serial_speed $serial_interface + 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} fi - echo "$ipaddr $remote_hostip netmask $netmask $ifconfig_flags" > /etc/hostname.$interface - default_value="" + echo "${IPADDR} ${REMOTE_IPADDR} netmask ${NETMASK} ${IFCONFIG_FLAGS}" > ${ETC}/hostname.$interface + DEFAULT_VALUE="" if network_dialog "If you have a default gateway, enter its IP address"; then - if [ "$answer" != "" ]; then - gateway=$answer - echo "Progress <$ROUTE $ROUTE_FLAGS $gateway>" > /dev/ttyv1 2>&1 - $ROUTE $ROUTE_FLAGS $gateway > /dev/ttyv1 2>&1 - echo $gateway > /etc/defaultrouter + if [ "${ANSWER}" != "" ]; then + GATEWAY=${ANSWER} + ${ROUTE_CMD} ${ROUTE_FLAGS} ${GATEWAY} > /dev/ttyv1 2>&1 + progress ${ROUTE_CMD} ${ROUTE_FLAGS} ${GATEWAY} + echo ${GATEWAY} > ${ETC}/defaultrouter fi fi - default_value="" + DEFAULT_VALUE="" if network_dialog "If you have a name server, enter its IP address"; then - if [ "$answer" != "" ]; then - nameserver=$answer - echo "domain $domain" > /etc/resolv.conf - echo "nameserver $nameserver" >> /etc/resolv.conf + if [ "${ANSWER}" != "" ]; then + NAMESERVER=${ANSWER} + echo "domain ${DOMAIN}" > ${ETC}/resolv.conf + echo "nameserver ${NAMESERVER}" >> ${ETC}/resolv.conf fi fi done |