56bdb6bb97
The zoneinfo packages are not installed per default so neither
/tmp/localtime nor /tmp/TZ is generated.
This patch mostly reverts the previous fix and instead incooperates a
solution suggested by Jo.
Fixes "base-files: fix zoneinfo support " 8af62ed
Signed-off-by: Paul Spooren <mail@aparcar.org>
46 lines
1007 B
Bash
Executable File
46 lines
1007 B
Bash
Executable File
#!/bin/sh /etc/rc.common
|
|
# Copyright (C) 2014 OpenWrt.org
|
|
|
|
START=10
|
|
USE_PROCD=1
|
|
|
|
validate_system_section() {
|
|
uci_load_validate system system "$1" "$2" \
|
|
'hostname:string:OpenWrt' \
|
|
'conloglevel:uinteger' \
|
|
'buffersize:uinteger' \
|
|
'timezone:string:UTC' \
|
|
'zonename:string'
|
|
}
|
|
|
|
system_config() {
|
|
[ "$2" = 0 ] || {
|
|
echo "validation failed"
|
|
return 1
|
|
}
|
|
|
|
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
|
|
|
|
# apply timezone to kernel
|
|
hwclock -u --systz
|
|
}
|
|
|
|
reload_service() {
|
|
config_load system
|
|
config_foreach validate_system_section system system_config
|
|
}
|
|
|
|
service_triggers() {
|
|
procd_add_reload_trigger "system"
|
|
procd_add_validation validate_system_section
|
|
}
|
|
|
|
start_service() {
|
|
reload_service
|
|
}
|