diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2013-02-08 14:52:20 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-02-14 23:17:59 +0000 |
commit | e4ae93a6625f11ca1690c4fb0041b69d0efc9d5c (patch) | |
tree | abeb703efffa1c36a22c2cbb07daef3f069c8281 /meta/recipes-extended | |
parent | 789d5772a2525b1a13e5a8f3a951cfbc101acfbd (diff) | |
download | poky-e4ae93a6625f11ca1690c4fb0041b69d0efc9d5c.tar.gz |
tzdata: Simplify code removing not used cases
We shouldn't have an use-case where we'd use 'FUBAR' timezone so
instead of adding postinst handling for this use case we handle it at
install time and keep the Universal as fallback if user did something
wrong.
This also ensure the /etc/localtime file is kept as a symbolic link.
This will make timezone not available when /usr is in separated
partition (and not mounted) however the applications ought to fallback
to GMT timezone in this case and when /usr is made availble timezone
will work fine.
Change-Id: I9a4f05db7a0bdc06511deb5693d1d16569d2fc63
(From OE-Core rev: 4b5e1757224085deac54b2583853fc779dc70614)
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended')
-rw-r--r-- | meta/recipes-extended/tzdata/tzdata_2012d.bb | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/meta/recipes-extended/tzdata/tzdata_2012d.bb b/meta/recipes-extended/tzdata/tzdata_2012d.bb index 9ec6715bc3..4811072b31 100644 --- a/meta/recipes-extended/tzdata/tzdata_2012d.bb +++ b/meta/recipes-extended/tzdata/tzdata_2012d.bb | |||
@@ -47,48 +47,30 @@ do_install () { | |||
47 | cp -pP "${S}/iso3166.tab" ${D}${datadir}/zoneinfo | 47 | cp -pP "${S}/iso3166.tab" ${D}${datadir}/zoneinfo |
48 | 48 | ||
49 | # Install default timezone | 49 | # Install default timezone |
50 | install -d ${D}${sysconfdir} | 50 | if [ -e ${D}${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ]; then |
51 | echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone | 51 | install -d ${D}${sysconfdir} |
52 | ln -s ${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ${D}${sysconfdir}/localtime | 52 | echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone |
53 | ln -s ${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ${D}${sysconfdir}/localtime | ||
54 | else | ||
55 | bberror "DEFAULT_TIMEZONE is set to an invalid value." | ||
56 | exit 1 | ||
57 | fi | ||
53 | 58 | ||
54 | chown -R root:root ${D} | 59 | chown -R root:root ${D} |
55 | } | 60 | } |
56 | 61 | ||
57 | pkg_postinst_${PN} () { | 62 | pkg_postinst_${PN} () { |
58 | |||
59 | # code taken from Gentoo's tzdata ebuild | ||
60 | |||
61 | etc_lt="$D${sysconfdir}/localtime" | 63 | etc_lt="$D${sysconfdir}/localtime" |
62 | src="$D${sysconfdir}/timezone" | 64 | src="$D${sysconfdir}/timezone" |
63 | 65 | ||
64 | if [ -e ${src} ] ; then | 66 | if [ -e ${src} ] ; then |
65 | tz=$(sed -e 's:#.*::' -e 's:[[:space:]]*::g' -e '/^$/d' "${src}") | 67 | tz=$(sed -e 's:#.*::' -e 's:[[:space:]]*::g' -e '/^$/d' "${src}") |
66 | else | ||
67 | tz="FUBAR" | ||
68 | fi | 68 | fi |
69 | 69 | ||
70 | if [ -z ${tz} ] ; then | 70 | if [ -z ${tz} ] ; then |
71 | return 0 | 71 | return 0 |
72 | fi | 72 | fi |
73 | 73 | ||
74 | if [ ${tz} = "FUBAR" ] ; then | ||
75 | echo "You do not have TIMEZONE set in ${src}." | ||
76 | |||
77 | if [ ! -e ${etc_lt} ] ; then | ||
78 | # if /etc/localtime is a symlink somewhere, assume they | ||
79 | # know what they're doing and they're managing it themselves | ||
80 | if [ ! -L ${etc_lt} ] ; then | ||
81 | cp -f "$D${datadir}/zoneinfo/Universal" "${etc_lt}" | ||
82 | echo "Setting ${etc_lt} to Universal." | ||
83 | else | ||
84 | echo "Assuming your ${etc_lt} symlink is what you want; skipping update." | ||
85 | fi | ||
86 | else | ||
87 | echo "Skipping auto-update of ${etc_lt}." | ||
88 | fi | ||
89 | return 0 | ||
90 | fi | ||
91 | |||
92 | if [ ! -e "$D${datadir}/zoneinfo/${tz}" ] ; then | 74 | if [ ! -e "$D${datadir}/zoneinfo/${tz}" ] ; then |
93 | echo "You have an invalid TIMEZONE setting in ${src}" | 75 | echo "You have an invalid TIMEZONE setting in ${src}" |
94 | echo "Your ${etc_lt} has been reset to Universal; enjoy!" | 76 | echo "Your ${etc_lt} has been reset to Universal; enjoy!" |
@@ -97,7 +79,7 @@ pkg_postinst_${PN} () { | |||
97 | if [ -L ${etc_lt} ] ; then | 79 | if [ -L ${etc_lt} ] ; then |
98 | rm -f "${etc_lt}" | 80 | rm -f "${etc_lt}" |
99 | fi | 81 | fi |
100 | cp -f "$D${datadir}/zoneinfo/${tz}" "${etc_lt}" | 82 | ln -s "${datadir}/zoneinfo/${tz}" "${etc_lt}" |
101 | fi | 83 | fi |
102 | } | 84 | } |
103 | 85 | ||