
# code taken from Gentoo's tzdata ebuild

	etc_lt="$D/etc/localtime"
	src="$D/etc/timezone"

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

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

	if [ ${tz} = "FUBAR" ] ; then
		echo "You do not have TIMEZONE set in ${src}."

		if [ ! -e ${etc_lt} ] ; then
			# if /etc/localtime is a symlink somewhere, assume they
			# know what they're doing and they're managing it themselves
			if [ ! -L ${etc_lt} ] ; then
				cp -f "$D/usr/share/zoneinfo/Universal" "${etc_lt}"
				echo "Setting ${etc_lt} to Universal."
			else
				echo "Assuming your ${etc_lt} symlink is what you want; skipping update."
			fi
		else
			echo "Skipping auto-update of ${etc_lt}."
		fi
		return 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"
	fi
	echo "Updating ${etc_lt} with $D/usr/share/zoneinfo/${tz}"
	if [ -L ${etc_lt} ] ; then
		rm -f "${etc_lt}"
	fi
	cp -f "$D/usr/share/zoneinfo/${tz}" "${etc_lt}"
