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