source: trunk/package/base-files/files/etc/init.d/system @ 39615

Last change on this file since 39615 was 39615, checked in by blogic, 3 years ago

base-files: split /etc/init.d/boot into 2 files

this allows us to bind a procd trigger to system.@system[-1]

Signed-off-by: John Crispin <blogic@…>

  • Property svn:executable set to *
File size: 1.0 KB
Line 
1#!/bin/sh /etc/rc.common
2# Copyright (C) 2014 OpenWrt.org
3
4START=10
5USE_PROCD=1
6
7validate_system_section()
8{
9        uci_validate_section system system "${1}" \
10                'hostname:string:OpenWrt' \
11                'conloglevel:uinteger' \
12                'buffersize:uinteger' \
13                'timezone:string:UTC' \
14                'zonename:string'
15
16        return $?
17}
18
19system_config() {
20        local cfg="$1"
21
22        local hostname conloglevel buffersize timezone zonename
23
24        validate_system_section "${1}" || {
25                echo "validation failed"
26                return 1
27        }
28
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
33
34        # apply timezone to kernel
35        date -k
36}
37
38reload_service() {
39        config_load system
40        config_foreach system_config system
41}
42
43service_triggers()
44{
45        procd_add_reload_trigger "system"
46        procd_add_validation validate_system_section
47}
48
49start_service() {
50        reload_service
51}
Note: See TracBrowser for help on using the repository browser.