Set per-user timezone

This commit is contained in:
Anthony Rose 2022-07-01 17:01:26 +01:00
parent 40ee7a15f9
commit 250679025e

View file

@ -48,6 +48,7 @@ set -o noclobber
# Locale and language. # Locale and language.
## Clear the existing locale settings and set options I always want. ## Clear the existing locale settings and set options I always want.
export TIME_STYLE=long-iso # Used by GNU 'ls'. export TIME_STYLE=long-iso # Used by GNU 'ls'.
export TZ=Europe/London # Can override this elsewhere if needed.
if [ -f /etc/locale.conf ] if [ -f /etc/locale.conf ]
then then
. /etc/locale.conf . /etc/locale.conf
@ -228,7 +229,10 @@ usermotd () {
fi fi
uptime uptime
echo "LANG=$LANG" echo "LANG=$LANG"
if [ -x /usr/bin/timedatectl ] && [ "x$(systemctl is-system-running)" != "xoffline" ] if [ -n "$TZ" ]
then
echo "TZ=$TZ"
elif [ -x /usr/bin/timedatectl ] && [ "x$(systemctl is-system-running)" != "xoffline" ]
then then
timedatectl show --property=Timezone | sed 's/Timezone=/TZ=/' timedatectl show --property=Timezone | sed 's/Timezone=/TZ=/'
fi fi