updated timezone logic, added manual option

This commit is contained in:
mfgbhatti 2022-01-24 20:19:11 +00:00
parent 53bee6406a
commit 3cfd42a9af
1 changed files with 39 additions and 14 deletions

View File

@ -107,21 +107,46 @@ filesystem () {
} }
timezone () { timezone () {
# Added this from arch wiki https://wiki.archlinux.org/title/System_time # Added this from arch wiki https://wiki.archlinux.org/title/System_time
time_zone="$(curl --fail https://ipapi.co/timezone)" _TIMEZONE="$(curl --fail https://ipapi.co/timezone)"
echo -ne "System detected your timezone to be '$time_zone' \n" _ZONE=($(timedatectl list-timezones | sed 's/\/.*$//' | uniq))
echo -ne "Is this correct? yes/no:" echo -ne "System detected your timezone to be '$_TIMEZONE'"
read -r answer echo -ne "\n"
case $answer in read -pr "Is this correct? yes/no: " ANSWER
y|Y|yes|Yes|YES) case "$ANSWER" in
set_option TIMEZONE "$time_zone";; y|Y|yes|Yes|YES)
n|N|no|NO|No) set_option TIMEZONE "$_TIMEZONE"
echo "Please enter your desired timezone e.g. Europe/London :" ;;
read -r new_timezone n|N|no|NO|No)
set_option TIMEZONE "$new_timezone";; title "Manually setting timezone"
*) echo "Wrong option. Try again";timezone;; PS3="$PROMPT"
esac echo -ne "Please select your zone: \n"
select ZONE in "${_ZONE[@]}"; do
if elements_present "$ZONE" "${_ZONE[@]}"; then
_SUBZONE=($(timedatectl list-timezones | grep "${ZONE}" | sed 's/^.*\///'))
PS3="$PROMPT"
echo -ne "Please select your subzone: \n"
select SUBZONE in "${_SUBZONE[@]}"; do
if elements_present "$SUBZONE" "${_SUBZONE[@]}"; then
set_option TIMEZONE "${ZONE}/${SUBZONE}"
break
else
invalid_option
break
fi
done
break
else
invalid_option
break
fi
done
;;
*) echo "Wrong option. Try again";timezone;;
esac
} }
keymap () { keymap () {
# These are default key maps as presented in official arch repo archinstall # These are default key maps as presented in official arch repo archinstall
echo -ne " echo -ne "