summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/tzdata
diff options
context:
space:
mode:
authorAndrea Adami <andrea.adami@gmail.com>2012-01-28 08:57:57 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-02-01 14:58:45 +0000
commit5304ce429f2c05857f04fbe3b47a067983ca96be (patch)
treef2c9950a4b72845a9a085f256a8de636827aec5c /meta/recipes-extended/tzdata
parent1fdcd32520a05465b0d54c062f28bac9cdf74a20 (diff)
downloadopenembedded-core-5304ce429f2c05857f04fbe3b47a067983ca96be.tar.gz
openembedded-core-5304ce429f2c05857f04fbe3b47a067983ca96be.tar.bz2
openembedded-core-5304ce429f2c05857f04fbe3b47a067983ca96be.zip
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 Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
Diffstat (limited to 'meta/recipes-extended/tzdata')
-rw-r--r--meta/recipes-extended/tzdata/tzdata_2011n.bb62
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"
LIC_FILES_CHKSUM = "file://asia;beginline=2;endline=3;md5=06468c0e84ef4d4c97045a4a29b08234"
DEPENDS = "tzcode-native"
-PR = "r0"
+PR = "r1"
RCONFLICTS= "timezones timezone-africa timezone-america timezone-antarctica \
timezone-arctic timezone-asia timezone-atlantic \
@@ -19,6 +19,8 @@ SRC_URI[tzdata.sha256sum] = "a343e542486b2b8ebdeca474eed79f1c04f69420ca943c2b9bd
S = "${WORKDIR}"
+DEFAULT_TIMEZONE ?= "Universal"
+
TZONES= "africa antarctica asia australasia europe northamerica southamerica \
factory solar87 solar88 solar89 etcetera backward systemv \
"
@@ -36,12 +38,64 @@ do_compile () {
}
do_install () {
- install -d ${D}/usr ${D}${datadir}/zoneinfo
- cp -pPR ${S}/usr ${D}/
+ install -d ${D}/$exec_prefix ${D}${datadir}/zoneinfo
+ cp -pPR ${S}/$exec_prefix ${D}/
# libc is removing zoneinfo files from package
cp -pP "${S}/zone.tab" ${D}${datadir}/zoneinfo
cp -pP "${S}/iso3166.tab" ${D}${datadir}/zoneinfo
- chown -R root:root ${D}
+
+ # Install default timezone
+ install -d ${D}${sysconfdir}
+ echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone
+
+ chown -R root:root ${D}
+}
+
+pkg_postinst_${PN} () {
+
+# code taken from Gentoo's tzdata ebuild
+
+ etc_lt="$D${sysconfdir}/localtime"
+ src="$D${sysconfdir}/timezone"
+
+ if [ -e ${src} ] ; then
+ tz=$(sed -e 's:#.*::' -e 's:[[:space:]]*::g' -e '/^$/d' "${src}")
+ else
+ tz="FUBAR"
+ fi
+
+ if [ -z ${tz} ] ; then
+ return 0
+ fi
+
+ if [ ${tz} = "FUBAR" ] ; then
+ echo "You do not have TIMEZONE set in ${src}."
+
+ if [ ! -e ${etc_lt} ] ; then
+ # if /etc/localtime is a symlink somewhere, assume they
+ # know what they're doing and they're managing it themselves
+ if [ ! -L ${etc_lt} ] ; then
+ cp -f "$D${datadir}/zoneinfo/Universal" "${etc_lt}"
+ echo "Setting ${etc_lt} to Universal."
+ else
+ echo "Assuming your ${etc_lt} symlink is what you want; skipping update."
+ fi
+ else
+ echo "Skipping auto-update of ${etc_lt}."
+ fi
+ return 0
+ fi
+
+ if [ ! -e "$D${datadir}/zoneinfo/${tz}" ] ; then
+ echo "You have an invalid TIMEZONE setting in ${src}"
+ echo "Your ${etc_lt} has been reset to Universal; enjoy!"
+ tz="Universal"
+ fi
+ echo "Updating ${etc_lt} with $D${datadir}/zoneinfo/${tz}"
+ if [ -L ${etc_lt} ] ; then
+ rm -f "${etc_lt}"
+ fi
+ cp -f "$D${datadir}/zoneinfo/${tz}" "${etc_lt}"
}
# Packages primarily organized by directory with a major city