diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2010-03-04 02:07:56 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2010-03-04 02:07:56 +0000 |
commit | 007ff749791b57eca73399c79e8f8930e06c15b7 (patch) | |
tree | 6116d01992c70ffca9727777750d8fd9bbfd8f28 | |
parent | 26dafcc10343084355020a7631e1f7357b57993b (diff) |
Gracefully handle trailing '/'s when asking for [sub]Timezones.
i.e. ignore them all. Problem pointed out by Sebastian Rother. More
script discipline and voodoo from halex@.
ok halex@ deraadt@
-rw-r--r-- | distrib/miniroot/install.sub | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 77f06bba2a6..280a7a5685c 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,4 +1,4 @@ -# $OpenBSD: install.sub,v 1.597 2010/03/02 01:24:50 krw Exp $ +# $OpenBSD: install.sub,v 1.598 2010/03/04 02:07:55 krw 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 @@ -1418,19 +1418,18 @@ set_timezone() { [[ $_zonefile = /var/tzlist && -z $TZ ]] && return while :; do - _zonepath="" - ask "What timezone are you in? ('?' for list)" "$TZ" - - if [[ $resp = "?" ]]; then - grep -v /. $_zonefile | showcols - continue - fi - _zonepath=$_zonepath$resp + _zonepath=${resp%%*(/)} + case $_zonepath in + "") continue ;; + "?") grep -v /. $_zonefile | showcols + continue ;; + esac while isin $_zonepath/ $(cat $_zonefile); do ask "What sub-timezone of '$_zonepath' are you in? ('?' for list)" _zsed=$(echo $_zonepath/ | sed 's,/,\\/,g') + resp=${resp%%*(/)} case $resp in "") ;; "?") sed -n "/^$_zsed/{s/$_zsed//;/\/./!p;}" $_zonefile | showcols ;; |