summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Hall <halex@cvs.openbsd.org>2009-05-24 00:17:38 +0000
committerAlexander Hall <halex@cvs.openbsd.org>2009-05-24 00:17:38 +0000
commitb5f506b9f25d1b3831dcfcfc0a3e3a7584811f9b (patch)
tree090c21fa6c06e1e008f785dd76d04b54212a1e61
parent08e14ea43dbede7951d84b7e525c9f55fa73087e (diff)
Make select_sets insensitive to rougue user input and
allow [+-] prefixing per whitespace separated parameter. This makes it possible to write e.g. * -x* +xbase* done The previous way of entering multiple sets separated by pipes will no longer work. ok krw@
-rw-r--r--distrib/miniroot/install.sub40
1 files changed, 17 insertions, 23 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index 803880a57e2..d08eb476c74 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,4 +1,4 @@
-# $OpenBSD: install.sub,v 1.554 2009/05/19 07:46:03 halex Exp $
+# $OpenBSD: install.sub,v 1.555 2009/05/24 00:17:37 halex Exp $
# $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $
#
# Copyright (c) 1997-2009 Todd Miller, Theo de Raadt, Ken Westerback
@@ -514,35 +514,29 @@ sets by prepending a '-' to the set name, file name pattern or 'all'. Selected
sets are labelled '[X]'.
__EOT
while :; do
- _action=
for _f in $_avail; do
isin $_f $_selected && echo "[X] $_f" || echo "[ ] $_f"
done|showcols|sed 's/^/ /'
- ask "Set name? (or 'abort' or 'done')" done
- case $resp in
- abort) _selected=
- break ;;
- done) break ;;
- -*) _action=rmel ;;
- esac
-
- : ${_action:=addel}
- resp=${resp#+|-}
+ ask "Set name(s)? (or 'abort' or 'done')" done
- case $resp in
- "") continue ;;
- all) resp=* ;;
- esac
+ set -o noglob
+ for resp in $resp; do
+ case $resp in
+ abort) _selected=; break 2 ;;
+ done) break 2 ;;
+ -*) _action=rmel ;;
+ *) _action=addel ;;
+ esac
+ resp=${resp#[+-]}
+ [[ $resp = all ]] && resp=*
- # Use @($resp) rather than just $resp to protect
- # against silly user input that might cause syntax
- # errors.
- for _f in $_avail; do
- eval "case $_f in
- @($resp)) _selected=\`$_action $_f \$_selected\` ;;
- esac"
+ for _f in $_avail; do
+ [[ $_f = $resp ]] && _selected=$($_action $_f $_selected)
+ done
done
done
+
+ set +o noglob
COLUMNS=$_col
resp=$_selected