aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Yann E. MORIN <yann.morin.1998@free.fr>2019-11-16 10:10:04 +0100
committerGravatar Peter Korsgaard <peter@korsgaard.com>2019-12-03 14:54:12 +0100
commit49128bb3ed765e65f0ea6db64e64e899b9fb1e70 (patch)
tree6029ed54e117e414ab9ae8182bdf9a23448ce371
parentf26e5e4e267d9863536a014b697b9ce856c7b2c0 (diff)
downloadbuildroot-49128bb3ed765e65f0ea6db64e64e899b9fb1e70.tar.gz
buildroot-49128bb3ed765e65f0ea6db64e64e899b9fb1e70.tar.bz2
system: allow not setting a default, system-wide time zone
It is valid that there is no system-wide default time zone defined, in which case Etc/UTC is assumed. Fixes: #12316 Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr> Cc: Martin Bark <martin@barkynet.com> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Cc: Richard Braun <rbraun@sceen.net> Cc: Andrew Trapani <andrew.trapani@ontera.bio> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> (cherry picked from commit 0fb87516a49629901f5fe280cd08c9fdcf0eea24) Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
-rw-r--r--package/tz/tz.mk17
-rw-r--r--package/tzdata/tzdata.mk19
-rw-r--r--system/Config.in2
3 files changed, 25 insertions, 13 deletions
diff --git a/package/tz/tz.mk b/package/tz/tz.mk
index 1e797046d2..135726c2ce 100644
--- a/package/tz/tz.mk
+++ b/package/tz/tz.mk
@@ -8,6 +8,16 @@ TZ_DEPENDENCIES = host-tzdata host-tzdump
TZ_LICENSE = Public domain
TZ_LOCALTIME = $(call qstrip,$(BR2_TARGET_LOCALTIME))
+ifneq ($(TZ_LOCALTIME),)
+define TZ_SET_LOCALTIME
+ 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
+endif
define TZ_BUILD_CMDS
(cd $(HOST_DIR)/share/zoneinfo/posix/; \
@@ -25,12 +35,7 @@ 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 [ ! -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
+ $(TZ_SET_LOCALTIME)
endef
$(eval $(generic-package))
diff --git a/package/tzdata/tzdata.mk b/package/tzdata/tzdata.mk
index e20c946208..75fa5eb67e 100644
--- a/package/tzdata/tzdata.mk
+++ b/package/tzdata/tzdata.mk
@@ -25,6 +25,17 @@ TZDATA_ZONELIST = $(call qstrip,$(BR2_TARGET_TZ_ZONELIST))
endif
TZDATA_LOCALTIME = $(call qstrip,$(BR2_TARGET_LOCALTIME))
+ifneq ($(TZDATA_LOCALTIME),)
+define TZDATA_SET_LOCALTIME
+ 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
+endif
# No need to extract for target, we're using the host-installed files
TZDATA_EXTRACT_CMDS =
@@ -36,13 +47,7 @@ define TZDATA_INSTALL_TARGET_CMDS
for zone in posix/*; do \
ln -sfn "$${zone}" "$${zone##*/}"; \
done
- 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
+ $(TZDATA_SET_LOCALTIME)
endef
define HOST_TZDATA_BUILD_CMDS
diff --git a/system/Config.in b/system/Config.in
index 498b56e222..b1aebf4ef5 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -481,6 +481,8 @@ config BR2_TARGET_LOCALTIME
Pacific/Wallis
...
+ Set to empty to not install a default time zone.
+
endif # BR2_TARGET_TZ_INFO
config BR2_ROOTFS_USERS_TABLES