Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 242144 - /etc/localtime is overwritten
Summary: /etc/localtime is overwritten
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: High normal
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-15 08:03 UTC by Juergen Rose
Modified: 2008-10-15 12:23 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Juergen Rose 2008-10-15 08:03:55 UTC
On my systems /etc/localtime is a link to /usr/share/zoneinfo/Europe/Berlin.
Very often, I assume after upgrade of sys-libs/timezone-data /etc/localtime is overwritten. Is there a way to avoid this?

Regards Juergen


Reproducible: Always
Comment 1 Toralf Förster gentoo-dev 2008-10-15 08:09:45 UTC
Probably sth. like this : https://bugs.gentoo.org/show_bug.cgi?id=87519 ?
Comment 2 Peter Alfredsen (RETIRED) gentoo-dev 2008-10-15 08:46:38 UTC
This is really the way it's supposed to be, but there is one undocumented way to avoid it, though it will probably not win any beauty contests.
If you're using baselayout-1, in /etc/conf.d/clock set the variable TIMEZONE to be equal to FOOKABLOIE.
If you're using baselayout-2, do:
echo FOOKABLOIE > /etc/timezone

And that should be it. But what you're experiencing is not a bug, so I will close this as invalid.
Comment 3 Juergen Rose 2008-10-15 09:08:24 UTC
Hi Peter,
I have baselayout-2.0.0. At my older computer I find a file /etc/timezone with the contents:
 TIMEZONE="Europe/Berlin"

So you mean I can overwrite them with
FOOKABLOIE ?

Comment 4 Peter Alfredsen (RETIRED) gentoo-dev 2008-10-15 11:16:52 UTC
(In reply to comment #3)
> Hi Peter,
> I have baselayout-2.0.0. At my older computer I find a file /etc/timezone with
> the contents:
>  TIMEZONE="Europe/Berlin"
> 
> So you mean I can overwrite them with
> FOOKABLOIE ?

If you're using baselayout-2, that should do it. You can read the timezone-data ebuild to understand why. FOOKABLOIE is the value TIMEZONE is set to if no timezone is set, which causes updating of the localtime file to be aborted.
Excerpt:
        # make sure the /etc/localtime file does not get stale #127899
        local tz src

        if has_version '<sys-apps/baselayout-2' ; then
                src="/etc/conf.d/clock"
                tz=$(unset TIMEZONE ; source "${ROOT}"/etc/conf.d/clock ; echo ${TIMEZONE-FOOKABLOIE})
        else
                src="/etc/timezone"
                if [[ -e ${ROOT}/etc/timezone ]] ; then
                        tz=$(<"${ROOT}"/etc/timezone)
                else
                        tz="FOOKABLOIE"
                fi
        fi
        [[ -z ${tz} ]] && return 0

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

                if [[ ! -e ${ROOT}/etc/localtime ]] ; then
                        cp -f "${ROOT}"/usr/share/zoneinfo/Factory "${ROOT}"/etc/localtime
                        elog "Setting /etc/localtime to Factory."
                else
                        elog "Skipping auto-update of /etc/localtime."
                fi
                return 0
        fi

        if [[ ! -e ${ROOT}/usr/share/zoneinfo/${tz} ]] ; then
                elog "You have an invalid TIMEZONE setting in ${src}"
                elog "Your /etc/localtime has been reset to Factory; enjoy!"
                tz="Factory"
        fi
        einfo "Updating /etc/localtime with /usr/share/zoneinfo/${tz}"
        [[ -L ${ROOT}/etc/localtime ]] && rm -f "${ROOT}"/etc/localtime
        cp -f "${ROOT}"/usr/share/zoneinfo/"${tz}" "${ROOT}"/etc/localtime


Comment 5 Juergen Rose 2008-10-15 11:32:05 UTC
Thank you for explanation.
Juergen
Comment 6 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2008-10-15 12:23:29 UTC
(In reply to comment #2)
> If you're using baselayout-2, do:
> echo FOOKABLOIE > /etc/timezone

Rather:
echo -n > /etc/timezone

(In reply to comment #4)
> FOOKABLOIE is the value TIMEZONE is set to if no timezone is set, which
> causes updating of the localtime file to be aborted.

FOOKABLOIE is the value of tz variable when /etc/timezone doesn't exist or exists and contains FOOKABLOIE.
Update of /etc/localtime is skipped when tz variable is unset or set and empty (i.e. when /etc/timezone is empty).