installer: better timezone menu

Closes: #65 [via git-merge-pr]
This commit is contained in:
human 2019-04-28 14:26:27 +03:00 committed by Michael Aldridge
parent 90cfccb903
commit aa50f22312

View File

@ -577,22 +577,22 @@ set_locale() {
} }
menu_timezone() { menu_timezone() {
local _tzones="$(cd /usr/share/zoneinfo; find Africa/ America/ Antarctica/ Arctic/ Asia/ Atlantic/ Australia/ Europe/ Indian/ Pacific/ posix/ -type f | sort)" local areas=(Africa America Antarctica Arctic Asia Atlantic Australia Europe Indian Pacific)
local _TIMEZONES=
for f in ${_tzones}; do local area locations location
_TIMEZONES="${_TIMEZONES} ${f} -" while (IFS='|'; DIALOG ${area:+--default-item|"$area"} --title " Select area " --menu "$MENULABEL" 19 51 19 $(printf '%s||' "${areas[@]}")); do
done area=$(cat $ANSWER)
while true; do read -a locations -d '\n' < <(find /usr/share/zoneinfo/$area -type f -printf '%P\n' | sort)
DIALOG --title " Select your timezone " --menu "$MENULABEL" 14 70 14 ${_TIMEZONES} if (IFS='|'; DIALOG --title " Select location (${area}) " --menu "$MENULABEL" 19 51 19 $(printf '%s||' "${locations[@]//_/ }")); then
if [ $? -eq 0 ]; then location=$(tr ' ' '_' < $ANSWER)
set_option TIMEZONE "$(cat $ANSWER)" set_option TIMEZONE "$area/$location"
TIMEZONE_DONE=1 TIMEZONE_DONE=1
break return 0
else else
return continue
fi fi
done done
return 1
} }
set_timezone() { set_timezone() {