diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2002-10-28 00:36:05 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2002-10-28 00:36:05 +0000 |
commit | 53589eb972d24685a5afb2e75c8569cb4ff36552 (patch) | |
tree | aafe807ebda44e19198e3352d6885f7de042900d /distrib | |
parent | 5b43a9d2739a580d1a575e750198317bd1527d78 (diff) |
Rework/reword the install sanity checks and associated logic slightly.
1) Do all three sanity checks (for bsd, base32, etc32) every time so
the user is aware of all three problems asap. Make the error messages
stand out, and refer explicitly to the sets that should fix the
problem.
2) Use standard 'done' logic to exit the set selection loop rather than
ask a separate question. One side effect: a <cr> at the set location
prompt now just causes the redisplay of the prompt rather than an
error.
3) Remove 'suspect' sets from the SETSDONE list so that if bsd, base32
or etc32 are found to be wanting, they are automatically selected the
next time they appear on the list of available sets.
4) But the $MDSETS (and therefore the 'bsd' set) first on the
selection list. This puts all three 'required' sets at the top of the
list where they seem to belong.
Diffstat (limited to 'distrib')
-rw-r--r-- | distrib/miniroot/install.sub | 119 |
1 files changed, 63 insertions, 56 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 87042782dd0..ff74a71604a 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,4 +1,4 @@ -# $OpenBSD: install.sub,v 1.266 2002/10/27 14:05:21 krw Exp $ +# $OpenBSD: install.sub,v 1.267 2002/10/28 00:36:04 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 @@ -1520,44 +1520,71 @@ set_timezone() { done } +# Remove $1 from $SETSDONE, taking account of the different +# possible suffixes - none for bsd, .tgz or .tar.gz for the +# other sets. +set_not_done () { + local _set=$1 + + SETSDONE=`rmel $_set $SETSDONE` + SETSDONE=`rmel ${_set}.tgz $SETSDONE` + SETSDONE=`rmel ${_set}.tar.tgz $SETSDONE` +} + +# Check that required sets were successfully installed by checking +# for the presence of a 'random' selection of their contents. +# +# Required sets are: +# 1) bsd +# 2) baseXX +# 3) etcXX +# +# If a 'problem' set is found, remove it from SETSDONE list. sane_install() { - if [ ! -s /mnt/bsd ]; then - cat << __EOT + local _insane -Warning, no kernel (/mnt/bsd) installed! You did not unpack a file set -containing a kernel -- this is needed to boot. Please note that the install -kernel is *not* suitable for general use. -__EOT - elif [ ! -f /mnt/bin/cat ]; then + # Check if bsd is installed and >0 bytes in size. + if [[ ! -s /mnt/bsd ]]; then + _insane=y + set_not_done bsd cat << __EOT -You still do not have a /bin/cat in your filesystem (i.e. a sample random file -which you probably want). This seems to indicate that you are still missing -important distribution files. +*** /bsd is not present in the installed system, or is 0 bytes long. OpenBSD + cannot boot without a valid kernel! 'bsd' must be (re)installed. __EOT - elif [ ! -x /mnt/dev/MAKEDEV ]; then + fi + + # Check if baseXX is installed. + if [[ ! -x /mnt/bin/cat || ! -x /mnt/dev/MAKEDEV ]]; then + _insane=y + set_not_done base${VERSION} cat << __EOT -No /dev/MAKEDEV has been installed yet. +*** One or both of the executable files /bin/cat and /dev/MAKEDEV are not + present in the installed system. This indicates that executable files + OpenBSD requires are missing. 'base${VERSION}' must be (re)installed. __EOT + fi - elif [ ! -d /mnt/etc -o ! -d /mnt/usr/share/zoneinfo -o ! -d /mnt/dev ]; then + # Check if etcXX is installed. + if [[ ! -d /mnt/etc || ! -d /mnt/usr/share/zoneinfo || ! -d /mnt/dev ]]; then + _insane=y + set_not_done etc${VERSION} cat << __EOT -One or more of /etc, /usr/share/zoneinfo or /dev is missing. Did you -forget to extract a required set? +*** One or more of the directories /etc, /usr/share/zoneinfo and /dev are not + present in the installed system. This indicates that directories OpenBSD + requires are missing. 'etc${VERSION}' must be (re)installed. __EOT - else - return 0 fi - cat << __EOT - -You can now try to install the missing set(s), or you can enter '!' at the -prompt to escape to a shell and fix things by hand. -__EOT + resp= + [[ -n $_insane ]] && ask "\nDo you want to (re)install the problem sets?" y - return 1 + case $resp in + Y*|y*) return 1 ;; + *) return 0 ;; + esac } # Ask the user for locations of sets, and then install whatever sets the @@ -1578,39 +1605,18 @@ __EOT Sets can be located on a (m)ounted filesystem; a (c)drom, (d)isk or (t)ape device; or a (f)tp, (n)fs or (h)ttp server. __EOT - ask "Where are the ${MODE} sets you want to use? (m, c, f, etc.)" - - 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 - - # Give the user the opportunity to extract more sets. + ask "Where are the ${MODE} sets? (or 'done')" - ask "Extract 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 - ;; + done) sane_install && return ;; + 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 ;; + *) ;; esac done } @@ -1990,8 +1996,9 @@ IFDEVS=`get_ifdevs` # Devices created with makedev(). DEVSMADE= +# $MDSETS is the list of kernels for an architecture. # extra "site" set can be provided by person doing install or upgrade. -THESETS="base etc misc comp man game xbase xshare xfont xserv $MDSETS site" +THESETS="$MDSETS base etc misc comp man game xbase xshare xfont xserv site" # Global variable using during sets installation SETS= |