system/timezone: check localtime exists
authorYann E. MORIN <yann.morin.1998@free.fr>
Thu, 22 May 2014 20:40:59 +0000 (22:40 +0200)
committerPeter Korsgaard <peter@korsgaard.com>
Thu, 22 May 2014 21:52:18 +0000 (23:52 +0200)
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 <sagaert.johan@skynet.be>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
package/tz/tz.mk
package/tzdata/tzdata.mk

index 865ba3bb9c2bb86813200631ce28e665d7b12765..770cc46b300332a93f708d3aa12b999a511a49aa 100644 (file)
@@ -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
index a498d10c35bd9b2bcd36c55ffe7de536f9411792..58b5f130e48f86a8ad6f7f8cfb3e22053db966b4 100644 (file)
@@ -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;                       \