#! /bin/sh
set -e

if [ "$1" = configure ]; then
    . /usr/share/debconf/confmodule
    db_version 2.0

    LC_ALL=C
    AREA=Etc
    ZONE=UTC
    db_get tzdata/Areas && AREA="$RET"
    db_get tzdata/Zones/$AREA && ZONE="$RET"

    umask 022
    echo $AREA/$ZONE > /etc/timezone
    rm -f /etc/localtime && \
        cp -f /usr/share/zoneinfo/$AREA/$ZONE /etc/localtime

    TZBase=$(LC_ALL=C TZ=UTC0 date)
    UTdate=$(TZ=UTC0 date -d "$TZBase")
    TZdate=$(TZ="$AREA/$ZONE" date -d "$TZBase")
    echo 
    echo "Current default timezone: '$AREA/$ZONE'"
    echo "Local time is now:      $TZdate."
    echo "Universal Time is now:  $UTdate."
    echo "Run 'dpkg-reconfigure tzdata' if you wish to change it."
    echo
fi

#DEBHELPER#

exit 0
