Limit the number of hotplug childrens
[openwrt/svn-archive/archive.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
14 start() {
15 [ -f /proc/mounts ] || /sbin/mount_root
16 [ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc
17 vconfig set_name_type DEV_PLUS_VID_NO_PAD
18
19 config_load system
20 config_foreach system_config system
21
22 mkdir -p /var/run
23 mkdir -p /var/log
24 mkdir -p /var/lock
25 touch /var/log/wtmp
26 touch /var/log/lastlog
27 ln -s /tmp/resolv.conf.auto /tmp/resolv.conf
28 [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe
29
30 # manually trigger hotplug before loading modules
31 for iface in $(awk -F: '/:/ {print $1}' /proc/net/dev); do
32 /usr/bin/env -i ACTION=add INTERFACE="$iface" /sbin/hotplug-call net
33 done
34
35 /sbin/hotplug2 --persistent --max-children 1 &
36 echo /sbin/hotplug-call > /proc/sys/kernel/hotplug
37
38 load_modules /etc/modules.d/*
39 }