#!/bin/bash -e

. /etc/default/inithooks

TIMEZONE="$(curl --silent --show-error http://ip-api.com/line/?fields=timezone)"

if [[ -z "$TIMEZONE" ]]; then
   TIMEZONE='Etc/UTC'
fi

ln -fs "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
dpkg-reconfigure -f noninteractive tzdata
