3b804320963764f89ace55daebb337217e4f9b17
[openwrt/svn-archive/archive.git] / package / base-files / files / etc / init.d / rcS
1 #!/bin/sh
2 # Copyright (C) 2006 OpenWrt.org
3
4 run_scripts() {
5 for i in /etc/rc.d/$1*; do
6 [ -x $i ] && $i $2 2>&1
7 done | $LOGGER
8 }
9
10 system_config() {
11 config_get_bool foreground $1 foreground 0
12 }
13
14 LOGGER="cat"
15 [ -x /usr/bin/logger ] && LOGGER="logger -s -p 6 -t sysinit"
16
17 . /etc/functions.sh
18
19 config_load system
20 config_foreach system_config system
21
22 if [ "$1" = "S" -a "$foreground" != "1" ]; then
23 run_scripts "$1" "$2" &
24 else
25 run_scripts "$1" "$2"
26 fi