Root/package/base-files/files/etc/init.d/boot

Source at commit be5d8eda3eee17f6665f4dde5e0205e9bb40c137 created 9 years 2 months ago.
By kyak, Disable syslogd and klogd
1#!/bin/sh /etc/rc.common
2# Copyright (C) 2006 OpenWrt.org
3
4START=10
5STOP=98
6
7system_config() {
8    local cfg="$1"
9
10    local hostname conloglevel timezone
11
12    config_get hostname "$cfg" hostname 'OpenWrt'
13    echo "$hostname" > /proc/sys/kernel/hostname
14
15    config_get conloglevel "$cfg" conloglevel
16    config_get buffersize "$cfg" buffersize
17    [ -z "$conloglevel" -a -z "$buffersize" ] || dmesg ${conloglevel:+-n $conloglevel} ${buffersize:+-s $buffersize}
18    
19    config_get timezone "$cfg" timezone 'UTC'
20    echo "$timezone" > /tmp/TZ
21
22    if [ -x /sbin/syslogd ]; then
23        local log_ip log_size log_port log_type log_file
24        config_get log_ip "$cfg" log_ip
25        config_get log_size "$cfg" log_size 16
26        config_get log_port "$cfg" log_port 514
27        config_get log_type "$cfg" log_type circular
28        config_get log_file "$cfg" log_file "/var/log/messages"
29        if [ "$log_type" = "file" ]; then
30            syslogd -s $log_size -O $log_file ${log_ip:+-L -R ${log_ip}:${log_port}} -S
31        else
32            #syslogd -C${log_size} ${log_ip:+-L -R ${log_ip}:${log_port}}
33            true
34        fi
35    fi
36    config_get klogconloglevel "$cfg" klogconloglevel
37    #[ -x /sbin/klogd ] && klogd ${klogconloglevel:+-c $klogconloglevel}
38}
39
40apply_uci_config() {
41    sh -c '. /etc/functions.sh; include /lib/config; uci_apply_defaults'
42}
43
44start() {
45    [ -f /proc/mounts ] || /sbin/mount_root
46    [ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc
47    [ -f /proc/net/vlan/config ] && vconfig set_name_type DEV_PLUS_VID_NO_PAD
48
49    apply_uci_config
50    config_load system
51    config_foreach system_config system
52    
53    mkdir -p /var/run
54    mkdir -p /var/log
55    mkdir -p /var/lock
56    mkdir -p /var/state
57    mkdir -p /tmp/.uci
58    chmod 0700 /tmp/.uci
59    touch /var/log/wtmp
60    touch /var/log/lastlog
61    touch /tmp/resolv.conf.auto
62    ln -sf /tmp/resolv.conf.auto /tmp/resolv.conf
63    grep -q debugfs /proc/filesystems && mount -t debugfs debugfs /sys/kernel/debug
64    [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe
65
66    killall -q hotplug2
67    [ -x /sbin/hotplug2 ] && /sbin/hotplug2 --override --persistent \
68            --set-worker /lib/hotplug2/worker_fork.so \
69            --set-rules-file /etc/hotplug2.rules \
70            --max-children 1 >/dev/null 2>&1 &
71
72    # the coldplugging of network interfaces needs to happen later, so we do it manually here
73    for iface in $(awk -F: '/:/ {print $1}' /proc/net/dev); do
74        /usr/bin/env -i ACTION=add INTERFACE="$iface" /sbin/hotplug-call net
75    done
76
77    # create /dev/root if it doesn't exist
78    [ -e /dev/root -o -h /dev/root ] || {
79        rootdev=$(awk 'BEGIN { RS=" "; FS="="; } $1 == "root" { print $2 }' < /proc/cmdline)
80        [ -n "$rootdev" ] && ln -s "$rootdev" /dev/root
81    }
82
83    load_modules /etc/modules.d/*
84
85    # another round of USB coldplugging to kick devices into operation which lacked drivers before
86    for dev in /sys/bus/usb/devices/*/uevent; do
87        [ -e "$dev" ] && echo -n add > "$dev"
88    done
89}
90
91stop() {
92        killall -9 syslogd 2> /dev/null
93}
94
95

Archive Download this file



interactive