X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fopenwrt.git;a=blobdiff_plain;f=package%2Fbase-files%2Ffiles%2Fetc%2Finit.d%2Fboot;h=a53be743e8872b67ad6d4fff64565ef34009dab8;hp=12226be7884dcd4af95a2691dcfbd101b3864b44;hb=cf4a0d430b849f63d51d324c47411c77e62eb3d6;hpb=cbd52550bdc805409f2e354d7e3c0a5e8044ac28 diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot index 12226be788..a53be743e8 100755 --- a/package/base-files/files/etc/init.d/boot +++ b/package/base-files/files/etc/init.d/boot @@ -1,69 +1,61 @@ #!/bin/sh /etc/rc.common -# Copyright (C) 2006 OpenWrt.org +# Copyright (C) 2006-2011 OpenWrt.org START=10 +STOP=98 -system_config() { - local cfg="$1" - local hostname - - config_get hostname "$cfg" hostname - echo "${hostname:-OpenWrt}" > /proc/sys/kernel/hostname - - config_get conloglevel "$cfg" conloglevel - [ -n "$conloglevel" ] && dmesg -n "$conloglevel" - - config_get timezone "$cfg" timezone - [ -z "$timezone" ] && timezone=UTC - echo "$timezone" > /tmp/TZ +uci_apply_defaults() { + . /lib/functions/system.sh - config_get log_ip "$cfg" log_ip - config_get log_size "$cfg" log_size - config_get log_port "$cfg" log_port - [ -x /sbin/syslogd ] && syslogd -C${log_size:-16} ${log_ip:+-L -R $log_ip${log_port:+:$log_port}} - [ -x /sbin/klogd ] && klogd + cd /etc/uci-defaults || return 0 + files="$(ls)" + [ -z "$files" ] && return 0 + mkdir -p /tmp/.uci + for file in $files; do + ( . "./$(basename $file)" ) && rm -f "$file" + done + uci commit } -apply_uci_config() {( - include /lib/config - uci_apply_defaults -)} - -start() { +boot() { [ -f /proc/mounts ] || /sbin/mount_root [ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc [ -f /proc/net/vlan/config ] && vconfig set_name_type DEV_PLUS_VID_NO_PAD - apply_uci_config - config_load system - config_foreach system_config system - mkdir -p /var/run mkdir -p /var/log mkdir -p /var/lock mkdir -p /var/state mkdir -p /tmp/.uci chmod 0700 /tmp/.uci + mkdir -p /tmp/.jail touch /var/log/wtmp touch /var/log/lastlog touch /tmp/resolv.conf.auto ln -sf /tmp/resolv.conf.auto /tmp/resolv.conf + grep -q debugfs /proc/filesystems && /bin/mount -o noatime -t debugfs debugfs /sys/kernel/debug [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe - killall -q hotplug2 - [ -x /sbin/hotplug2 ] && /sbin/hotplug2 --override --persistent \ - --max-children 1 --no-coldplug >/dev/null 2>&1 & + /sbin/kmodloader - # 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-call net - done + # allow wifi modules time to settle + sleep 1 + + /sbin/wifi detect > /tmp/wireless.tmp + [ -s /tmp/wireless.tmp ] && { + cat /tmp/wireless.tmp >> /etc/config/wireless + } + rm -f /tmp/wireless.tmp + + /bin/board_detect + uci_apply_defaults + + # temporary hack until configd exists + /sbin/reload_config # create /dev/root if it doesn't exist - [ -e /dev/root ] || { + [ -e /dev/root -o -h /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/* }