Added set timezone.
This commit is contained in:
parent
410296f4ff
commit
03fbee9222
35
.includes/timezone.sh
Executable file
35
.includes/timezone.sh
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
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
|
||||||
|
sudo timedatectl set-timezone ${region}/${city}
|
||||||
|
if [[ -f /etc/localtime ]]; then
|
||||||
|
sudo rm /etc/localtime
|
||||||
|
fi
|
||||||
|
sudo ln -s /usr/share/zoneinfo/${region}/${city} /etc/localtime
|
||||||
|
|
||||||
|
# Make sure we are syncing with the internet
|
||||||
|
sudo timedatectl set-ntp false
|
||||||
|
sudo systemctl stop ntpd
|
||||||
|
sudo ntpd -gq
|
||||||
|
sudo systemctl enable ntpd --now
|
||||||
|
exit 0
|
@ -66,6 +66,9 @@ while [[ "$choice" != "Exit" ]]; do
|
|||||||
"Set up gaming")
|
"Set up gaming")
|
||||||
source .includes/gaming.sh
|
source .includes/gaming.sh
|
||||||
;;
|
;;
|
||||||
|
"Set timezone")
|
||||||
|
source .includes/timezone.sh
|
||||||
|
;;
|
||||||
"Update configure-stormux")
|
"Update configure-stormux")
|
||||||
sudo git pull
|
sudo git pull
|
||||||
exit $?
|
exit $?
|
||||||
@ -79,6 +82,7 @@ while [[ "$choice" != "Exit" ]]; do
|
|||||||
"Install Ratpoison Windowmanager" \
|
"Install Ratpoison Windowmanager" \
|
||||||
"Screen reader" \
|
"Screen reader" \
|
||||||
"Set up gaming" \
|
"Set up gaming" \
|
||||||
|
"Set timezone" \
|
||||||
"Update configure-stormux" \
|
"Update configure-stormux" \
|
||||||
)" || break
|
)" || break
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user