From: Yann E. MORIN Date: Thu, 22 May 2014 20:40:59 +0000 (+0200) Subject: system/timezone: check localtime exists X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5f017a8961e071ceda5350e2d12b58d969b439dd;p=buildroot.git 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 --- 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; \