system/timezone: check localtime exists
PATCH 1/1 system/timezone: check localtime exists
From: "Yann E. MORIN" <[email protected]>
When installing a localtime, check it is a valid timezone.
Reported-by Sagaert Johan <[email protected]>
Signed-off-by "Yann E. MORIN" <[email protected]>
--- package/tz/tz.mk | 5 +++++ package/tzdata/tzdata.mk | 5 +++++ 2 files changed, 10 insertions(+)
package/tz/tz.mk +5 -0
@@ -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 "'%s' is not a valid timezone\n" \ + "$(TZDATA_LOCALTIME)"; \ + exit 1; \ + fi; \ cd $(TARGET_DIR)/etc; \ ln -sf ../usr/share/zoneinfo/uclibc/$(TZDATA_LOCALTIME) TZ; \ fi
package/tzdata/tzdata.mk +5 -0
@@ -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 "'%s' is not a valid timezone\n" \ + "$(TZDATA_LOCALTIME)"; \ + exit 1; \ + fi; \ cd $(TARGET_DIR)/etc; \ ln -sf ../usr/share/zoneinfo/$(TZDATA_LOCALTIME) localtime; \ echo "$(TZDATA_LOCALTIME)" >timezone; \
Signature · 1 line
1.8.3.2
PATCH 1/1 system/timezone: check localtime exists
Quoted 17 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yann" == Yann E MORIN <[email protected]> writes:
From: "Yann E. MORIN" <[email protected]> When installing a localtime, check it is a valid timezone.
Reported-by Sagaert Johan <[email protected]>Signed-off-by "Yann E. MORIN" <[email protected]>--- package/tz/tz.mk | 5 +++++ package/tzdata/tzdata.mk | 5 +++++ 2 files changed, 10 insertions(+)package/tz/tz.mk +0
-0
package/tz/tz.mk define TZ_INSTALL_TARGET_CMDS · line 32
Quoted 6 lines
package/tz/tz.mk +3
-0@@ -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 "'%s' is not a valid timezone\n" \ + "$(TZDATA_LOCALTIME)"; \
I have extended this to make it a bit more clear what the user should change:
- printf "'%s' is not a valid timezone\n" \
+ printf "Error: '%s' is not a valid timezone, check your BR2_TARGET_LOCALTIME setting\n" \
And committed, thanks.
Signature · 1 line
Bye, Peter Korsgaard