mirror of
https://git.yoctoproject.org/poky
synced 2026-02-20 08:29:42 +01:00
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: 77fed2c773d7d98f88d6e8a2f4a8617b9e8b8a62) 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>
This commit is contained in:
committed by
Richard Purdie
parent
b3de8e18e2
commit
966a7cbe96
@@ -47,48 +47,30 @@ do_install () {
|
||||
cp -pP "${S}/iso3166.tab" ${D}${datadir}/zoneinfo
|
||||
|
||||
# Install default timezone
|
||||
install -d ${D}${sysconfdir}
|
||||
echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone
|
||||
ln -s ${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ${D}${sysconfdir}/localtime
|
||||
if [ -e ${D}${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ]; then
|
||||
install -d ${D}${sysconfdir}
|
||||
echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone
|
||||
ln -s ${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ${D}${sysconfdir}/localtime
|
||||
else
|
||||
bberror "DEFAULT_TIMEZONE is set to an invalid value."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
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!"
|
||||
@@ -97,7 +79,7 @@ pkg_postinst_${PN} () {
|
||||
if [ -L ${etc_lt} ] ; then
|
||||
rm -f "${etc_lt}"
|
||||
fi
|
||||
cp -f "$D${datadir}/zoneinfo/${tz}" "${etc_lt}"
|
||||
ln -s "${datadir}/zoneinfo/${tz}" "${etc_lt}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user