commit: c4bf9520768aa3db2263303094504ac66871050f Author: Mike Gilbert <floppym <AT> gentoo <DOT> org> AuthorDate: Mon Mar 22 02:34:00 2021 +0000 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org> CommitDate: Mon Mar 22 19:04:56 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c4bf9520
sys-libs/timezone-data: adjust /etc/localtime logic Stop using the "Factory" timezone. Programs will use UTC if localtime is missing. Not installing the Factory timezone as /etc/localtime will allow us to more easily detect if /etc/localtime exists and is valid. If /etc/localtime exists as a regular file, copy the new timezone file over it as was done previously. Emit a warning message encouraging the user to remove the file. If /etc/localtime does not exist, but we have a timezone configured in /etc/timezone, create a symlink and remove /etc/timezone. The end result of this should be that new installs default to UTC. If users create /etc/timezone according to the handbook, a symlink will be created at /etc/localtime and /etc/timezone will be removed. Closes: https://github.com/gentoo/gentoo/pull/20050 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org> sys-libs/timezone-data/timezone-data-2021a.ebuild | 41 ++++++++++++++--------- 1 file 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 52f5fbdca3b..b7dce14ae8a 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() {
