From 5f017a8961e071ceda5350e2d12b58d969b439dd Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Thu, 22 May 2014 22:40:59 +0200 Subject: [PATCH] system/timezone: check localtime exists When installing a localtime, check it is a valid timezone. [Peter: extend error message to make it clear to the user what to change] Reported-by: Sagaert Johan Signed-off-by: "Yann E. MORIN" Signed-off-by: Peter Korsgaard --- package/tz/tz.mk | 5 +++++ package/tzdata/tzdata.mk | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/package/tz/tz.mk b/package/tz/tz.mk index 865ba3bb9c..770cc46b30 100644 --- a/package/tz/tz.mk +++ b/package/tz/tz.mk @@ -27,6 +27,11 @@ 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 \ + 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/uclibc/$(TZDATA_LOCALTIME) TZ; \ fi diff --git a/package/tzdata/tzdata.mk b/package/tzdata/tzdata.mk index a498d10c35..58b5f130e4 100644 --- a/package/tzdata/tzdata.mk +++ b/package/tzdata/tzdata.mk @@ -44,6 +44,11 @@ define TZDATA_INSTALL_TARGET_CMDS 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; \ -- 2.30.2