mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] add /etc/timezone and replace content according to /etc/localtime
@ 2012-03-27 16:25 Alexander Dahl
  2012-04-04  6:22 ` Michael Olbrich
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Dahl @ 2012-03-27 16:25 UTC (permalink / raw)
  To: ptxdist

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ptxdist] [PATCH] add /etc/timezone and replace content according to /etc/localtime
  2012-03-27 16:25 [ptxdist] [PATCH] add /etc/timezone and replace content according to /etc/localtime Alexander Dahl
@ 2012-04-04  6:22 ` Michael Olbrich
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Olbrich @ 2012-04-04  6:22 UTC (permalink / raw)
  To: ptxdist

On Tue, Mar 27, 2012 at 06:25:24PM +0200, Alexander Dahl wrote:
> 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.

And I liked it. Applied.

Michael

> 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
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-04  6:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-27 16:25 [ptxdist] [PATCH] add /etc/timezone and replace content according to /etc/localtime Alexander Dahl
2012-04-04  6:22 ` Michael Olbrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox