summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys-libs/timezone-data/timezone-data-2021a.ebuild41
1 files changed, 26 insertions, 15 deletions
diff --git a/sys-libs/timezone-data/timezone-data-2021a.ebuild b/sys-libs/timezone-data/timezone-data-2021a.ebuild
index 52f5fbdca3bd..b7dce14ae8a4 100644
--- a/sys-libs/timezone-data/timezone-data-2021a.ebuild
+++ b/sys-libs/timezone-data/timezone-data-2021a.ebuild
@@ -150,28 +150,39 @@ configure_tz_data() {
fi
if ! tz=$(get_TIMEZONE) ; then
- einfo "Assuming your empty ${etc_lt} file is what you want; skipping update."
+ einfo "Assuming your empty ${src} file is what you want; skipping update."
return 0
fi
- if [[ "${tz}" == "FOOKABLOIE" ]] ; then
- elog "You do not have TIMEZONE set in ${src}."
- if [[ ! -e "${etc_lt}" ]] ; then
- cp -f "${EROOT}"/usr/share/zoneinfo/Factory "${etc_lt}"
- elog "Setting ${etc_lt} to Factory."
- else
- elog "Skipping auto-update of ${etc_lt}."
- fi
+ if [[ "${tz}" == "FOOKABLOIE" ]] ; then
+ einfo "You do not have a timezone set in ${src}; skipping update."
return 0
fi
- if [[ ! -e "${EROOT}/usr/share/zoneinfo/${tz}" ]] ; then
- elog "You have an invalid TIMEZONE setting in ${src}"
- elog "Your ${etc_lt} has been reset to Factory; enjoy!"
- tz="Factory"
+ local tzpath="${EROOT}/usr/share/zoneinfo/${tz}"
+
+ if [[ ! -e ${tzpath} ]]; then
+ ewarn "The timezone specified in ${src} is not valid."
+ return 1
+ fi
+
+ if [[ -f ${etc_lt} ]]; then
+ # If a regular file already exists, copy over it.
+ ewarn "Found a regular file at ${etc_lt}."
+ ewarn "Some software may expect a symlink instead."
+ ewarn "You may convert it to a symlink by removing the file and running:"
+ ewarn " emerge --config sys-libs/timezone-data"
+ einfo "Copying ${tzpath} to ${etc_lt}."
+ cp -f "${tzpath}" "${etc_lt}"
+ else
+ # Otherwise, create a symlink and remove the timezone file.
+ tzpath="../usr/share/zoneinfo/${tz}"
+ einfo "Linking ${tzpath} at ${etc_lt}."
+ if ln -snf "${tzpath}" "${etc_lt}"; then
+ einfo "Removing ${src}."
+ rm -f "${src}"
+ fi
fi
- einfo "Updating ${etc_lt} with ${EROOT}/usr/share/zoneinfo/${tz}"
- cp -f "${EROOT}/usr/share/zoneinfo/${tz}" "${etc_lt}"
}
pkg_config() {