Set GUI time zone from geolocation

The wonderful *ipapi.co* service can help identify the time zone of a
device based on the geolocation information for its IP address.  We can
use this to set the `TZ` environment variable in the user session, which
Firefox will respect.  This has the effect of showing the correct time
in e.g. Grafana dashboards, without hard-coding the time zone in the
rootfs image.
pull/1/head
Dustin 2022-04-06 18:40:58 -05:00
parent c7a21b404d
commit 878f733025
2 changed files with 6 additions and 1 deletions

View File

@ -18,6 +18,7 @@ echo install_weak_deps=False >> "${destdir}"/etc/dnf/dnf.conf
dnf --installroot "${destdir}" install -y \ dnf --installroot "${destdir}" install -y \
bcm2711-firmware \ bcm2711-firmware \
curl \
dhcp-client \ dhcp-client \
dracut-network \ dracut-network \
firefox \ firefox \

View File

@ -2,6 +2,10 @@
xset s off xset s off
xset -dpms xset -dpms
systemctl --user import-environment DISPLAY
TZ="$(curl https://ipapi.co/timezone)"
export TZ
systemctl --user import-environment DISPLAY TZ
systemctl --user start firefox-marionette.socket firefox systemctl --user start firefox-marionette.socket firefox
exec openbox exec openbox