From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from moutng.kundenserver.de ([212.227.126.171]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1SCZDg-0004fs-8Q for ptxdist@pengutronix.de; Tue, 27 Mar 2012 18:26:24 +0200 From: Alexander Dahl Date: Tue, 27 Mar 2012 18:25:24 +0200 Message-Id: <1332865524-6288-1-git-send-email-post@lespocky.de> Subject: [ptxdist] [PATCH] add /etc/timezone and replace content according to /etc/localtime Reply-To: ptxdist@pengutronix.de List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: ptxdist@pengutronix.de 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 --- 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