#!/bin/sh
etc_lt="$D/etc/localtime"
	src="$D/etc/timezone"

	if [ -e ${src} ] ; then
		tz=$(sed -e 's:#.*::' -e 's:[[:space:]]*::g' -e '/^$/d' "${src}")
	fi

	if [ -z "${tz}" ] ; then
		exit 0
	fi

	if [ ! -e "$D/usr/share/zoneinfo/${tz}" ] ; then
		echo "You have an invalid TIMEZONE setting in ${src}"
		echo "Your ${etc_lt} has been reset to Universal; enjoy!"
		tz="Universal"
		echo "Updating ${etc_lt} with $D/usr/share/zoneinfo/${tz}"
		if [ -L ${etc_lt} ] ; then
			rm -f "${etc_lt}"
		fi
		ln -s "/usr/share/zoneinfo/${tz}" "${etc_lt}"
	fi
