From 537887c1a6463d26e212bd1ba79894400d0fb370 Mon Sep 17 00:00:00 2001 From: teldra Date: Mon, 7 Feb 2022 04:09:57 +0100 Subject: [PATCH] progress --- functions | 31 +++++++++++++++++++++++++++++++ main.sh | 10 +++++----- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/functions b/functions index fed2507..401658f 100644 --- a/functions +++ b/functions @@ -82,3 +82,34 @@ multiplechoice() { done } + +yesno() { + local input="" + local retval="" + local default="" + local q="" + case "${2}" in + Y|y) q="${1} [Y|n]:"; default=y;; + N|n) q="${1} [y|N]:"; default=n;; + esac + while read -r -p "${q} " input; do + test -z "${input}" && input="${default}" + case "${input}" in + y*|Y*|*es*|*ES*|*Es*|*eS*|1) + retval=1 + break + ;; + n*|N*|0) + retval="" + break + ;; + *) wronginput "${input}" "${choices[*]}" + ;; + esac + done + if [[ -z "${retval}" ]]; then + return 1 + else + return 0 + fi +} diff --git a/main.sh b/main.sh index 69f7ac1..7d94733 100644 --- a/main.sh +++ b/main.sh @@ -162,7 +162,7 @@ base() { } gfx() { - input_old "Which GFX System?" "amd nvidia intel" "unknown error" + multiplechoice "amd" "nvidia" "intel" GFX=$output . ./etc/gfx/$GFX packages @@ -170,7 +170,7 @@ gfx() { } soundsystem() { - input_old "Which Soundsystem" "pulseaudio pipewire" "unknown error" + multiplechoice "pulseaudio" "pipewire" SOUNDSYSTEM=$output . ./etc/soundsystem/$SOUNDSYSTEM packages @@ -178,7 +178,7 @@ soundsystem() { } de() { - input_old "Which Desktop Environment?" "plasma gnome minimal" "unknown error" + multiplechoice "plasma" "gnome" "minimal" DE=$output if ! [ "$DE" == "minimal" ]; then gfx @@ -190,14 +190,14 @@ de() { } printing() { - input_old "Do you want printing?" "yes no" "unknown error" + yesno "Do you want printing?" "y" if [ "$output" == "yes" ]; then addpkg cups fi } lang() { - input_old "Which language?" "de en" "unknown error" + multiplechoice "de" "en" LANGUAGE=$output if [ "$LANGUAGE" == "de" ]; then L1=de_DE