1994-11-06 05:07:41 +01:00
|
|
|
#!/stand/sh
|
|
|
|
#
|
|
|
|
# bininst - perform the last stage of installation by somehow getting
|
|
|
|
# a bindist onto the user's disk and unpacking it. The name bininst
|
|
|
|
# is actually something of a misnomer, since this utility will install
|
|
|
|
# more than just the bindist set.
|
|
|
|
#
|
|
|
|
# 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 (no putting
|
|
|
|
# your name on top after doing something trivial like reindenting it, just
|
|
|
|
# to make it look like you wrote it!).
|
|
|
|
#
|
1994-11-07 07:23:07 +01:00
|
|
|
|
|
|
|
# Some useful constants.
|
|
|
|
PATH=/usr/bin:/usr/sbin:/bin:/sbin:/stand
|
|
|
|
export PATH
|
|
|
|
TAR=tar
|
|
|
|
TAR_FLAGS=xvf
|
1994-11-07 12:30:15 +01:00
|
|
|
TMP=/tmp
|
1994-11-07 14:43:27 +01:00
|
|
|
IFCONFIG=ifconfig
|
|
|
|
ROUTE=route
|
|
|
|
ROUTE_FLAGS="add default"
|
1994-11-06 05:07:41 +01:00
|
|
|
|
1994-11-07 14:43:27 +01:00
|
|
|
# Set the initial state of the system.
|
1994-11-06 05:07:41 +01:00
|
|
|
set_defaults() {
|
|
|
|
media_type="" ;
|
|
|
|
media_device="" ;
|
1994-11-07 14:43:27 +01:00
|
|
|
ipaddr="" ;
|
|
|
|
hostname="" ;
|
|
|
|
ether_intr="" ;
|
|
|
|
domain="" ;
|
|
|
|
netmask="" ;
|
|
|
|
ifconfig_flags="" ;
|
1994-11-07 07:23:07 +01:00
|
|
|
tmp_dir="/usr/tmp" ;
|
|
|
|
installing=1 ;
|
1994-11-07 12:30:15 +01:00
|
|
|
mkdir -p ${TMP}
|
1994-11-06 05:07:41 +01:00
|
|
|
}
|
|
|
|
|
1994-11-07 14:43:27 +01:00
|
|
|
# Handle the return value from a dialog, doing some pre-processing
|
|
|
|
# so that each client doesn't have to.
|
1994-11-06 05:07:41 +01:00
|
|
|
handle_rval() {
|
|
|
|
case $1 in
|
|
|
|
0)
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
255)
|
1994-11-07 14:43:27 +01:00
|
|
|
PS1="subshell# " /stand/sh
|
1994-11-06 05:07:41 +01:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
return 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
1994-11-07 14:43:27 +01:00
|
|
|
# A simple user-confirmation dialog.
|
1994-11-07 07:23:07 +01:00
|
|
|
confirm() {
|
1994-11-08 04:48:58 +01:00
|
|
|
dialog --title "Please Confirm" --msgbox "$*" 4 72
|
1994-11-07 07:23:07 +01:00
|
|
|
}
|
|
|
|
|
1994-11-07 14:43:27 +01:00
|
|
|
# A simple error dialog.
|
1994-11-07 07:23:07 +01:00
|
|
|
error() {
|
|
|
|
dialog --title "Error!" --msgbox "$*" 10 72
|
|
|
|
}
|
|
|
|
|
1994-11-07 14:43:27 +01:00
|
|
|
# Something isn't supported yet! :-(
|
1994-11-06 05:07:41 +01:00
|
|
|
not_supported() {
|
1994-11-07 07:23:07 +01:00
|
|
|
dialog --title "Sorry!" \
|
1994-11-07 14:43:27 +01:00
|
|
|
--msgbox "This feature is not supported in the current version of the \
|
|
|
|
installation tools. Barring some sort of fatal accident, we do \
|
|
|
|
expect it to be in the release. Please press RETURN to go on." 10 60
|
1994-11-06 05:07:41 +01:00
|
|
|
}
|
|
|
|
|
1994-11-07 14:43:27 +01:00
|
|
|
# Print welcome banner.
|
1994-11-06 05:07:41 +01:00
|
|
|
welcome() {
|
1994-11-07 07:23:07 +01:00
|
|
|
dialog --title "Welcome to FreeBSD" --clear \
|
1994-11-06 05:07:41 +01:00
|
|
|
--msgbox "Hi! Nice to see you've made it this far. We're now ready to
|
1994-11-07 12:30:15 +01:00
|
|
|
install one or more packed distribution sets onto your machine.
|
|
|
|
At the minimum, you need a bindist installation though a
|
|
|
|
secrdist is also useful if you want your system to have any kind
|
|
|
|
of effective security. The secrdist is a bit of a special case
|
|
|
|
since it cannot be legally obtained from the U.S. due to export
|
|
|
|
restrictions, but non-U.S. versions are also available. See the
|
|
|
|
release notes for more information on where to obtain a secrdist
|
|
|
|
for your part of the world." 15 72
|
1994-11-06 05:07:41 +01:00
|
|
|
if ! handle_rval $?; then return 1; fi
|
|
|
|
}
|
|
|
|
|
1994-11-07 14:43:27 +01:00
|
|
|
# Get values into $media_type and $media_device. Call network initialization
|
|
|
|
# if necessary.
|
1994-11-06 05:07:41 +01:00
|
|
|
choose_media() {
|
|
|
|
while [ "$media_device" = "" ]; do
|
|
|
|
|
1994-11-07 07:23:07 +01:00
|
|
|
dialog --clear --title "Chose installation media" \
|
1994-11-06 05:07:41 +01:00
|
|
|
--menu "Before we begin the installation, we need to chose and possibly \n\
|
|
|
|
configure your method of installation. Please pick from one of \n\
|
|
|
|
the following options. If your option isn't listed here, your \n\
|
|
|
|
best bet may be to simply select CANCEL to get a shell and proceed \n\
|
|
|
|
manually on your own. \n\n\
|
1994-11-07 07:23:07 +01:00
|
|
|
Please choose one of the following:" 20 72 5 \
|
1994-11-06 05:07:41 +01:00
|
|
|
"Tape" "Load installation from SCSI or QIC tape" \
|
|
|
|
"CDROM" "Load installation from SCSI or Mitsumi CDROM" \
|
|
|
|
"DOS" "Load from DOS floppies or a DOS hard disk partition" \
|
|
|
|
"FTP" "Load the distribution over ftp" \
|
1994-11-07 12:30:15 +01:00
|
|
|
"NFS" "Load the distribution over NFS" 2> ${TMP}/menu.tmp.$$
|
1994-11-06 05:07:41 +01:00
|
|
|
|
|
|
|
retval=$?
|
1994-11-07 12:30:15 +01:00
|
|
|
choice=`cat ${TMP}/menu.tmp.$$`
|
|
|
|
rm -f ${TMP}/menu.tmp.$$
|
1994-11-06 05:07:41 +01:00
|
|
|
if ! handle_rval $retval; then return 1; fi
|
|
|
|
|
|
|
|
case $choice in
|
|
|
|
Tape)
|
1994-11-07 07:23:07 +01:00
|
|
|
dialog --clear --title "Chose tape type" \
|
1994-11-06 05:07:41 +01:00
|
|
|
--menu "Which type of tape drive do you have attached to your \n\
|
|
|
|
system? FreeBSD supports the following types:\n\n\
|
1994-11-07 07:23:07 +01:00
|
|
|
Choose one of the following:" 20 72 2 \
|
1994-11-06 05:07:41 +01:00
|
|
|
"SCSI" "SCSI tape drive attached to standard SCSI controller" \
|
|
|
|
"QIC" "QIC tape drive (Colorado Jumbo, etc)" \
|
1994-11-07 12:30:15 +01:00
|
|
|
2> ${TMP}/menu.tmp.$$
|
1994-11-06 05:07:41 +01:00
|
|
|
retval=$?
|
1994-11-07 12:30:15 +01:00
|
|
|
choice=`cat ${TMP}/menu.tmp.$$`
|
|
|
|
rm -f ${TMP}/menu.tmp.$$
|
1994-11-06 05:07:41 +01:00
|
|
|
if ! handle_rval $retval; then continue; fi
|
|
|
|
media_type=tape;
|
|
|
|
case $choice in
|
|
|
|
SCSI)
|
|
|
|
media_device=/dev/rst0
|
|
|
|
;;
|
|
|
|
QIC)
|
|
|
|
media_device=/dev/rwt0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
CDROM)
|
1994-11-07 07:23:07 +01:00
|
|
|
dialog --clear --title "Chose CDROM type" \
|
|
|
|
--menu "Which type of CDROM drive do you have attached to your \n\
|
|
|
|
system? FreeBSD supports the following types:\n\n\
|
|
|
|
Choose one of the following:" 15 72 2 \
|
|
|
|
"SCSI" "SCSI CDROM drive attached to standard SCSI controller" \
|
|
|
|
"Mitsumi" "Mitsumi CDROM drive" \
|
1994-11-07 12:30:15 +01:00
|
|
|
2> ${TMP}/menu.tmp.$$
|
1994-11-07 07:23:07 +01:00
|
|
|
retval=$?
|
1994-11-07 12:30:15 +01:00
|
|
|
choice=`cat ${TMP}/menu.tmp.$$`
|
|
|
|
rm -f ${TMP}/menu.tmp.$$
|
1994-11-07 07:23:07 +01:00
|
|
|
if ! handle_rval $retval; then continue; fi
|
|
|
|
media_type=cdrom;
|
|
|
|
case $choice in
|
|
|
|
SCSI)
|
|
|
|
media_device=/dev/cd0d
|
|
|
|
;;
|
|
|
|
Mitsumi)
|
|
|
|
media_device=/dev/mcd0d
|
|
|
|
;;
|
|
|
|
esac
|
1994-11-06 05:07:41 +01:00
|
|
|
;;
|
|
|
|
DOS)
|
|
|
|
not_supported
|
|
|
|
;;
|
|
|
|
FTP)
|
1994-11-07 14:43:27 +01:00
|
|
|
if ! setup_network; then continue; fi
|
1994-11-07 07:23:07 +01:00
|
|
|
dialog --title "FTP Installation Information" --clear \
|
1994-11-06 05:07:41 +01:00
|
|
|
--inputbox "Please specify the machine and directory location of the
|
1994-11-07 07:23:07 +01:00
|
|
|
distribution you wish to load. This should be either a \"URL style\"
|
|
|
|
specification (e.g. something like ftp://ftp.freeBSD.org/pub/...) or
|
|
|
|
simply the name of a host to connect to. If only a host name is
|
|
|
|
specified, the installation assumes that you will properly connect
|
|
|
|
and \"mget\" the files yourself.\n\n" \
|
1994-11-07 12:30:15 +01:00
|
|
|
16 72 "ftp://ftp.freebsd.org/pub/FreeBSD/2.0-ALPHA/bindist/" 2> ${TMP}/inputbox.tmp.$$
|
1994-11-06 05:07:41 +01:00
|
|
|
if ! handle_rval $?; then continue; fi
|
|
|
|
media_type=ftp
|
1994-11-07 12:30:15 +01:00
|
|
|
media_device=`cat ${TMP}/inputbox.tmp.$$`
|
1994-11-07 14:43:27 +01:00
|
|
|
rm -f ${TMP}/inputbox.tmp.$$
|
1994-11-06 05:07:41 +01:00
|
|
|
;;
|
|
|
|
NFS)
|
1994-11-07 14:43:27 +01:00
|
|
|
setup_network
|
1994-11-06 05:07:41 +01:00
|
|
|
not_supported
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
1994-11-07 14:43:27 +01:00
|
|
|
# Set the location of our temporary unpacking directory.
|
1994-11-07 07:23:07 +01:00
|
|
|
set_tmpdir()
|
|
|
|
{
|
|
|
|
dialog --title "Chose temporary directory" --clear \
|
|
|
|
--inputbox "Please specify the name of a directory containing enough
|
|
|
|
free space to hold the temporary files for this distribution.
|
|
|
|
At minimum, a binary distribution will require around 10MB.
|
|
|
|
At maximum, a srcdist may take 60MB or more. If the directory
|
|
|
|
you specify does not exist, it will be created for you.\n\n" \
|
1994-11-07 14:43:27 +01:00
|
|
|
16 72 "/usr/tmp" 2> ${TMP}/inputbox.tmp.$$
|
|
|
|
if ! handle_rval $?; then return 1; fi
|
1994-11-07 12:30:15 +01:00
|
|
|
tmp_dir=`cat ${TMP}/inputbox.tmp.$$`
|
1994-11-07 14:43:27 +01:00
|
|
|
rm -f ${TMP}/inputbox.tmp.$$
|
1994-11-07 07:23:07 +01:00
|
|
|
mkdir -p $tmp_dir
|
1994-11-07 14:43:27 +01:00
|
|
|
echo wahoo
|
1994-11-07 07:23:07 +01:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
cd_tmpdir()
|
|
|
|
{
|
1994-11-07 14:43:27 +01:00
|
|
|
if ! cd $tmp_dir; then
|
1994-11-07 07:23:07 +01:00
|
|
|
error "No such file or directory for ${tmp_dir}, sorry! Please fix this and try again."
|
1994-11-07 14:43:27 +01:00
|
|
|
return 1
|
1994-11-07 07:23:07 +01:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
rm_tmpdir()
|
|
|
|
{
|
|
|
|
if dialog --title "Delete contents?" --clear \
|
|
|
|
--yesno "Do you wish to delete the contents of ${tmp_dir}?" 5 72; then
|
|
|
|
rm -rf $tmp_dir/*
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
1994-11-07 14:43:27 +01:00
|
|
|
setup_network_ether()
|
|
|
|
{
|
|
|
|
dialog --clear --title "Ethernet Interface Name" \
|
|
|
|
--menu "Please select the type of ethernet device you have:\n\n" \
|
|
|
|
20 72 4 \
|
|
|
|
"ed0" "WD80x3, SMC, Novell NE1000/2000 or 3C503 generic NIC" \
|
|
|
|
"ie0" "AT&T StarLan and EN100 family" \
|
|
|
|
"is0" "Isolan 4141-0 or Isolink 4110 Ethernet controller" \
|
|
|
|
2> ${TMP}/menu.tmp.$$
|
|
|
|
|
|
|
|
retval=$?
|
|
|
|
interface=`cat ${TMP}/menu.tmp.$$`
|
|
|
|
rm -f ${TMP}/menu.tmp.$$
|
|
|
|
if ! handle_rval $retval; then return 1; fi
|
|
|
|
}
|
|
|
|
|
|
|
|
setup_network_slip()
|
|
|
|
{
|
|
|
|
not_supported
|
|
|
|
}
|
|
|
|
|
|
|
|
setup_network_ppp()
|
|
|
|
{
|
|
|
|
not_supported
|
|
|
|
}
|
|
|
|
|
|
|
|
setup_network_plip()
|
|
|
|
{
|
|
|
|
not_supported
|
|
|
|
}
|
|
|
|
|
|
|
|
setup_network()
|
|
|
|
{
|
|
|
|
done=0
|
|
|
|
while [ "$interface" = "" ]; do
|
|
|
|
dialog --clear --title "Set up network interface" \
|
|
|
|
--menu "Please select the type of network connection you have:\n\n" \
|
|
|
|
20 72 4 \
|
|
|
|
"ether" "A supported ethernet card" \
|
|
|
|
"SLIP" "A point-to-point SLIP (Serial Line IP) connection" \
|
|
|
|
"PPP" "A point-to-point protocol link" \
|
|
|
|
"PLIP" "A Parallel-Line IP setup (sort of like lap-link)" \
|
|
|
|
2> ${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 ! setup_network_ether; then continue; fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
SLIP)
|
|
|
|
if ! setup_network_slip; then continue; fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
PPP)
|
|
|
|
if ! setup_network_ppp; then continue; fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
PLIP)
|
|
|
|
if ! setup_network_plip; then continue; fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
if [ "$interface" = "" ]; then continue; fi
|
|
|
|
dialog --title "Hostname Information" --clear \
|
|
|
|
--inputbox "Please specify the name of this host" 5 60 "foo" \
|
|
|
|
2> ${TMP}/inputbox.tmp.$$
|
|
|
|
if ! handle_rval $?; then return 1; fi
|
|
|
|
hostname=`cat ${TMP}/inputbox.tmp.$$`
|
|
|
|
rm -f ${TMP}/inputbox.tmp.$$
|
|
|
|
|
|
|
|
dialog --title "Address Information" --clear \
|
|
|
|
--inputbox "Please specify the IP address of this host" 5 60 "" \
|
|
|
|
2> ${TMP}/inputbox.tmp.$$
|
|
|
|
if ! handle_rval $?; then return 1; fi
|
|
|
|
ipaddr=`cat ${TMP}/inputbox.tmp.$$`
|
|
|
|
rm -f ${TMP}/inputbox.tmp.$$
|
|
|
|
|
|
|
|
dialog --title "Netmask Information" --clear \
|
|
|
|
--inputbox "Please specify the netmask" 5 60 "0xffffff00" \
|
|
|
|
2> ${TMP}/inputbox.tmp.$$
|
|
|
|
if handle_rval $?; then
|
|
|
|
netmask=`cat ${TMP}/inputbox.tmp.$$`
|
|
|
|
else
|
|
|
|
netmask="0xffffff00"
|
|
|
|
fi
|
|
|
|
rm -f ${TMP}/inputbox.tmp.$$
|
|
|
|
|
|
|
|
dialog --title "Extra Information" --clear \
|
|
|
|
--inputbox "Any extra flags to ifconfig?" 5 60 "" \
|
|
|
|
2> ${TMP}/inputbox.tmp.$$
|
|
|
|
if handle_rval $?; then
|
|
|
|
ifconfig_flags=`cat ${TMP}/inputbox.tmp.$$`
|
|
|
|
fi
|
1994-11-08 04:48:58 +01:00
|
|
|
if ! $IFCONFIG inet $interface netmask $netmask $ifconfig_flags 2>/dev/ttyv1 ; then
|
1994-11-07 14:43:27 +01:00
|
|
|
error "Unable to configure interface $interface"
|
|
|
|
ipaddr=""; interface=""
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
rm -f ${TMP}/inputbox.tmp.$$
|
|
|
|
|
|
|
|
dialog --title "Gateway host" --clear \
|
|
|
|
--inputbox "Please specify the gateway host, if any" 5 60 "" \
|
|
|
|
2> ${TMP}/inputbox.tmp.$$
|
|
|
|
if handle_rval $?; then
|
|
|
|
gateway=`cat ${TMP}/inputbox.tmp.$$`
|
|
|
|
if [ "$gateway" = "" ]; then
|
|
|
|
:;
|
|
|
|
else
|
1994-11-08 04:48:58 +01:00
|
|
|
$ROUTE $route_flags $gateway 2>/dev/ttyv1
|
1994-11-07 14:43:27 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
rm -f ${TMP}/inputbox.tmp.$$
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
1994-11-06 05:07:41 +01:00
|
|
|
install_set()
|
|
|
|
{
|
1994-11-07 07:23:07 +01:00
|
|
|
case $media_type in
|
|
|
|
tape)
|
1994-11-07 14:43:27 +01:00
|
|
|
if ! set_tmpdir; then return; fi
|
|
|
|
if ! cd_tmpdir; then return; fi
|
1994-11-07 07:23:07 +01:00
|
|
|
confirm "Please mount tape for ${media_device}."
|
1994-11-07 14:43:27 +01:00
|
|
|
dialog --title "Results of tape extract" --clear \
|
1994-11-07 07:23:07 +01:00
|
|
|
--prgbox "$TAR $TAR_FLAGS $media_device" 10 72
|
|
|
|
if [ -f extract.sh ]; then
|
|
|
|
sh ./extract.sh
|
|
|
|
else
|
|
|
|
error "This isn't a proper distribution. No installation script found."
|
|
|
|
fi
|
|
|
|
rm_tmpdir
|
|
|
|
;;
|
|
|
|
|
|
|
|
cdrom)
|
|
|
|
not_supported
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
|
|
|
|
dos)
|
1994-11-07 14:43:27 +01:00
|
|
|
if ! set_tmpdir; then return; fi
|
|
|
|
if ! cd_tmpdir; then return; fi
|
1994-11-07 07:23:07 +01:00
|
|
|
not_supported
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
ftp)
|
1994-11-07 14:43:27 +01:00
|
|
|
if ! set_tmpdir; then return; fi
|
|
|
|
if ! cd_tmpdir; then return; fi
|
1994-11-07 07:23:07 +01:00
|
|
|
if ! echo $media_device | grep -v 'ftp://'; then
|
1994-11-07 14:43:27 +01:00
|
|
|
if ! ncftp $media_device/* ; then
|
1994-11-07 07:23:07 +01:00
|
|
|
error "Couldn't fetch distribution from ${media_device}!"
|
|
|
|
else
|
|
|
|
if [ -f extract.sh ]; then
|
|
|
|
sh ./extract.sh
|
|
|
|
else
|
|
|
|
error "This isn't a proper distribution. No installation script found."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
ftp $media_device
|
|
|
|
if [ -f extract.sh ]; then
|
|
|
|
sh ./extract.sh
|
|
|
|
else
|
|
|
|
error "No installation script found. Please grab the right bits."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
rm_tmpdir
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
|
|
|
|
nfs)
|
|
|
|
not_supported
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
esac
|
1994-11-06 05:07:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
welcome
|
1994-11-07 07:23:07 +01:00
|
|
|
set_defaults
|
1994-11-06 05:07:41 +01:00
|
|
|
|
1994-11-07 07:23:07 +01:00
|
|
|
while [ $installing -eq 1 ]; do
|
1994-11-06 05:07:41 +01:00
|
|
|
if choose_media; then
|
|
|
|
install_set
|
1994-11-07 07:23:07 +01:00
|
|
|
media_device=""; media_type=""
|
1994-11-06 05:07:41 +01:00
|
|
|
else
|
1994-11-07 07:23:07 +01:00
|
|
|
confirm "Exiting per user request.";
|
|
|
|
installing=0
|
1994-11-06 05:07:41 +01:00
|
|
|
fi
|
|
|
|
done
|
1994-11-08 04:48:58 +01:00
|
|
|
exec /stand/sh
|