diff options
| author | Andrea Adami <andrea.adami@gmail.com> | 2012-01-28 08:57:57 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-02-01 15:07:43 +0000 |
| commit | 0d1dee2a56da14be57c885b487ecaef39795137e (patch) | |
| tree | 5d44a4bb7d9eb115686fbd5071f2c01755092970 /meta | |
| parent | ae3184c96e3f0961de947fa97be89ec6bdd47fb0 (diff) | |
| download | poky-0d1dee2a56da14be57c885b487ecaef39795137e.tar.gz | |
tzdata_2011n: provide pkg_postinst and timezone defaults
* Introduce DEFAULT_TIMEZONE variable ('Universal', present in base package)
* and add /etc/timezone during do_install.
* While there, fix hardcoded references to $exec_prefix (/usr).
* Add the pkg_postinst script (adapted from Gentoo).
* Create /etc/localtime during postinst.
* Bump PR
(From OE-Core rev: 5304ce429f2c05857f04fbe3b47a067983ca96be)
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/recipes-extended/tzdata/tzdata_2011n.bb | 62 |
1 files changed, 58 insertions, 4 deletions
diff --git a/meta/recipes-extended/tzdata/tzdata_2011n.bb b/meta/recipes-extended/tzdata/tzdata_2011n.bb index de9281a768..9a41131d32 100644 --- a/meta/recipes-extended/tzdata/tzdata_2011n.bb +++ b/meta/recipes-extended/tzdata/tzdata_2011n.bb | |||
| @@ -5,7 +5,7 @@ LICENSE = "PD" | |||
| 5 | LIC_FILES_CHKSUM = "file://asia;beginline=2;endline=3;md5=06468c0e84ef4d4c97045a4a29b08234" | 5 | LIC_FILES_CHKSUM = "file://asia;beginline=2;endline=3;md5=06468c0e84ef4d4c97045a4a29b08234" |
| 6 | DEPENDS = "tzcode-native" | 6 | DEPENDS = "tzcode-native" |
| 7 | 7 | ||
| 8 | PR = "r0" | 8 | PR = "r1" |
| 9 | 9 | ||
| 10 | RCONFLICTS= "timezones timezone-africa timezone-america timezone-antarctica \ | 10 | RCONFLICTS= "timezones timezone-africa timezone-america timezone-antarctica \ |
| 11 | timezone-arctic timezone-asia timezone-atlantic \ | 11 | timezone-arctic timezone-asia timezone-atlantic \ |
| @@ -19,6 +19,8 @@ SRC_URI[tzdata.sha256sum] = "a343e542486b2b8ebdeca474eed79f1c04f69420ca943c2b9bd | |||
| 19 | 19 | ||
| 20 | S = "${WORKDIR}" | 20 | S = "${WORKDIR}" |
| 21 | 21 | ||
| 22 | DEFAULT_TIMEZONE ?= "Universal" | ||
| 23 | |||
| 22 | TZONES= "africa antarctica asia australasia europe northamerica southamerica \ | 24 | TZONES= "africa antarctica asia australasia europe northamerica southamerica \ |
| 23 | factory solar87 solar88 solar89 etcetera backward systemv \ | 25 | factory solar87 solar88 solar89 etcetera backward systemv \ |
| 24 | " | 26 | " |
| @@ -36,12 +38,64 @@ do_compile () { | |||
| 36 | } | 38 | } |
| 37 | 39 | ||
| 38 | do_install () { | 40 | do_install () { |
| 39 | install -d ${D}/usr ${D}${datadir}/zoneinfo | 41 | install -d ${D}/$exec_prefix ${D}${datadir}/zoneinfo |
| 40 | cp -pPR ${S}/usr ${D}/ | 42 | cp -pPR ${S}/$exec_prefix ${D}/ |
| 41 | # libc is removing zoneinfo files from package | 43 | # libc is removing zoneinfo files from package |
| 42 | cp -pP "${S}/zone.tab" ${D}${datadir}/zoneinfo | 44 | cp -pP "${S}/zone.tab" ${D}${datadir}/zoneinfo |
| 43 | cp -pP "${S}/iso3166.tab" ${D}${datadir}/zoneinfo | 45 | cp -pP "${S}/iso3166.tab" ${D}${datadir}/zoneinfo |
| 44 | chown -R root:root ${D} | 46 | |
| 47 | # Install default timezone | ||
| 48 | install -d ${D}${sysconfdir} | ||
| 49 | echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone | ||
| 50 | |||
| 51 | chown -R root:root ${D} | ||
| 52 | } | ||
| 53 | |||
| 54 | pkg_postinst_${PN} () { | ||
| 55 | |||
| 56 | # code taken from Gentoo's tzdata ebuild | ||
| 57 | |||
| 58 | etc_lt="$D${sysconfdir}/localtime" | ||
| 59 | src="$D${sysconfdir}/timezone" | ||
| 60 | |||
| 61 | if [ -e ${src} ] ; then | ||
| 62 | tz=$(sed -e 's:#.*::' -e 's:[[:space:]]*::g' -e '/^$/d' "${src}") | ||
| 63 | else | ||
| 64 | tz="FUBAR" | ||
| 65 | fi | ||
| 66 | |||
| 67 | if [ -z ${tz} ] ; then | ||
| 68 | return 0 | ||
| 69 | fi | ||
| 70 | |||
| 71 | if [ ${tz} = "FUBAR" ] ; then | ||
| 72 | echo "You do not have TIMEZONE set in ${src}." | ||
| 73 | |||
| 74 | if [ ! -e ${etc_lt} ] ; then | ||
| 75 | # if /etc/localtime is a symlink somewhere, assume they | ||
| 76 | # know what they're doing and they're managing it themselves | ||
| 77 | if [ ! -L ${etc_lt} ] ; then | ||
| 78 | cp -f "$D${datadir}/zoneinfo/Universal" "${etc_lt}" | ||
| 79 | echo "Setting ${etc_lt} to Universal." | ||
| 80 | else | ||
| 81 | echo "Assuming your ${etc_lt} symlink is what you want; skipping update." | ||
| 82 | fi | ||
| 83 | else | ||
| 84 | echo "Skipping auto-update of ${etc_lt}." | ||
| 85 | fi | ||
| 86 | return 0 | ||
| 87 | fi | ||
| 88 | |||
| 89 | if [ ! -e "$D${datadir}/zoneinfo/${tz}" ] ; then | ||
| 90 | echo "You have an invalid TIMEZONE setting in ${src}" | ||
| 91 | echo "Your ${etc_lt} has been reset to Universal; enjoy!" | ||
| 92 | tz="Universal" | ||
| 93 | fi | ||
| 94 | echo "Updating ${etc_lt} with $D${datadir}/zoneinfo/${tz}" | ||
| 95 | if [ -L ${etc_lt} ] ; then | ||
| 96 | rm -f "${etc_lt}" | ||
| 97 | fi | ||
| 98 | cp -f "$D${datadir}/zoneinfo/${tz}" "${etc_lt}" | ||
| 45 | } | 99 | } |
| 46 | 100 | ||
| 47 | # Packages primarily organized by directory with a major city | 101 | # Packages primarily organized by directory with a major city |
