system: default to using Etc/UTC as a timezone
cover system: default to using Etc/UTC as a timezone
Hello All!
A tiemzone is required by systemd, so we must have one defined. See the second commit log for more details.
Regards,
Yann E. MORIN.
The following changes since commit 3529ee59d1954da17b6b74b51d400317c774225a
qt5virtualkeyboard: new package (2017-07-03 00:36:01 +0200)
are available in the git repository at:
git://git.buildroot.org/~ymorin/git/buildroot.git
for you to fetch changes up to 8704f2d3078e10fe9df1c73b02bca452f8aab5b2
system: use Etc/UTC as default timezone (2017-07-03 21:21:12 +0200)
----------------------------------------------------------------
Yann E. MORIN (2):
package/tz: fix variable name
system: use Etc/UTC as default timezone
package/tz/tz.mk | 17 +++++++++-------- package/tzdata/tzdata.mk | 19 ++++++++++--------- system/Config.in | 3 +-- 3 files changed, 20 insertions(+), 19 deletions(-)
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/2 package/tz: fix variable name
The tz packages mizes its own variable with the one fro the tzdata package...
Fix the variable name in tz.
--- package/tz/tz.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
package/tz/tz.mk +3 -3
@@ -26,13 +26,13 @@ define TZ_INSTALL_TARGET_CMDS mkdir -p $(TARGET_DIR)/usr/share/zoneinfo/uclibc cp -a $(@D)/output/* $(TARGET_DIR)/usr/share/zoneinfo/uclibc if [ -n "$(TZ_LOCALTIME)" ]; then \ - if [ ! -f $(TARGET_DIR)/usr/share/zoneinfo/uclibc/$(TZDATA_LOCALTIME) ]; then \ + if [ ! -f $(TARGET_DIR)/usr/share/zoneinfo/uclibc/$(TZ_LOCALTIME) ]; then \ printf "Error: '%s' is not a valid timezone, check your BR2_TARGET_LOCALTIME setting\n" \ - "$(TZDATA_LOCALTIME)"; \ + "$(TZ_LOCALTIME)"; \ exit 1; \ fi; \ cd $(TARGET_DIR)/etc; \ - ln -sf ../usr/share/zoneinfo/uclibc/$(TZDATA_LOCALTIME) TZ; \ + ln -sf ../usr/share/zoneinfo/uclibc/$(TZ_LOCALTIME) TZ; \ fi endef
Signature · 1 line
2.11.0
PATCH 1/2 package/tz: fix variable name
Quoted 4 lines · Yann E. MORIN
The tz packages mizes its own variable with the one fro the tzdata package...
Fix the variable name in tz.
Hey, you also sneaked in a whitespace fix! :-)
Quoted 3 lines
Signed-off-by "Yann E. MORIN" <[email protected]>Cc Alexandre BELLONI <[email protected]>
It's a bit silly that the same variable is qstripped in 3 different places (tz,
tzdata and php). It would be better to strip it once and use it in all those places. system/system.mk would be the obvious place, because it's defined in system/Config.in, but unfortunately system/system.mk doesn't exist.
But of course, that's for another patch :-)
Regards,
Arnout
Quoted 26 lines
--- package/tz/tz.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)package/tz/tz.mk +3
-3@@ -26,13 +26,13 @@ define TZ_INSTALL_TARGET_CMDS mkdir -p $(TARGET_DIR)/usr/share/zoneinfo/uclibc cp -a $(@D)/output/* $(TARGET_DIR)/usr/share/zoneinfo/uclibc if [ -n "$(TZ_LOCALTIME)" ]; then \ - if [ ! -f $(TARGET_DIR)/usr/share/zoneinfo/uclibc/$(TZDATA_LOCALTIME) ]; then \ + if [ ! -f $(TARGET_DIR)/usr/share/zoneinfo/uclibc/$(TZ_LOCALTIME) ]; then \ printf "Error: '%s' is not a valid timezone, check your BR2_TARGET_LOCALTIME setting\n" \ - "$(TZDATA_LOCALTIME)"; \ + "$(TZ_LOCALTIME)"; \ exit 1; \ fi; \ cd $(TARGET_DIR)/etc; \ - ln -sf ../usr/share/zoneinfo/uclibc/$(TZDATA_LOCALTIME) TZ; \ + ln -sf ../usr/share/zoneinfo/uclibc/$(TZ_LOCALTIME) TZ; \ fi endef
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 2/2 system: use Etc/UTC as default timezone
In reply to Yann E. MORINEven though no timezone implicitly means UTC, systemd is not all that happy when it does not have a timezone set. This is all fine on a RW filesystem because systemd will create a symlink on its own (to Etc/UTC), but not so much on a RO filesystem, causing all kind of issues at boot time (up to the point that the system is unusable).
We fix that by defaulting to using Etc/UTC when no timezone is set.
---
Note: our packaging of systemd currently does not support running on a RO filesystem. This patch is part of the on-going effort to make it so.
--- package/tz/tz.mk | 17 +++++++++-------- package/tzdata/tzdata.mk | 19 ++++++++++--------- system/Config.in | 3 +-- 3 files changed, 20 insertions(+), 19 deletions(-)
package/tz/tz.mk +9 -8
@@ -7,7 +7,11 @@ TZ_DEPENDENCIES = host-tzdata host-tzdump TZ_LICENSE = Public domain +# If local time is not set, use Etc/UTC as a default. TZ_LOCALTIME = $(call qstrip,$(BR2_TARGET_LOCALTIME)) +ifeq ($(TZ_LOCALTIME),) +TZ_LOCALTIME = Etc/UTC +endif define TZ_BUILD_CMDS (cd $(HOST_DIR)/usr/share/zoneinfo/posix/; \
@@ -25,15 +29,12 @@ define TZ_INSTALL_TARGET_CMDS $(TARGET_DIR)/usr/share/zoneinfo/iso3166.tab mkdir -p $(TARGET_DIR)/usr/share/zoneinfo/uclibc cp -a $(@D)/output/* $(TARGET_DIR)/usr/share/zoneinfo/uclibc - if [ -n "$(TZ_LOCALTIME)" ]; then \ - if [ ! -f $(TARGET_DIR)/usr/share/zoneinfo/uclibc/$(TZ_LOCALTIME) ]; then \ - printf "Error: '%s' is not a valid timezone, check your BR2_TARGET_LOCALTIME setting\n" \ - "$(TZ_LOCALTIME)"; \ - exit 1; \ - fi; \ - cd $(TARGET_DIR)/etc; \ - ln -sf ../usr/share/zoneinfo/uclibc/$(TZ_LOCALTIME) TZ; \ + if [ ! -f $(TARGET_DIR)/usr/share/zoneinfo/uclibc/$(TZ_LOCALTIME) ]; then \ + printf "Error: '%s' is not a valid timezone, check your BR2_TARGET_LOCALTIME setting\n" \ + "$(TZ_LOCALTIME)"; \ + exit 1; \ fi + ln -sf ../usr/share/zoneinfo/uclibc/$(TZ_LOCALTIME) $(TARGET_DIR)/etc/TZ endef $(eval $(generic-package))
package/tzdata/tzdata.mk +10 -9
@@ -24,7 +24,11 @@ else TZDATA_ZONELIST = $(call qstrip,$(BR2_TARGET_TZ_ZONELIST)) endif +# If local time is not set, use Etc/UTC as a default. TZDATA_LOCALTIME = $(call qstrip,$(BR2_TARGET_LOCALTIME)) +ifeq ($(TZDATA_LOCALTIME),) +TZDATA_LOCALTIME = Etc/UTC +endif # No need to extract for target, we're using the host-installed files TZDATA_EXTRACT_CMDS =
@@ -36,16 +40,13 @@ define TZDATA_INSTALL_TARGET_CMDS for zone in posix/*; do \ ln -sfn "$${zone}" "$${zone##*/}"; \ done - if [ -n "$(TZDATA_LOCALTIME)" ]; then \ - if [ ! -f $(TARGET_DIR)/usr/share/zoneinfo/$(TZDATA_LOCALTIME) ]; then \ - printf "Error: '%s' is not a valid timezone, check your BR2_TARGET_LOCALTIME setting\n" \ - "$(TZDATA_LOCALTIME)"; \ - exit 1; \ - fi; \ - cd $(TARGET_DIR)/etc; \ - ln -sf ../usr/share/zoneinfo/$(TZDATA_LOCALTIME) localtime; \ - echo "$(TZDATA_LOCALTIME)" >timezone; \ + if [ ! -f $(TARGET_DIR)/usr/share/zoneinfo/$(TZDATA_LOCALTIME) ]; then \ + printf "Error: '%s' is not a valid timezone, check your BR2_TARGET_LOCALTIME setting\n" \ + "$(TZDATA_LOCALTIME)"; \ + exit 1; \ fi + ln -sf ../usr/share/zoneinfo/$(TZDATA_LOCALTIME) $(TARGET_DIR)/etc/localtime + echo "$(TZDATA_LOCALTIME)" >$(TARGET_DIR)/etc/timezone endef define HOST_TZDATA_BUILD_CMDS
system/Config.in +1 -2
@@ -454,8 +454,7 @@ config BR2_TARGET_LOCALTIME Pacific/Wallis ... - If empty, no local time will be set, and the dates will be - expressed in UTC. + If empty, the default is to use Etc/UTC as a localtime. endif # BR2_TARGET_TZ_INFO
Signature · 1 line
2.11.0
PATCH 2/2 system: use Etc/UTC as default timezone
Quoted 7 lines · Yann E. MORIN
Even though no timezone implicitly means UTC, systemd is not all that happy when it does not have a timezone set. This is all fine on a RW filesystem because systemd will create a symlink on its own (to Etc/UTC), but not so much on a RO filesystem, causing all kind of issues at boot time (up to the point that the system is unusable).
We fix that by defaulting to using Etc/UTC when no timezone is set.
And you also sneaked in the removal of a cd :-)
I really don't like that the same logic is repeated for tz and tzdata (and it
already existed for php), but OK.
Regards,
Arnout
Quoted 107 lines
Signed-off-by "Yann E. MORIN" <[email protected]>Cc Richard Braun <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Martin Bark <[email protected]>Cc Maxime Hadjinlian <[email protected]>---
Note: our packaging of systemd currently does not support running on a RO filesystem. This patch is part of the on-going effort to make it so.--- package/tz/tz.mk | 17 +++++++++-------- package/tzdata/tzdata.mk | 19 ++++++++++--------- system/Config.in | 3 +-- 3 files changed, 20 insertions(+), 19 deletions(-)package/tz/tz.mk +9
-8@@ -7,7 +7,11 @@ TZ_DEPENDENCIES = host-tzdata host-tzdump TZ_LICENSE = Public domain +# If local time is not set, use Etc/UTC as a default. TZ_LOCALTIME = $(call qstrip,$(BR2_TARGET_LOCALTIME)) +ifeq ($(TZ_LOCALTIME),) +TZ_LOCALTIME = Etc/UTC +endif define TZ_BUILD_CMDS (cd $(HOST_DIR)/usr/share/zoneinfo/posix/; \@@ -25,15 +29,12 @@ define TZ_INSTALL_TARGET_CMDS $(TARGET_DIR)/usr/share/zoneinfo/iso3166.tab mkdir -p $(TARGET_DIR)/usr/share/zoneinfo/uclibc cp -a $(@D)/output/* $(TARGET_DIR)/usr/share/zoneinfo/uclibc - if [ -n "$(TZ_LOCALTIME)" ]; then \ - if [ ! -f $(TARGET_DIR)/usr/share/zoneinfo/uclibc/$(TZ_LOCALTIME) ]; then \ - printf "Error: '%s' is not a valid timezone, check your BR2_TARGET_LOCALTIME setting\n" \ - "$(TZ_LOCALTIME)"; \ - exit 1; \ - fi; \ - cd $(TARGET_DIR)/etc; \ - ln -sf ../usr/share/zoneinfo/uclibc/$(TZ_LOCALTIME) TZ; \ + if [ ! -f $(TARGET_DIR)/usr/share/zoneinfo/uclibc/$(TZ_LOCALTIME) ]; then \ + printf "Error: '%s' is not a valid timezone, check your BR2_TARGET_LOCALTIME setting\n" \ + "$(TZ_LOCALTIME)"; \ + exit 1; \ fi + ln -sf ../usr/share/zoneinfo/uclibc/$(TZ_LOCALTIME) $(TARGET_DIR)/etc/TZ endef $(eval $(generic-package))package/tzdata/tzdata.mk +10
-9@@ -24,7 +24,11 @@ else TZDATA_ZONELIST = $(call qstrip,$(BR2_TARGET_TZ_ZONELIST)) endif +# If local time is not set, use Etc/UTC as a default. TZDATA_LOCALTIME = $(call qstrip,$(BR2_TARGET_LOCALTIME)) +ifeq ($(TZDATA_LOCALTIME),) +TZDATA_LOCALTIME = Etc/UTC +endif # No need to extract for target, we're using the host-installed files TZDATA_EXTRACT_CMDS =@@ -36,16 +40,13 @@ define TZDATA_INSTALL_TARGET_CMDS for zone in posix/*; do \ ln -sfn "$${zone}" "$${zone##*/}"; \ done - if [ -n "$(TZDATA_LOCALTIME)" ]; then \ - if [ ! -f $(TARGET_DIR)/usr/share/zoneinfo/$(TZDATA_LOCALTIME) ]; then \ - printf "Error: '%s' is not a valid timezone, check your BR2_TARGET_LOCALTIME setting\n" \ - "$(TZDATA_LOCALTIME)"; \ - exit 1; \ - fi; \ - cd $(TARGET_DIR)/etc; \ - ln -sf ../usr/share/zoneinfo/$(TZDATA_LOCALTIME) localtime; \ - echo "$(TZDATA_LOCALTIME)" >timezone; \ + if [ ! -f $(TARGET_DIR)/usr/share/zoneinfo/$(TZDATA_LOCALTIME) ]; then \ + printf "Error: '%s' is not a valid timezone, check your BR2_TARGET_LOCALTIME setting\n" \ + "$(TZDATA_LOCALTIME)"; \ + exit 1; \ fi + ln -sf ../usr/share/zoneinfo/$(TZDATA_LOCALTIME) $(TARGET_DIR)/etc/localtime + echo "$(TZDATA_LOCALTIME)" >$(TARGET_DIR)/etc/timezone endef define HOST_TZDATA_BUILD_CMDSsystem/Config.in +1
-2@@ -454,8 +454,7 @@ config BR2_TARGET_LOCALTIME Pacific/Wallis - If empty, no local time will be set, and the dates will be - expressed in UTC. + If empty, the default is to use Etc/UTC as a localtime. endif # BR2_TARGET_TZ_INFO
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF