1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2014 OpenWrt.org
7 validate_system_section()
9 uci_validate_section system system "${1}" \
10 'hostname:string:OpenWrt' \
11 'conloglevel:uinteger' \
12 'buffersize:uinteger' \
13 'timezone:string:UTC' \
22 local hostname conloglevel buffersize timezone zonename
24 validate_system_section "${1}" || {
25 echo "validation failed"
29 echo "$hostname" > /proc/sys/kernel/hostname
30 [ -z "$conloglevel" -a -z "$buffersize" ] || dmesg ${conloglevel:+-n $conloglevel} ${buffersize:+-s $buffersize}
31 echo "$timezone" > /tmp/TZ
32 [ -n "$zonename" ] && [ -f "/usr/share/zoneinfo/$zonename" ] && ln -s "/usr/share/zoneinfo/$zonename" /tmp/localtime
34 # apply timezone to kernel
40 config_foreach system_config system
45 procd_add_reload_trigger "system"
46 procd_add_validation validate_system_section