X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fsvn-archive%2Farchive.git;a=blobdiff_plain;f=package%2Fbase-files%2Ffiles%2Fetc%2Finit.d%2Fboot;h=d5a42e2d7efef24cc1e983cf5ffe16305618f813;hp=c58365234749a848db67500a6742440895a018fd;hb=4425594e097b7cedcc65d8989e326d3340404833;hpb=f134c8e1d6385368996ffdfa54fd84b6e4abf2ee diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot index c583652347..d5a42e2d7e 100755 --- a/package/base-files/files/etc/init.d/boot +++ b/package/base-files/files/etc/init.d/boot @@ -2,25 +2,42 @@ # Copyright (C) 2006 OpenWrt.org START=10 + +system_config() { + local cfg="$1" + local hostname + + config_get hostname "$cfg" hostname + echo "${hostname:-OpenWrt}" > /proc/sys/kernel/hostname +} + 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 - HOSTNAME=${wan_hostname%%.*} - echo ${HOSTNAME:=OpenWrt}>/proc/sys/kernel/hostname + config_load system + config_foreach system_config system mkdir -p /var/run mkdir -p /var/log mkdir -p /var/lock touch /var/log/wtmp touch /var/log/lastlog + ln -s /tmp/resolv.conf.auto /tmp/resolv.conf [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe - # manually trigger hotplug before loading modules + # the coldplugging of network interfaces needs to happen later, so we do it manually here for iface in $(awk -F: '/:/ {print $1}' /proc/net/dev); do - /usr/bin/env -i ACTION=add INTERFACE="$iface" /sbin/hotplug net + /usr/bin/env -i ACTION=add INTERFACE="$iface" /sbin/hotplug-call net done - + /sbin/hotplug2 --persistent --max-children 1 & + + # 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 + } + load_modules /etc/modules.d/* }