aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2021-04-09 17:22:48 -0700
committerPaul Spooren <mail@aparcar.org>2021-06-23 15:44:30 -1000
commitc88bdb8294a73e0eaa3cd86e843564a8244b333c (patch)
tree0c5d18b7131c7324e91a621981217a2d2477044a /package/base-files/files
parent15612706c930ed26af9e05b649efc2d245157273 (diff)
downloadupstream-c88bdb8294a73e0eaa3cd86e843564a8244b333c.tar.gz
upstream-c88bdb8294a73e0eaa3cd86e843564a8244b333c.tar.bz2
upstream-c88bdb8294a73e0eaa3cd86e843564a8244b333c.zip
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. Ran through shfmt -w -ci -bn -sr -s Signed-off-by: Rosen Penev <rosenp@gmail.com> (cherry picked from commit 8af62ede189aa504135db05474d34c9f8a1ed35d)
Diffstat (limited to 'package/base-files/files')
-rwxr-xr-xpackage/base-files/files/etc/init.d/system16
1 files changed, 9 insertions, 7 deletions
diff --git a/package/base-files/files/etc/init.d/system b/package/base-files/files/etc/init.d/system
index a98a972469..219b29812d 100755
--- a/package/base-files/files/etc/init.d/system
+++ b/package/base-files/files/etc/init.d/system
@@ -4,8 +4,7 @@
START=10
USE_PROCD=1
-validate_system_section()
-{
+validate_system_section() {
uci_load_validate system system "$1" "$2" \
'hostname:string:OpenWrt' \
'conloglevel:uinteger' \
@@ -22,9 +21,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
+ 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
date -k
@@ -35,8 +38,7 @@ reload_service() {
config_foreach validate_system_section system system_config
}
-service_triggers()
-{
+service_triggers() {
procd_add_reload_trigger "system"
procd_add_validation validate_system_section
}