diff options
author | Nick Daly <nick.m.daly@gmail.com> | 2010-02-07 16:13:09 -0600 |
---|---|---|
committer | Nick Daly <nick.m.daly@gmail.com> | 2010-02-07 16:13:09 -0600 |
commit | 4bceb4ab46d2c9a94193fbe900a6adfc62452fc7 (patch) | |
tree | 78f1df2ebd6e36a2b95cd7f837bd09a9250b24a4 /includes | |
parent | 1d5ba1b928aaef6ee43955dd3d53f1b0df1329a2 (diff) | |
download | gemrb-gameinstallers-4bceb4ab46d2c9a94193fbe900a6adfc62452fc7.tar.bz2 gemrb-gameinstallers-4bceb4ab46d2c9a94193fbe900a6adfc62452fc7.zip |
Corrected query function after including POL broke it.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/autoinstall-includes.sh | 38 |
1 files 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. |