From 4bceb4ab46d2c9a94193fbe900a6adfc62452fc7 Mon Sep 17 00:00:00 2001 From: Nick Daly Date: Sun, 7 Feb 2010 16:13:09 -0600 Subject: Corrected query function after including POL broke it. --- includes/autoinstall-includes.sh | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/includes/autoinstall-includes.sh b/includes/autoinstall-includes.sh index cff3499..f4be783 100644 --- a/includes/autoinstall-includes.sh +++ b/includes/autoinstall-includes.sh @@ -19,7 +19,6 @@ ### functions ### -# a simplified version of query() from sorcery # $1 = question # $2 = default boolean answer [yYnN] # $3 = title @@ -28,13 +27,48 @@ function query { # usage: query question default [title] [longExplanation] + if [ "$3" ]; then + echo -e "$3" + echo "========================================" + echo + fi + + if [ "$4" ]; then + echo -e "$4" + echo + fi + + + while true; do + RESPONSE="" + echo -e -n "$1 [$2] " + read -n 1 RESPONSE + echo + + RESPONSE=${RESPONSE:=$2} + case $RESPONSE in + n|N) return 1 ;; + y|Y) return 0 ;; + esac + done +} + +# a simplified version of query() from sorcery +# $1 = question +# $2 = default boolean answer [yYnN] +# $3 = title +# $4 = long explanation +function new_query +{ + # usage: query question default [title] [longExplanation] + if [ "$PLAYONLINUX" ]; then RESPONSE=query_playOnLinux "$1" "$2" "$3" "$4" else RESPONSE=query_text "$1" "$2" "$3" "$4" fi - return "$RESPONSE" + return $RESPONSE } # a simplified version of query(), modified for PoL. -- cgit v1.2.3