2006-10-05 04:05:48 +08:00
|
|
|
#!/bin/sh /etc/rc.common
|
2006-06-27 08:36:13 +08:00
|
|
|
# Copyright (C) 2006 OpenWrt.org
|
|
|
|
|
2006-10-16 05:03:30 +08:00
|
|
|
START=10
|
2007-03-07 05:28:57 +08:00
|
|
|
|
|
|
|
system_config() {
|
|
|
|
local cfg="$1"
|
|
|
|
local hostname
|
|
|
|
|
|
|
|
config_get hostname "$cfg" hostname
|
|
|
|
echo "${hostname:-OpenWrt}" > /proc/sys/kernel/hostname
|
|
|
|
}
|
|
|
|
|
2006-10-05 04:05:48 +08:00
|
|
|
start() {
|
|
|
|
[ -f /proc/mounts ] || /sbin/mount_root
|
|
|
|
[ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc
|
|
|
|
vconfig set_name_type DEV_PLUS_VID_NO_PAD
|
|
|
|
|
2007-03-07 05:28:57 +08:00
|
|
|
config_load system
|
|
|
|
config_foreach system_config system
|
2006-10-05 04:05:48 +08:00
|
|
|
|
|
|
|
mkdir -p /var/run
|
|
|
|
mkdir -p /var/log
|
|
|
|
mkdir -p /var/lock
|
|
|
|
touch /var/log/wtmp
|
|
|
|
touch /var/log/lastlog
|
2007-01-09 05:33:53 +08:00
|
|
|
ln -s /tmp/resolv.conf.auto /tmp/resolv.conf
|
2006-10-05 04:05:48 +08:00
|
|
|
[ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe
|
|
|
|
|
|
|
|
# manually trigger hotplug before loading modules
|
|
|
|
for iface in $(awk -F: '/:/ {print $1}' /proc/net/dev); do
|
2007-03-05 04:31:53 +08:00
|
|
|
/usr/bin/env -i ACTION=add INTERFACE="$iface" /sbin/hotplug-call net
|
2006-10-05 04:05:48 +08:00
|
|
|
done
|
2007-04-02 02:30:32 +08:00
|
|
|
|
2007-04-17 07:58:46 +08:00
|
|
|
/sbin/hotplug2 --persistent --max-children 5 &
|
2007-03-05 04:31:53 +08:00
|
|
|
echo /sbin/hotplug-call > /proc/sys/kernel/hotplug
|
|
|
|
|
2007-04-30 00:57:55 +08:00
|
|
|
# create /dev/root if it doesn't exist
|
|
|
|
[ -e /dev/root ] || {
|
|
|
|
rootdev=$(awk 'BEGIN { RS=" "; FS="="; } $1 == "root" { print $2 }' < /proc/cmdline)
|
|
|
|
[ -n "$rootdev" ] && ln -s "$rootdev" /dev/root
|
|
|
|
}
|
|
|
|
|
2006-10-17 07:23:58 +08:00
|
|
|
load_modules /etc/modules.d/*
|
2006-10-05 04:05:48 +08:00
|
|
|
}
|