From 3c0597b4032138aa9231d6753a4c38c8bf813a1c Mon Sep 17 00:00:00 2001 From: Sayan Chowdhury Date: Fri, 11 Feb 2022 18:25:37 +0530 Subject: [PATCH] sys-libs/timezone-data: Apply Flatcar patches Recreate the old posix symlink for compatibility, and drop all the pkg functions that maintain /etc/localtime since we default to UTC. Signed-off-by: Sayan Chowdhury --- .../timezone-data-2021a-r1.ebuild | 89 +------------------ 1 file changed, 3 insertions(+), 86 deletions(-) diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/timezone-data/timezone-data-2021a-r1.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-libs/timezone-data/timezone-data-2021a-r1.ebuild index 0569f80588..2d30e145a4 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/timezone-data/timezone-data-2021a-r1.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/timezone-data/timezone-data-2021a-r1.ebuild @@ -107,90 +107,7 @@ src_install() { # Delete man pages installed by man-pages package. rm "${ED}"/usr/share/man/man5/tzfile.5* "${ED}"/usr/share/man/man8/{tzselect,zdump,zic}.8 || die dodoc CONTRIBUTING README NEWS *.html -} - -get_TIMEZONE() { - local tz src="${EROOT}/etc/timezone" - if [[ -e ${src} ]] ; then - tz=$(sed -e 's:#.*::' -e 's:[[:space:]]*::g' -e '/^$/d' "${src}") - else - tz="FOOKABLOIE" - fi - [[ -z ${tz} ]] && return 1 || echo "${tz}" -} - -pkg_preinst() { - local tz=$(get_TIMEZONE) - if [[ ${tz} == right/* || ${tz} == posix/* ]] ; then - eerror "The right & posix subdirs are no longer installed as subdirs -- they have been" - eerror "relocated to match upstream paths as sibling paths. Further, posix/xxx is the" - eerror "same as xxx, so you should simply drop the posix/ prefix. You also should not" - eerror "be using right/xxx for the system timezone as it breaks programs." - die "Please fix your timezone setting" - fi - - # Trim the symlink by hand to avoid portage's automatic protection checks. - rm -f "${EROOT}"/usr/share/zoneinfo/posix - - if has_version "<=${CATEGORY}/${PN}-2015c" ; then - elog "Support for accessing posix/ and right/ directly has been dropped to match" - elog "upstream. There is no need to set TZ=posix/xxx as it is the same as TZ=xxx." - elog "For TZ=right/, you can use TZ=../zoneinfo-leaps/xxx instead. See this post" - elog "for details: https://mm.icann.org/pipermail/tz/2015-February/022024.html" - fi -} - -configure_tz_data() { - # make sure the /etc/localtime file does not get stale #127899 - local tz src="${EROOT}/etc/timezone" etc_lt="${EROOT}/etc/localtime" - - # If it's a symlink, assume the user knows what they're doing and - # they're managing it themselves. #511474 - if [[ -L "${etc_lt}" ]] ; then - einfo "Assuming your ${etc_lt} symlink is what you want; skipping update." - return 0 - fi - - if ! tz=$(get_TIMEZONE) ; then - einfo "Assuming your empty ${src} file is what you want; skipping update." - return 0 - fi - - if [[ "${tz}" == "FOOKABLOIE" ]] ; then - einfo "You do not have a timezone set in ${src}; skipping update." - return 0 - fi - - 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 -} - -pkg_config() { - configure_tz_data -} - -pkg_postinst() { - configure_tz_data + + # install the symlink by hand to not break existing timezones + dosym . /usr/share/zoneinfo/posix }