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 <sagaert.johan@skynet.be>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Yann E. MORIN 2014-05-22 22:40:59 +02:00 committed by Peter Korsgaard
parent 5d231598c2
commit 5f017a8961
2 changed files with 10 additions and 0 deletions

View 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

View 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; \