diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2002-07-04 16:01:22 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2002-07-04 16:01:22 +0000 |
commit | 46e988268c02d83d50c71ffa8595096fb7f5c965 (patch) | |
tree | abb16ee09e87fce82d63798f908521f8c76a5db9 /distrib | |
parent | 6fe1ff94cfd4034345dc88e7085f47e08c8e169a (diff) |
Fix set selection list logic so that when extracting more sets
a) The selection list does not display default sets already
transferred.
b) Saying 'done' does not seem to mysteriously skip the sets
erroneously shown as selected due to a).
This problem was found by miod@.
In the process
a) Use _setsdone only to record sets that have successfully been
extracted.
b) Don't loop on fetching files if a transfer fails. Just let the user
know, and let the normal logic offer them a chance to extract the
failed sets from the same or different source.
c) Eliminate some (newly) dead variables, especially the global
_osetsdone.
Diffstat (limited to 'distrib')
-rw-r--r-- | distrib/miniroot/install.sub | 77 |
1 files changed, 25 insertions, 52 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 3e2fdd6e1d4..a1c95b575f2 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,4 +1,4 @@ -# $OpenBSD: install.sub,v 1.236 2002/06/29 20:01:34 krw Exp $ +# $OpenBSD: install.sub,v 1.237 2002/07/04 16:01:21 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 @@ -838,7 +838,7 @@ get_selection() { local _next=done _f _sets=$1 for _f in $_sets ; do - if isin $_f $_setsdone ; then + if isin $_f $_get_files ; then echo -n " [X] " else echo -n " [ ] " @@ -859,7 +859,7 @@ get_selection() { } # Do globbing on the selection and parse +/-, sets the global -# _get_files and _setsdone appropriately. +# _get_files appropriately. glob_selection() { local _selection=$1 _src=$2 _sets=$3 local _action _nomatch _f @@ -883,7 +883,6 @@ glob_selection() { eval "case $_f in $_selection) _get_files=\`$_action $_f \$_get_files\` - _setsdone=\`$_action $_f \$_setsdone\` _nomatch=false ;; esac" @@ -986,13 +985,11 @@ __EOT } # Set global _get_files to the list of sets requested by the user -# from $1. Add this list to _setsdone after saving current value -# of _setsdone. +# from $1. get_get_files_list () { local _src=$1 _get_files= - _osetsdone=$_setsdone # Set the default list of files for _f in $_sets ; do @@ -1001,7 +998,6 @@ get_get_files_list () { base*|bsd|comp*|etc*|game*|man*|misc*) if ! isin ${_f} ${_setsdone}; then _get_files=`addel ${_f} ${_get_files}` - _setsdone=`addel ${_f} ${_setsdone}` fi ;; esac @@ -1023,54 +1019,32 @@ get_get_files_list () { } # Install the list of files in the global _get_files from the source -# in $1, aka $2. For mounted file system installs $1==file:$2. For URL -# installs $1 == $_url_base and $2 == $1 w/o passwords, etc. +# named in $1. Display an error message for failed installs so the +# user will know to try again. install_get_files_list () { - local _f _failed_files _src=$1 _public_src=$2 + local _f _src=$1 ask "Ready to ${MODE} sets?" y - case $resp in - y*|Y*) ;; - *) _setsdone=$_osetsdone - return - ;; + case $resp in + n*|N*) return ;; esac - # Install/Upgrade the sets one at a time. Keep track of which - # ones fail. - while [ "$_get_files" ] ; do - _failed_files= - echo - for _f in $_get_files ; do - echo "Getting ${_f} ..." - case $_f in - *.tar.gz|*.tgz) - ftp ${_ftp_active} -o - -V -m "${_src}/${_f}" | tar zxpf - -C /mnt - ;; - *) - ftp ${_ftp_active} -o "/mnt/${_f}" -V -m "${_src}/${_f}" - ;; - esac - if [ $? -ne 0 ]; then - # Mark xfer as having failed,. - _setsdone=`rmel $_f $_setsdone` - _failed_files="${_failed_files} ${_f}" - fi - done - - # Offer the option of re-fetching failed files. - _get_files= - while [ "$_failed_files" ] ; do - display_failure_msg - - get_selection "$_failed_files" - - if [ "$resp" = "done" ]; then - break - fi - - glob_selection "$resp" "$_public_src" "$_failed_files" - done + echo + for _f in $_get_files ; do + echo "Getting ${_f} ..." + case $_f in + *.tar.gz|*.tgz) + ftp ${_ftp_active} -o - -V -m "${_src}/${_f}" | tar zxpf - -C /mnt + ;; + *) + ftp ${_ftp_active} -o "/mnt/${_f}" -V -m "${_src}/${_f}" + ;; + esac + if [ $? -ne 0 ]; then + echo "'${_f}' did not install correctly." + else + _setsdone=`addel ${_f} ${_setsdone}` + fi done } @@ -2180,7 +2154,6 @@ THESETS="base etc misc comp man game xbase xshare xfont xserv site $MDSETS" local_sets_dir= _sets= _setsdone= -_osetsdone= _get_files= # decide upon an editor |