From f32049aab199032433ee36a2637a7ed2a9a19cd0 Mon Sep 17 00:00:00 2001 From: Tobias Powalowski Date: Fri, 14 Jul 2023 15:12:42 +0200 Subject: [PATCH] remove while loop --- usr/bin/archboot-clock.sh | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/usr/bin/archboot-clock.sh b/usr/bin/archboot-clock.sh index a072c36bc..66c872df7 100755 --- a/usr/bin/archboot-clock.sh +++ b/usr/bin/archboot-clock.sh @@ -89,25 +89,17 @@ _timeset() { fi if [[ -z "${_SET_TIME}" ]]; then timedatectl set-ntp 0 - _CONTINUE="" - while [[ -z "${_CONTINUE}" ]]; do - # display and ask to set date/time - if _dialog --title ' Date Setting' --calendar "Use to navigate and arrow keys to change values." 0 0 0 0 0 2> ${_ANSWER}; then - _DATE="$(cat ${_ANSWER})" - _CONTINUE=1 - else - _abort - fi - done - _CONTINUE="" - while [[ -z "${_CONTINUE}" ]]; do - if _dialog --title ' Time Setting ' --timebox "Use to navigate and up/down to change values." 0 0 2> ${_ANSWER}; then - _TIME="$(cat ${_ANSWER})" - _CONTINUE=1 - else - _abort - fi - done + # display and ask to set date/time + if _dialog --title ' Date Setting' --calendar "Use to navigate and arrow keys to change values." 0 0 0 0 0 2> ${_ANSWER}; then + _DATE="$(cat ${_ANSWER})" + else + _timeset + fi + if _dialog --title ' Time Setting ' --timebox "Use to navigate and up/down to change values." 0 0 2> ${_ANSWER}; then + _TIME="$(cat ${_ANSWER})" + else + _timeset + fi # save the time # DD/MM/YYYY hh:mm:ss -> YYYY-MM-DD hh:mm:ss _DATETIME="$(echo "${_DATE}" "${_TIME}" | sed 's#\(..\)/\(..\)/\(....\) \(..\):\(..\):\(..\)#\3-\2-\1 \4:\5:\6#g')"