diff options
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. |