cleanup MTD option handling
[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 config_get log_port "$cfg" log_port
23 [ -x /sbin/syslogd ] && syslogd -C${log_size:-16} ${log_ip:+-L -R $log_ip${log_port:+:$log_port}}
24 [ -x /sbin/klogd ] && klogd
25 }
26
27 apply_uci_config() {(
28 include /lib/config
29 uci_apply_defaults
30 )}
31
32 start() {
33 [ -f /proc/mounts ] || /sbin/mount_root
34 [ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc
35 [ -f /proc/net/vlan/config ] && vconfig set_name_type DEV_PLUS_VID_NO_PAD
36
37 apply_uci_config
38 config_load system
39 config_foreach system_config system
40
41 mkdir -p /var/run
42 mkdir -p /var/log
43 mkdir -p /var/lock
44 mkdir -p /var/state
45 mkdir -p /tmp/.uci
46 chmod 0700 /tmp/.uci
47 touch /var/log/wtmp
48 touch /var/log/lastlog
49 touch /tmp/resolv.conf.auto
50 ln -sf /tmp/resolv.conf.auto /tmp/resolv.conf
51 [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe
52
53 killall -q hotplug2
54 [ -x /sbin/hotplug2 ] && /sbin/hotplug2 --override --persistent \
55 --max-children 1 --no-coldplug >/dev/null 2>&1 &
56
57 # the coldplugging of network interfaces needs to happen later, so we do it manually here
58 for iface in $(awk -F: '/:/ {print $1}' /proc/net/dev); do
59 /usr/bin/env -i ACTION=add INTERFACE="$iface" /sbin/hotplug-call net
60 done
61
62 # create /dev/root if it doesn't exist
63 [ -e /dev/root ] || {
64 rootdev=$(awk 'BEGIN { RS=" "; FS="="; } $1 == "root" { print $2 }' < /proc/cmdline)
65 [ -n "$rootdev" ] && ln -s "$rootdev" /dev/root
66 }
67
68 load_modules /etc/modules.d/*
69 }
This page took 0.050329 seconds and 5 git commands to generate.