summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2002-06-25 00:32:00 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2002-06-25 00:32:00 +0000
commitdba4f05c387021972cc23f7ef094ddcd8832381c (patch)
treefdcc88d0a07d4e28cf4df6def38b9e673f3e27aa
parentc9317bed7464925ef8cef708f1be0d75cbd39ce4 (diff)
Complete yet more of the c2k2 initiated changes. In this round:
1) Centralize selection of install/upgrade media rather than ask separately for mounted filesystem. Eliminate separate calls to get_localdir in install.sh and upgrade.sh. In install.sh this call occurred only if a diskless system was detected, which millert@ agreed was a historical relic, i.e. what exactly would a diskless workstation be installing to? 2) Check for the presence of any mounted filesystems at the expected mount point (/mnt or /mnt2) and emit an error message if none found. 3) Add a '?' option to the pathname question so you can see what filesystems are mounted at/below the expected mount point. 4) Rework logic in get_localdir to make flow more logical. e.g. only do sane_install() check after the user says to install no more sets; if sane_install() fails ask a slightly different question and make the default 'y' to install more sets. 5) Rework install_sets() to simplify logic. Don't try to tailor list of install media to system, just warn that some may not be available and emit useful error messages if the user tries a non-available source. Some verbiage still needs work (amoung other things). fgsch@ noticed problems with installing from mounted filesystems, forcing me to finish these changes.
-rw-r--r--distrib/miniroot/install.sh14
-rw-r--r--distrib/miniroot/install.sub163
-rw-r--r--distrib/miniroot/upgrade.sh8
3 files changed, 81 insertions, 104 deletions
diff --git a/distrib/miniroot/install.sh b/distrib/miniroot/install.sh
index 51ba71f3780..0237cb9187f 100644
--- a/distrib/miniroot/install.sh
+++ b/distrib/miniroot/install.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# $OpenBSD: install.sh,v 1.102 2002/05/20 16:53:57 krw Exp $
+# $OpenBSD: install.sh,v 1.103 2002/06/25 00:31:59 krw Exp $
# $NetBSD: install.sh,v 1.5.2.8 1996/08/27 18:15:05 gwr Exp $
#
# Copyright (c) 1997-2002 Todd Miller, Theo de Raadt, Ken Westerback
@@ -280,18 +280,6 @@ fi
mount_fs "-o async"
-mount | while read line; do
- set -- $line
- if [ "$3" = "/" -a "$5" = "nfs" ]; then
- echo "You appear to be running diskless."
- ask "Are the install sets on one of your currently mounted filesystems?" n
- case $resp in
- y*|Y*) get_localdir
- ;;
- esac
- fi
-done
-
echo '\nPlease enter the initial password that the root account will have.'
_oifs=$IFS
IFS=
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index 057a6425124..dc8d8d5d28f 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,4 +1,4 @@
-# $OpenBSD: install.sub,v 1.234 2002/06/15 16:03:40 fgsch Exp $
+# $OpenBSD: install.sub,v 1.235 2002/06/25 00:31:59 krw Exp $
# $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $
#
# Copyright (c) 1997-2002 Todd Miller, Theo de Raadt, Ken Westerback
@@ -341,35 +341,48 @@ __EOT
# $1 is the mountpoint the local directory will be relative to.
# $2 is the default directory
get_localdir() {
- local _mp=$1 _dir=$2
-
+ local _mp=$1 _dir=$2 _mounted
+
local_sets_dir=
+
+ _mounted=`mount | sed -ne "/\(.*\)\/\(${_mp#/}\)\/*\(.*\) type.*/s//\/\3/p"`
+
+ if [ -z "$_mounted" ]; then
+ echo "No filesystems mounted at or below ${_mp}."
+ return
+ fi
+
while : ; do
- ask "Enter the pathname where the sets are stored (or abort)" "$_dir"
+ ask "Enter the pathname where the sets are stored (or '?')" "$_dir"
case $resp in
- abort) return;;
- "") continue;;
- *) ;;
- esac
+ "?") cat << __EOT
+The following filesystems are mounted at or below ${_mp} and are therefore
+possible sources for ${MODE} sets:
- _dir=$_mp/$resp
+${_mounted}
- if [ ! -d "$_dir" ]; then
- echo "The directory '${_dir}' does not exist"
- elif list_has_sets "`ls -l ${_dir}`" $THESETS; then
- local_sets_dir=$_dir
- return
- else
- cat << __EOT
+__EOT
+ continue
+ ;;
+ "") ;;
+ *) if [ ! -d "${_mp}/${resp}" ]; then
+ echo "The directory '${resp}' does not exist."
+ elif list_has_sets "`ls -l ${_mp}/${resp}`" $THESETS; then
+ local_sets_dir=${_mp}/${resp}
+ return
+ else
+ cat << __EOT
The directory
- "$_dir"
+ "$resp"
does not hold any OpenBSD ${VERSION_MAJOR}.${VERSION_MINOR} ${MODE} sets.
__EOT
- fi
+ fi
+ ;;
+ esac
- ask "Re-enter pathname?" y
+ ask "\nRe-enter pathname?" y
case $resp in
y*|Y*) ;;
*) break
@@ -1287,7 +1300,7 @@ install_cdrom() {
# Get the cdrom device info
if [ -z "$_CDDEVS" ]; then
- echo "No CD-ROM devices were found. Aborting."
+ echo "No CD-ROM devices are available."
return
fi
@@ -1730,81 +1743,63 @@ __EOT
return 1
}
+# Ask the user for locations of sets, and then install whatever sets the
+# user selects from that location. Repeat as many times as the user
+# needs to get all desired sets.
install_sets() {
- local _yup=FALSE _have_nfs
+ cat << __EOT
- # Can we do an NFS install?
- [ -f /sbin/mount_nfs ] && _have_nfs=true
+You will now be asked for the location of the ${MODE} sets you want to
+use, and then which sets to actually use. These steps will repeat
+until you are satisfied that all the sets you want have been
+loaded. Thus you will be able to load sets from multiple locations,
+and you can recover from some errors.
- # Ask the user which media to load the distribution from.
- cat << __EOT
+__EOT
-You must now specify where the ${MODE} sets you want to use are. They
-must either be on a local device (disk, tape, or CD-ROM), an
-accessible NFS filesystem or an accessible ftp or http network
-server. You will have the chance to repeat this step or to extract
-sets from several places, so you do not have to try to load all the
-sets in one try and can recover from some errors.
+ while : ; do
+ cat << __EOT
+Sets can be located on a
+
+ (m)ounted filesystem
+ (c)drom, (d)isk or (t)ape device
+ (f)tp, (n)fs or (h)ttp server
__EOT
+ ask "Where are the ${MODE} sets you want to use? (m, c, f, etc.)"
- if [ "$local_sets_dir" ]; then
- install_mounted_fs "$local_sets_dir"
- [ "$_setsdone" ] && _yup=TRUE
- fi
+ case $resp in
+ c*|C*) install_cdrom
+ ;;
+ d*|D*) install_disk
+ ;;
+ f*|F*) install_url ftp
+ ;;
+ h*|H*) install_url http
+ ;;
+ m*|M*) install_mounted_fs /mnt
+ ;;
+ n*|N*) install_nfs
+ ;;
+ t*|T*) install_tape
+ ;;
+ *) echo "Invalid response: $resp"
+ ;;
+ esac
- # Go on prodding for alternate locations
- resp=
- while [ -z "$resp" ]; do
- # If _yup is not FALSE, it means that we extracted sets above.
- # If that's the case, bypass the menu the first time.
- if [ "$_yup" = "FALSE" ]; then
- echo -n "Install from (f)tp, (h)ttp, (t)ape, (C)D-ROM"
- [ "$_have_nfs" ] && echo -n ", (N)FS"
- ask " or local (d)isk?"
- case $resp in
- d*|D*) install_disk
- resp=d
- ;;
- f*|F*) install_url ftp
- resp=f
- ;;
- h*|H*) install_url http
- resp=h
- ;;
- t*|T*) install_tape
- resp=t
- ;;
- c*|C*) install_cdrom
- resp=c
- ;;
- n*|N*) install_nfs
- resp=n
- ;;
- *) echo "Invalid response: $resp"
- resp=
- ;;
- esac
- else
- # So we'll ask next time
- _yup=FALSE
- fi
+ # Give the user the opportunity to extract more sets.
- # Perform sanity checks...
- if sane_install; then
- # Give the user the opportunity to extract more sets. They
- # don't necessarily have to come from the same media.
- ask "\nExtract more sets?" n
- case $resp in
- y*|Y*)
- # Force loop to repeat
- resp=
+ ask "\nExtract more sets?" n
+ case $resp in
+ n*|N*) # Perform sanity checks...
+ sane_install && break
+ ask "\nDo you want to extract more sets?" y
+ case $resp in
+ n*|N*) break
;;
esac
- else
- # Not sane, don't exit loop.
- resp=
- fi
+ ;;
+ esac
done
}
diff --git a/distrib/miniroot/upgrade.sh b/distrib/miniroot/upgrade.sh
index 152761fbdd0..98e3c442cee 100644
--- a/distrib/miniroot/upgrade.sh
+++ b/distrib/miniroot/upgrade.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# $OpenBSD: upgrade.sh,v 1.34 2002/04/29 01:38:06 krw Exp $
+# $OpenBSD: upgrade.sh,v 1.35 2002/06/25 00:31:59 krw Exp $
# $NetBSD: upgrade.sh,v 1.2.4.5 1996/08/27 18:15:08 gwr Exp $
#
# Copyright (c) 1997-2002 Todd Miller, Theo de Raadt, Ken Westerback
@@ -197,12 +197,6 @@ if [ -d /mnt/usr/X11R6/lib/X11 ]; then
fi
)
-ask "Are the upgrade sets on one of your normally mounted (local) filesystems?" y
-case $resp in
-y*|Y*) get_localdir /mnt
- ;;
-esac
-
# Install sets.
install_sets $THESETS