START=10
USE_PROCD=1
-validate_system_section()
-{
+validate_system_section() {
uci_load_validate system system "$1" "$2" \
'hostname:string:OpenWrt' \
'conloglevel:uinteger' \
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
config_foreach validate_system_section system system_config
}
-service_triggers()
-{
+service_triggers() {
procd_add_reload_trigger "system"
procd_add_validation validate_system_section
}