1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2006 OpenWrt.org
10 config_get hostname
"$cfg" hostname
11 echo "${hostname:-OpenWrt}" > /proc
/sys
/kernel
/hostname
13 config_get conloglevel
"$cfg" conloglevel
14 [ -n "$conloglevel" ] && dmesg
-n "$conloglevel"
16 config_get timezone
"$cfg" timezone
17 [ -z "$timezone" ] && timezone
=UTC
18 echo "$timezone" > /tmp
/TZ
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
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
39 config_foreach system_config system
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
54 [ -x /sbin
/hotplug2
] && /sbin
/hotplug2
--override --persistent \
55 --set-worker /lib
/hotplug
2/worker_fork.so \
56 --set-rules-file /etc
/hotplug2.rules \
57 --max-children 1 >/dev
/null
2>&1 &
59 # the coldplugging of network interfaces needs to happen later, so we do it manually here
60 for iface
in $
(awk -F: '/:/ {print $1}' /proc
/net
/dev
); do
61 /usr
/bin
/env
-i ACTION
=add INTERFACE
="$iface" /sbin
/hotplug-call net
64 # create /dev/root if it doesn't exist
66 rootdev
=$
(awk 'BEGIN { RS=" "; FS="="; } $1 == "root" { print $2 }' < /proc
/cmdline
)
67 [ -n "$rootdev" ] && ln -s "$rootdev" /dev
/root
70 load_modules
/etc
/modules.d
/*