From f35ddca1d5312ec7fca67d621efb8e085c179e4e Mon Sep 17 00:00:00 2001 From: kurt Date: Mon, 29 Oct 2007 01:22:34 +0000 Subject: [PATCH] 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 ). Still to do is fix bsd.port.mk to not redirect stdin for build depends... --- devel/jdk/1.5/files/license.sh | 29 +++++++++++++++++------------ devel/jdk/1.7/files/license.sh | 29 +++++++++++++++++------------ 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/devel/jdk/1.5/files/license.sh b/devel/jdk/1.5/files/license.sh index 135bf591fa2..bdd6545dc0d 100644 --- a/devel/jdk/1.5/files/license.sh +++ b/devel/jdk/1.5/files/license.sh @@ -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 diff --git a/devel/jdk/1.7/files/license.sh b/devel/jdk/1.7/files/license.sh index a1e0ea38b54..bdd6545dc0d 100644 --- a/devel/jdk/1.7/files/license.sh +++ b/devel/jdk/1.7/files/license.sh @@ -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