Exit prompt loop when there's nothing to read from stdin. This can happen

when stdin is redirected someplace unanticipated. This fixes the infinite
prompt loop when the port is built as a build depend of another port
(reported by Martin Toft <mt at martintoft.dk>). Still to do is fix
bsd.port.mk to not redirect stdin for build depends...
This commit is contained in:
kurt 2007-10-29 01:22:34 +00:00
parent 577546f8ad
commit f35ddca1d5
2 changed files with 34 additions and 24 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh
# $OpenBSD: license.sh,v 1.1 2007/10/25 20:51:41 kurt Exp $
# $OpenBSD: license.sh,v 1.2 2007/10/29 01:22:34 kurt Exp $
# $FreeBSD: ports/java/jdk15/files/license.sh,v 1.1 2007/08/13 04:57:47 glewis Exp $
# License agreement
@ -181,15 +181,20 @@ agreed=
while [ x$agreed = x ]; do
echo
echo "Do you agree to the above license terms? [yes or no] "
read reply leftover
case $reply in
y* | Y*)
agreed=1
;;
n* | N*)
echo
echo "If you don't agree to the license you can't build this software"
exit 1
;;
esac
if read reply leftover; then
case $reply in
y* | Y*)
agreed=1
;;
n* | N*)
echo
echo "If you don't agree to the license you can't build this software"
exit 1
;;
esac
else
echo
echo "An error occurred reading your response!"
exit 1
fi
done

View File

@ -1,5 +1,5 @@
#!/bin/sh
# $OpenBSD: license.sh,v 1.1 2007/09/06 15:46:18 kurt Exp $
# $OpenBSD: license.sh,v 1.2 2007/10/29 01:22:34 kurt Exp $
# $FreeBSD: ports/java/jdk15/files/license.sh,v 1.1 2007/08/13 04:57:47 glewis Exp $
# License agreement
@ -181,15 +181,20 @@ agreed=
while [ x$agreed = x ]; do
echo
echo "Do you agree to the above license terms? [yes or no] "
read reply leftover
case $reply in
y* | Y*)
agreed=1
;;
n* | N*)
echo
echo "If you don't agree to the license you can't build this software"
exit 1
;;
esac
if read reply leftover; then
case $reply in
y* | Y*)
agreed=1
;;
n* | N*)
echo
echo "If you don't agree to the license you can't build this software"
exit 1
;;
esac
else
echo
echo "An error occurred reading your response!"
exit 1
fi
done