From ae03b5dbec6f7d1522133950a3aa3b7d6ec48655 Mon Sep 17 00:00:00 2001 From: seajee Date: Mon, 2 Sep 2024 05:40:19 +0200 Subject: [PATCH] Fix time zone configuration loop --- chroot.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/chroot.sh b/chroot.sh index 56f3c04..a760db7 100755 --- a/chroot.sh +++ b/chroot.sh @@ -8,22 +8,21 @@ password="" echoerr() { cat <<< "$@" 1>&2; } # Set the time zone -while +while true; do echo "[INFO] Time zone configuration." read -p "Enter time zone (${timezone}): " input - if [[ -n "$input" ]]; then + if [[ -z "$input" ]]; then break fi - if [[ ! -f "/usr/share/zoneinfo/${input}" ]]; then - echoerr "[ERROR] The selected time zone does not exist" - else + if [[ -f "/usr/share/zoneinfo/${input}" ]]; then timezone="$input" + break + else + echoerr "[ERROR] The selected time zone does not exist" fi - - [[ ! -f "/usr/share/zoneinfo/${input}" ]] -do true; done +done echo "[INFO] Setting ${timezone} as the time zone" ln -sf "/usr/share/zoneinfo/${timezone}" /etc/localtime