All of lore.kernel.org
 help / color / mirror / Atom feed
From: Otavio Salvador <otavio@ossystems.com.br>
To: openembedded-core@lists.openembedded.org
Cc: Otavio Salvador <otavio@ossystems.com.br>
Subject: [PATCH v2 2/2] tzdata: Simplify code removing not used cases
Date: Fri,  8 Feb 2013 10:22:40 -0200	[thread overview]
Message-ID: <1360326160-8310-2-git-send-email-otavio@ossystems.com.br> (raw)
In-Reply-To: <1360326160-8310-1-git-send-email-otavio@ossystems.com.br>

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.

Change-Id: I9a4f05db7a0bdc06511deb5693d1d16569d2fc63
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 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 9ec6715..4811072 100644
--- a/meta/recipes-extended/tzdata/tzdata_2012d.bb
+++ b/meta/recipes-extended/tzdata/tzdata_2012d.bb
@@ -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
 }
 
-- 
1.7.2.5




      reply	other threads:[~2013-02-08 12:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-08 12:22 [PATCH v2 1/2] tzdata: We shouldn't override the localtime if it is valid Otavio Salvador
2013-02-08 12:22 ` Otavio Salvador [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1360326160-8310-2-git-send-email-otavio@ossystems.com.br \
    --to=otavio@ossystems.com.br \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.