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