Added timezone to configure-stormux stub.
This commit is contained in:
parent
7fb1ba5283
commit
aa4ec62c47
@ -15,6 +15,40 @@ if [[ -x /opt/configure-stormux/configure-stormux.sh ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
set_timezone() {
|
||||
export DIALOGOPTS='--insecure --no-lines --visit-items'
|
||||
|
||||
|
||||
# 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 "Please select your Region" \
|
||||
--no-tags \
|
||||
--menu "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 "$i";done) --stdout)
|
||||
|
||||
|
||||
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 "Please select a city near you" \
|
||||
--no-tags \
|
||||
--menu "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 "$i";done) --stdout)
|
||||
|
||||
# Set the timezone
|
||||
timedatectl set-timezone ${region}/${city}
|
||||
if [[ -f /etc/localtime ]]; then
|
||||
rm /etc/localtime
|
||||
fi
|
||||
ln -sf /usr/share/zoneinfo/${region}/${city} /etc/localtime
|
||||
|
||||
# Make sure we are syncing with the internet
|
||||
timedatectl set-ntp true
|
||||
}
|
||||
|
||||
|
||||
# Offer to switch fenrir layout.
|
||||
echo "Would you like to switch Fenrir to laptop layout?"
|
||||
echo "Press y for yes or n for no followed by enter."
|
||||
@ -60,6 +94,7 @@ if ping -qc1 -W 1 stormux.org &> /dev/null; then
|
||||
echo "Current date and time: $date_time"
|
||||
# set date and time
|
||||
date -s "$date_time"
|
||||
set_timezone
|
||||
else
|
||||
echo "Please connect to the internet and run ${0##*/} again."
|
||||
exit 1
|
||||
|
Loading…
Reference in New Issue
Block a user