make option name optional
[openwrt.git] / package / base-files / files / etc / init.d / boot
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2006 OpenWrt.org
3
4 START=10
5
6 system_config() {
7 local cfg="$1"
8 local hostname
9
10 config_get hostname "$cfg" hostname
11 echo "${hostname:-OpenWrt}" > /proc/sys/kernel/hostname
12
13 config_get conloglevel "$cfg" conloglevel
14 [ -n "$conloglevel" ] && dmesg -n "$conloglevel"
15
16 config_get timezone "$cfg" timezone
17 [ -z "$timezone" ] && timezone=UTC
18 echo "$timezone" > /tmp/TZ
19
20 config_get log_ip "$cfg" log_ip
21 config_get log_size "$cfg" log_size
22 syslogd -C${log_size:-16} ${log_ip:+-L -R $log_ip}
23 klogd
24 }
25
26 apply_uci_config() {(
27 include /lib/config
28 uci_apply_defaults
29 )}
30
31 start() {
32 [ -f /proc/mounts ] || /sbin/mount_root
33 [ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc
34 [ -f /proc/net/vlan/config ] && vconfig set_name_type DEV_PLUS_VID_NO_PAD
35
36 apply_uci_config
37 config_load system
38 config_foreach system_config system
39
40 mkdir -p /var/run
41 mkdir -p /var/log
42 mkdir -p /var/lock
43 mkdir -p /var/state
44 mkdir -p /tmp/.uci
45 chown 0700 /tmp/.uci
46 touch /var/log/wtmp
47 touch /var/log/lastlog
48 touch /tmp/resolv.conf.auto
49 ln -sf /tmp/resolv.conf.auto /tmp/resolv.conf
50 [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe
51
52 killall -q hotplug2
53 [ -x /sbin/hotplug2 ] && /sbin/hotplug2 --override --persistent \
54 --max-children 1 --no-coldplug &
55
56 # the coldplugging of network interfaces needs to happen later, so we do it manually here
57 for iface in $(awk -F: '/:/ {print $1}' /proc/net/dev); do
58 /usr/bin/env -i ACTION=add INTERFACE="$iface" /sbin/hotplug-call net
59 done
60
61 # create /dev/root if it doesn't exist
62 [ -e /dev/root ] || {
63 rootdev=$(awk 'BEGIN { RS=" "; FS="="; } $1 == "root" { print $2 }' < /proc/cmdline)
64 [ -n "$rootdev" ] && ln -s "$rootdev" /dev/root
65 }
66
67 load_modules /etc/modules.d/*
68 }
This page took 0.047263 seconds and 5 git commands to generate.