diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2000-05-07 17:08:27 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2000-05-07 17:08:27 +0000 |
commit | ce3e4d0c69cb4983645a3ffda849830b1c112f33 (patch) | |
tree | 748fdde6086e4f17dbf0ac60e3b9c55b610b5eb4 /distrib/miniroot/install.sub | |
parent | d622259e9ff2e9f8d1432684ef4941d04fef2ee3 (diff) |
Add -n flag to getresp, indicating shell escapes are not to be allowed
Don't show gre interfaces when prompting user for an ether device
Diffstat (limited to 'distrib/miniroot/install.sub')
-rw-r--r-- | distrib/miniroot/install.sub | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index cad016758e0..ba27ef28f54 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: install.sub,v 1.151 2000/04/27 16:11:05 deraadt Exp $ +# $OpenBSD: install.sub,v 1.152 2000/05/07 17:08:26 millert Exp $ # $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $ # # Copyright (c) 1997,1998 Todd Miller, Theo de Raadt @@ -99,29 +99,39 @@ fi # get a reponse with default[s] getresp() { local _shell_aware=0 + local _no_shell=0 # -s option means exit after a shell (caller is shell-aware) if [ "$1" = "-s" ]; then _shell_aware=1 shift fi + # -n option means don't try to run shell commands + if [ "$1" = "-n" ]; then + _no_shell=1 + shift + fi set -o noglob valid="false" while [ "X$valid" = "Xfalse" ]; do read resp - case "$resp" in - "") resp=$1 - ;; - !) echo "Type 'exit' to return to install." - sh - test $_shell_aware -eq 0 && continue - ;; - !*) - eval ${resp#?} - test $_shell_aware -eq 0 && continue - ;; - esac + if [ ${_no_shell} -eq 1 ]; then + test -z "$resp" && resp=$1 + else + case "$resp" in + "") resp=$1 + ;; + !) echo "Type 'exit' to return to install." + sh + test $_shell_aware -eq 0 && continue + ;; + !*) + eval ${resp#?} + test $_shell_aware -eq 0 && continue + ;; + esac + fi if [ $# -gt 1 ]; then for i in $@; do if [ "X$resp" = "X$i" ]; then @@ -252,7 +262,7 @@ isnumeric() { get_ifdevs() { # return available network devices - /sbin/ifconfig -a | egrep -v '^([[:space:]]|(lo|enc|ppp|sl|tun|bridge)[[:digit:]])' | cutword -t: 1 + /sbin/ifconfig -a | egrep -v '^([[:space:]]|(lo|enc|gre|ppp|sl|tun|bridge)[[:digit:]])' | cutword -t: 1 } dir_has_sets() { @@ -978,7 +988,7 @@ if [ X"$_reuse" = X ]; then while [ "X${resp}" = X"" ]; do echo -n "Password (will not echo): " stty -echo - getresp "${_ftp_server_password}" + getresp -n "${_ftp_server_password}" stty echo echo _ftp_server_password=$resp |