mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Alexander Dahl <post@lespocky.de>
To: ptxdist@pengutronix.de
Subject: [ptxdist] [PATCH] add /etc/timezone and replace content according to /etc/localtime
Date: Tue, 27 Mar 2012 18:25:24 +0200	[thread overview]
Message-ID: <1332865524-6288-1-git-send-email-post@lespocky.de> (raw)

Additionally to /etc/localtime which points to one zoneinfo file in
/usr/share/zoneinfo there is /etc/timezone containing the system wide
zone. Debian updates both in parallel and systemd uses this too. It's
an easy way to find out about the current system time zone. Rules are
extended in a way you only have to put e.g. 'Europe/Berlin' to ptxdist
menuconfig and symlink /etc/localtime and file /etc/timezone are
created at build time.

This patch is a suggestion which works for me, open for discussion.

Signed-off-by: Alexander Dahl <post@lespocky.de>
---
 generic/etc/timezone |    1 +
 rules/timezone.in    |   12 +++++++-----
 rules/timezone.make  |   10 ++++++++--
 3 files changed, 16 insertions(+), 7 deletions(-)
 create mode 100644 generic/etc/timezone

diff --git a/generic/etc/timezone b/generic/etc/timezone
new file mode 100644
index 0000000..f743783
--- /dev/null
+++ b/generic/etc/timezone
@@ -0,0 +1 @@
+@TIMEZONE@
diff --git a/rules/timezone.in b/rules/timezone.in
index a1ed5b1..33a05eb 100644
--- a/rules/timezone.in
+++ b/rules/timezone.in
@@ -14,14 +14,16 @@ menuconfig TIMEZONE
 comment "Timezone support"
 	depends on TIMEZONE
 
-config GLIBC_LOCALTIME_LINK
-	prompt "Link of /etc/localtime"
+config GLIBC_LOCALTIME
+	prompt "Timezone for /etc/localtime and /etc/timezone"
 	depends on TIMEZONE
-	default "/usr/share/zoneinfo/Europe/Berlin"
+	default "Europe/Berlin"
 	string
 	help
-	  Where should /etc/localtime point to.
-	  (e.g. /usr/share/zoneinfo/Europe/Berlin)
+	  Where should /etc/localtime point to? (e.g. put in "Europe/Berlin"
+	  here to let it point to /usr/share/zoneinfo/Europe/Berlin)
+	  Additionally this value is written to /etc/timezone like on Debian
+	  or for systemd.
 
 config TIMEZONE_LOCAL_DATABASE
 	bool
diff --git a/rules/timezone.make b/rules/timezone.make
index d208f14..28ed35e 100644
--- a/rules/timezone.make
+++ b/rules/timezone.make
@@ -19,6 +19,8 @@ PACKAGES-$(PTXCONF_TIMEZONE) += timezone
 TIMEZONE_VERSION	:= 1.0
 TIMEZONE		:= timezone-$(TIMEZONE_VERSION)
 
+TIMEZONE_LOCALTIME_FILE	:= /usr/share/zoneinfo/$(PTXCONF_GLIBC_LOCALTIME)
+
 TIMEZONE-$(PTXCONF_TIMEZONE_AFRICA) := "Africa"
 TIMEZONE-$(PTXCONF_TIMEZONE_ATLANTIC) += "Atlantic"
 TIMEZONE-$(PTXCONF_TIMEZONE_EUROPE) += "Europe"
@@ -117,8 +119,12 @@ $(STATEDIR)/timezone.targetinstall:
 		$(call install_copy, timezone, 0, 0, 0655, -, /usr/share/zoneinfo/$$f,n); \
         done
 
-ifdef PTXCONF_GLIBC_LOCALTIME_LINK
-	@$(call install_link, timezone, ..$(PTXCONF_GLIBC_LOCALTIME_LINK), /etc/localtime)
+ifdef PTXCONF_GLIBC_LOCALTIME
+	@$(call install_link, timezone, ..$(TIMEZONE_LOCALTIME_FILE), \
+		/etc/localtime)
+	@$(call install_alternative, timezone, 0, 0, 0644, /etc/timezone)
+	@$(call install_replace, timezone, /etc/timezone, @TIMEZONE@, \
+		$(PTXCONF_GLIBC_LOCALTIME))
 endif
 
 	@$(call install_finish, timezone)
-- 
1.7.2.5


-- 
ptxdist mailing list
ptxdist@pengutronix.de

             reply	other threads:[~2012-03-27 16:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-27 16:25 Alexander Dahl [this message]
2012-04-04  6:22 ` Michael Olbrich

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=1332865524-6288-1-git-send-email-post@lespocky.de \
    --to=post@lespocky.de \
    --cc=ptxdist@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox