Fixed up the timezone code so that it uses existing functions.

This commit is contained in:
Storm Dragon 2020-06-09 23:46:41 -04:00
parent 87c79b59c9
commit 669c4d4009

View File

@ -153,20 +153,9 @@ fi
if [[ "$answer" == "No" ]]; then
# Get the list of timezones
mapfile -t regions < <(timedatectl --no-pager list-timezones | cut -d '/' -f1 | sort -u)
# Use the same text twice here and just hide the tag field.
region=$(dialog --backtitle "$(gettext "Please select your Region")" \
--no-tags \
--menu "$(gettext "Use up and down arrows or page-up and page-down to navigate the list, and press 'Enter' to make your selection.")" 0 0 0 \
$(for i in ${regions[@]} ; do echo "$i";echo "$(gettext "$i")";done) --stdout)
region=$(menulist ${regions[@]})
mapfile -t cities < <(timedatectl --no-pager list-timezones | grep "$region" | cut -d '/' -f2 | sort -u)
# Use the same text twice here and just hide the tag field.
city=$(dialog --backtitle "$(gettext "Please select a city near you")" \
--no-tags \
--menu "$(gettext "Use up and down arrow or page-up and page-down to navigate the list.")" 0 0 10 \
$(for i in ${cities[@]} ; do echo "$i";echo "$(gettext "$i")";done) --stdout)
city=$(menulist ${cities[@]})
timezone="${region}/${city}"
fi