Verified Commit 7025fc03 authored by Josef Schlehofer's avatar Josef Schlehofer 💬
Browse files

patches/openwrt: backport fix zoneinfo for some countries

parent 34d920dc
From d86c9f4f37883408fa77b7a70ca8a9c1f73e35f3 Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Fri, 9 Apr 2021 17:22:48 -0700
Subject: [PATCH] base-files: fix zoneinfo support
The system init script currently sets /tmp/localinfo when zoneinfo is
populated. However, zoneinfo has spaces in it whereas the actual files
have _ instead of spaces. This made the if condition never return true.
Example failure when removing the if condition:
/tmp/localtime -> /usr/share/zoneinfo/America/Los Angeles
This file does not exist. America/Los_Angeles does.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
package/base-files/files/etc/init.d/system | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/package/base-files/files/etc/init.d/system b/package/base-files/files/etc/init.d/system
index 08cf86b97f..b1fc154cec 100755
--- a/package/base-files/files/etc/init.d/system
+++ b/package/base-files/files/etc/init.d/system
@@ -22,9 +22,13 @@ system_config() {
echo "$hostname" > /proc/sys/kernel/hostname
[ -z "$conloglevel" -a -z "$buffersize" ] || dmesg ${conloglevel:+-n $conloglevel} ${buffersize:+-s $buffersize}
- echo "$timezone" > /tmp/TZ
- [ -n "$zonename" ] && [ -f "/usr/share/zoneinfo/$zonename" ] && \
- ln -sf "/usr/share/zoneinfo/$zonename" /tmp/localtime && rm -f /tmp/TZ
+ if [ -n "$zonename" ]; then
+ local zname=$(echo "$zonename" | tr ' ' _)
+ [ -f "/usr/share/zoneinfo/$zname" ] && \
+ ln -sf "/usr/share/zoneinfo/$zname" /tmp/localtime
+ else
+ echo "$timezone" > /tmp/TZ
+ fi
# apply timezone to kernel
hwclock -u --systz
--
2.25.1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment