OpenWrt – Blame information for rev 3
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | #!/bin/sh /etc/rc.common |
2 | # Copyright (C) 2014 OpenWrt.org |
||
3 | |||
4 | START=10 |
||
5 | USE_PROCD=1 |
||
6 | |||
7 | validate_system_section() |
||
8 | { |
||
3 | office | 9 | uci_validate_section system system "${1}" \ |
1 | office | 10 | 'hostname:string:OpenWrt' \ |
11 | 'conloglevel:uinteger' \ |
||
12 | 'buffersize:uinteger' \ |
||
13 | 'timezone:string:UTC' \ |
||
14 | 'zonename:string' |
||
15 | } |
||
16 | |||
17 | system_config() { |
||
3 | office | 18 | local cfg="$1" |
19 | |||
20 | local hostname conloglevel buffersize timezone zonename |
||
21 | |||
22 | validate_system_section "${1}" || { |
||
1 | office | 23 | echo "validation failed" |
24 | return 1 |
||
25 | } |
||
26 | |||
27 | echo "$hostname" > /proc/sys/kernel/hostname |
||
28 | [ -z "$conloglevel" -a -z "$buffersize" ] || dmesg ${conloglevel:+-n $conloglevel} ${buffersize:+-s $buffersize} |
||
29 | echo "$timezone" > /tmp/TZ |
||
30 | [ -n "$zonename" ] && [ -f "/usr/share/zoneinfo/$zonename" ] && \ |
||
31 | ln -sf "/usr/share/zoneinfo/$zonename" /tmp/localtime && rm -f /tmp/TZ |
||
32 | |||
33 | # apply timezone to kernel |
||
34 | date -k |
||
35 | } |
||
36 | |||
37 | reload_service() { |
||
38 | config_load system |
||
3 | office | 39 | config_foreach system_config system |
1 | office | 40 | } |
41 | |||
42 | service_triggers() |
||
43 | { |
||
44 | procd_add_reload_trigger "system" |
||
45 | procd_add_validation validate_system_section |
||
46 | } |
||
47 | |||
48 | start_service() { |
||
49 | reload_service |
||
50 | } |