Index: Makefile
===================================================================
--- Makefile	(revision 5d96f6ac4b291f703f57141a9e6564d095e7d76e)
+++ Makefile	(revision 292c8323d9ad92439f1b20732aadbc20b191d8dd)
@@ -1,3 +1,3 @@
-VERSION		:= 1.0-pre4
+VERSION		:= 1.0-pre5
 
 ETCDIR		:= /etc
@@ -12,11 +12,10 @@
 	@echo "Select an appropriate install target from the above list" ; exit 1
 
-.PHONY: dist
 dist:
-	rm -rf "dist/bootscripts-clfs-embedded-$(VERSION)"
-	mkdir -p "dist/bootscripts-clfs-embedded-$(VERSION)"
-	tar --exclude dist -c * | tar -x -C "dist/bootscripts-clfs-embedded-$(VERSION)"
-	(cd dist; tar -cjf "bootscripts-clfs-embedded-$(VERSION).tar.bz2" "bootscripts-clfs-embedded-$(VERSION)")
-	rm -rf "dist/bootscripts-clfs-embedded-$(VERSION)"
+	rm -rf "dist/clfs-embedded-bootscripts-$(VERSION)"
+	mkdir -p "dist/clfs-embedded-bootscripts-$(VERSION)"
+	tar --exclude dist -c * | tar -x -C "dist/clfs-embedded-bootscripts-$(VERSION)"
+	(cd dist; tar -cjf "clfs-embedded-bootscripts-$(VERSION).tar.bz2" "clfs-embedded-bootscripts-$(VERSION)")
+	rm -rf "dist/clfs-embedded-bootscripts-$(VERSION)"
 
 create-dirs:
@@ -29,8 +28,16 @@
 	install -m ${MODE} clfs/rc.d/init.d/network  ${EXTDIR}/rc.d/init.d/
 	install -m ${MODE} clfs/rc.d/init.d/syslog   ${EXTDIR}/rc.d/init.d/
+	install -m ${MODE} clfs/rc.d/init.d/bridge   ${EXTDIR}/rc.d/init.d/
 	ln -sf ../init.d/syslog ${EXTDIR}/rc.d/start/S05syslog
 	ln -sf ../init.d/syslog ${EXTDIR}/rc.d/stop/K99syslog
 	ln -sf ../init.d/network ${EXTDIR}/rc.d/start/S10network
 	ln -sf ../init.d/network ${EXTDIR}/rc.d/stop/K80network
+	ln -sf ../init.d/bridge ${EXTDIR}/rc.d/start/S09bridge
+	ln -sf ../init.d/bridge ${EXTDIR}/rc.d/stop/K81bridge
+
+install-bcm47xx: create-dirs
+	install -m ${MODE} clfs/rc.d/init.d/bcm47xx-switch ${EXTDIR}/rc.d/init.d/
+	ln -sf ../init.d/bcm47xx-switch ${EXTDIR}/rc.d/start/S08bcm47xx-switch
+	ln -sf ../init.d/bcm47xx-switch ${EXTDIR}/rc.d/stop/K82bcm47xx-switch
 
 install-dropbear: create-dirs
@@ -39,3 +46,9 @@
 	ln -sf ../init.d/sshd ${EXTDIR}/rc.d/stop/K30sshd
 
-.PHONY: all create-dirs install install-dropbear
+install-hostapd: create-dirs
+	install -m ${MODE} clfs/rc.d/init.d/hostapd ${EXTDIR}/rc.d/init.d
+	ln -sf ../init.d/hostapd ${EXTDIR}/rc.d/start/S08hostapd
+	ln -sf ../init.d/hostapd ${EXTDIR}/rc.d/stop/K82hostapd
+
+.PHONY: dist all create-dirs install install-bcm47xx install-dropbear \
+        install-hostapd
Index: clfs/rc.d/init.d/functions
===================================================================
--- clfs/rc.d/init.d/functions	(revision 5d96f6ac4b291f703f57141a9e6564d095e7d76e)
+++ clfs/rc.d/init.d/functions	(revision 292c8323d9ad92439f1b20732aadbc20b191d8dd)
@@ -11,11 +11,11 @@
 check_status()
 {
-  local ERR=$?
-  echo -en "\\033[65G"
-  if [ $ERR = 0 ]; then
-    echo -en "\\033[1;32mOK"
-  else
-    echo -en "\\033[1;31mFAIL"
-  fi
-  echo -e "\\033[0;39m"
+	local ERR=$?
+	echo -en "\\033[65G"
+	if [ $ERR = 0 ]; then
+		echo -en "\\033[1;32mOK"
+	else
+		echo -en "\\033[1;31mFAIL"
+	fi
+	echo -e "\\033[0;39m"
 }
Index: clfs/rc.d/init.d/network
===================================================================
--- clfs/rc.d/init.d/network	(revision 5d96f6ac4b291f703f57141a9e6564d095e7d76e)
+++ clfs/rc.d/init.d/network	(revision 292c8323d9ad92439f1b20732aadbc20b191d8dd)
@@ -10,64 +10,72 @@
 
 if [ "$NETWORKING" != "yes" ]; then
-  echo "Networking is disabled in /etc/network.conf"
-  exit 0
+	echo "Networking is disabled in /etc/network.conf"
+	exit 0
 fi
 
 case "$1" in
 start)
-  for i in /etc/network.d/interface.*; do
-    if [ -r "$i" ]; then
-      . $i
-      if [ "$DHCP" = "yes" ]; then
-        echo -n "Starting DHCP for interface $INTERFACE: "
-        udhcpc -b -i "$INTERFACE" \
-          -p "/var/run/udhcpc.$INTERFACE.pid" \
-          > /dev/null
-      else
-        echo -n "Setting up interface $INTERFACE: "
-        ifconfig "$INTERFACE" "$IPADDRESS" \
-          netmask "$NETMASK" \
-          broadcast "$BROADCAST" up
-      fi
-        check_status
-    fi
-  done
+	for i in /etc/network.d/interface.*
+	do
+		if [ -r "$i" ]; then
+			. $i
+			if [ "$DHCP" = "yes" ]; then
+				echo -n "Starting DHCP for interface $INTERFACE: "
+				# udhcpc is braindead, bring up interface first
+				ifconfig "$INTERFACE" up
+
+				# Bridging code requires some time to wake up
+				[ "$INTERFACE" = "br0" ] && sleep 5
+
+				udhcpc -b -i "$INTERFACE" -s /etc/udhcpc.conf \
+					-p "/var/run/udhcpc.$INTERFACE.pid" \
+					> /dev/null
+			else
+				echo -n "Setting up interface $INTERFACE: "
+				ifconfig "$INTERFACE" "$IPADDRESS" \
+					netmask "$NETMASK" \
+					broadcast "$BROADCAST" up
+			fi
+			check_status
+	  	fi
+	done
 	
-  if [ "$USE_GATEWAY" = "yes" -a -n "$GATEWAY" ]; then
-    echo -n "Setting default route: "
-    route add default gw $GATEWAY
-    check_status
-  fi
-;;
+	if [ "$USE_GATEWAY" = "yes" -a -n "$GATEWAY" ]; then
+		echo -n "Setting default route: "
+		route add default gw $GATEWAY
+		check_status
+	fi
+	;;
 stop)
-  if [ "$USE_GATEWAY" = "yes" -a -n "$GATEWAY" ]; then
-    echo -n "Removing default route: "
-    route del -net 0.0.0.0
-    check_status
-  fi
+	if [ "$USE_GATEWAY" = "yes" -a -n "$GATEWAY" ]; then
+		echo -n "Removing default route: "
+		route del -net 0.0.0.0
+		check_status
+	fi
 
-  for i in /etc/network.d/interface.*; do
-    if [ -r "$i" ]; then
-    . $i
-    echo -n "Shutting down interface $INTERFACE: "
-    ifconfig $INTERFACE down
-    check_status
-    if [ "$DHCP" = "yes" ]; then
-      kill `cat "/var/run/udhcpc.$INTERFACE.pid"`
-      sleep 1
-    fi
-  fi
-  done
-;;
+	for i in /etc/network.d/interface.*
+	do
+		if [ -r "$i" ]; then
+			. $i
+			echo -n "Shutting down interface $INTERFACE: "
+			ifconfig $INTERFACE down
+			check_status
+			if [ "$DHCP" = "yes" ]; then
+				kill `cat "/var/run/udhcpc.$INTERFACE.pid"` 2>/dev/null || true
+				sleep 1
+			fi
+		fi
+	done
+	;;
 restart)
-  $0 stop
-  $0 start
-;;
+	$0 stop
+	$0 start
+	;;
 status)
-  ifconfig
-  route
-;;
+	ifconfig
+	route
+	;;
 *)
-  echo "Usage: $0 {start|stop|restart|status}"
-  exit 1
+	echo "Usage: $0 {start|stop|restart|status}"
+	exit 1
 esac
Index: clfs/rc.d/init.d/sshd
===================================================================
--- clfs/rc.d/init.d/sshd	(revision 5d96f6ac4b291f703f57141a9e6564d095e7d76e)
+++ clfs/rc.d/init.d/sshd	(revision 292c8323d9ad92439f1b20732aadbc20b191d8dd)
@@ -11,44 +11,44 @@
 case "$1" in
 start)
-  if [ ! -r "$DSSKEY" ]; then
-    echo -n "Generating DSS host key: "
-    dropbearkey -t dss -f "$DSSKEY" >/dev/null 2>&1
-    check_status
-  fi
-  if [ ! -r "$RSAKEY" ]; then
-    echo -n "Generating RSA host key: "
-    dropbearkey -t rsa -f "$RSAKEY" >/dev/null 2>&1
-    check_status
-  fi
-  if [ -r "$PIDFILE" ]; then
-    echo "Service dropbear already running."
-  else
-    echo -n "Starting dropbear SSH server: "
-    dropbear
-    check_status
-  fi
-;;
+	if [ ! -r "$DSSKEY" ]; then
+		echo -n "Generating DSS host key: "
+		dropbearkey -t dss -f "$DSSKEY" >/dev/null 2>&1
+		check_status
+	fi
+	if [ ! -r "$RSAKEY" ]; then
+		echo -n "Generating RSA host key: "
+		dropbearkey -t rsa -f "$RSAKEY" >/dev/null 2>&1
+		check_status
+	fi
+	if [ -r "$PIDFILE" ]; then
+		echo "Service dropbear already running."
+	else
+		echo -n "Starting SSH server: "
+		dropbear
+		check_status
+	fi
+	;;
 stop)
-  if [ -r "$PIDFILE" ]; then
-    echo -n "Stopping dropbear SSH server: "
-    kill `cat "$PIDFILE"`
-    check_status
-  else
-    echo "Service dropbear not running."
-  fi
-;;
+	if [ -r "$PIDFILE" ]; then
+		echo -n "Stopping dropbear SSH server: "
+		kill `cat "$PIDFILE"`
+		check_status
+	else
+		echo "Service dropbear not running."
+	fi
+	;;
 restart)
-  $0 stop
-  $0 start
-;;
+	$0 stop
+	$0 start
+	;;
 status)
-  if [ -r "$PIDFILE" ]; then
-    echo "Service dropbear running (PID $(cat "$PIDFILE"))."
-  else
-    echo "Service dropbear not running."
-  fi
-;;
+	if [ -r "$PIDFILE" ]; then
+		echo "Service dropbear running (PID $(cat "$PIDFILE"))."
+	else
+		echo "Service dropbear not running."
+	fi
+	;;
 *)
-  echo "Usage: $0 {start|stop|restart|status}"
-  exit 1
+	echo "Usage: $0 {start|stop|restart|status}"
+	exit 1
 esac
Index: clfs/rc.d/init.d/syslog
===================================================================
--- clfs/rc.d/init.d/syslog	(revision 5d96f6ac4b291f703f57141a9e6564d095e7d76e)
+++ clfs/rc.d/init.d/syslog	(revision 292c8323d9ad92439f1b20732aadbc20b191d8dd)
@@ -6,29 +6,29 @@
 . /etc/rc.d/init.d/functions
 
-SYSLOG_ROTATE_SIZE=80kb
+SYSLOG_ROTATE_SIZE=65536
 
 case "$1" in
 start)
-  echo -n "Starting syslogd: "
-  syslogd -m 0 -s $SYSLOG_ROTATE_SIZE -L
-  check_status
-  echo -n "Starting klogd: "
-  klogd
-  check_status
-;;
+	echo -n "Starting syslogd: "
+	syslogd -m 0 -s $SYSLOG_ROTATE_SIZE -L
+	check_status
+	echo -n "Starting klogd: "
+	klogd
+	check_status
+	;;
 stop)
-  echo -n "Stopping klogd: "
-  killall klogd
-  check_status
-  echo -n "Stopping syslogd: "
-  killall syslogd
-  check_status
-;;
+	echo -n "Stopping klogd: "
+	killall klogd
+	check_status
+	echo -n "Stopping syslogd: "
+	killall syslogd
+	check_status
+	;;
 restart)
-  $0 stop
-  $0 start
-;;
+	$0 stop
+	$0 start
+	;;
 *)
-  echo "Usage: $0 {start|stop|restart}"
-  exit 1
+	echo "Usage: $0 {start|stop|restart}"
+	exit 1
 esac
Index: clfs/rc.d/shutdown
===================================================================
--- clfs/rc.d/shutdown	(revision 5d96f6ac4b291f703f57141a9e6564d095e7d76e)
+++ clfs/rc.d/shutdown	(revision 292c8323d9ad92439f1b20732aadbc20b191d8dd)
@@ -10,19 +10,25 @@
 echo
 
+
 echo "Starting stop scripts."
 
-for i in /etc/rc.d/stop/*; do
-  if [ -x $i ]; then
-    $i stop
-  fi
+for i in /etc/rc.d/stop/*
+do
+	if [ -x $i ]; then
+		$i stop
+	fi
 done
 
-echo -n "Syncing hardware clock to system clock:"
-hwclock --systohc --utc
-check_status
+if [ -x /sbin/hwclock ] && [ -e /dev/rtc ]; then
+	echo -n "Syncing hardware clock to system clock:"
+	hwclock --systohc --utc
+	check_status
+fi
 
-echo -n "Disabling swap space: "
-swapoff -a
-check_status
+if [ -x /sbin/swapoff ]; then
+	echo -n "Disabling swap space: "
+	swapoff -a
+	check_status
+fi
 
 echo -n "Syncing all filesystems: "
@@ -32,2 +38,3 @@
 echo -n "Unmounting all filesystems: "
 umount -a -r
+
Index: clfs/rc.d/startup
===================================================================
--- clfs/rc.d/startup	(revision 5d96f6ac4b291f703f57141a9e6564d095e7d76e)
+++ clfs/rc.d/startup	(revision 292c8323d9ad92439f1b20732aadbc20b191d8dd)
@@ -7,32 +7,16 @@
 /bin/mount -t proc none /proc
 /bin/mount -t sysfs none /sys
+/bin/mount -t tmpfs /tmp /tmp
 /bin/mount -t tmpfs -o mode=0755 none /dev
 /bin/mkdir /dev/pts
 /bin/mkdir /dev/shm
+/bin/mount -t tmpfs -o mode=0755 /var /var
+for x in cache lib lib/misc lib/locate local lock log mail opt run spool; do mkdir /var/$x; done
+ln -s ../tmp /var/tmp
+
 /bin/echo "/sbin/mdev" > /proc/sys/kernel/hotplug
+
+echo -n "Starting mdev: "
 /sbin/mdev -s
-
-echo -n "Setting system clock: "
-hwclock --hctosys --utc
-check_status
-
-echo "Starting fsck for root filesystem."
-fsck -T -C /
-if [ "$?" -gt 2 ]; then
-  echo "WARNING: Errors found while checking root filesystem."
-  echo "You can login as root now, the system will reboot after logout."
-  sulogin
-  reboot
-elif [ "$?" = "2" ]; then
-  echo "NOTICE: System needs to be rebooted now."
-  sleep 1
-  reboot
-else
-  echo -n "Checking root filesystem: "
-  check_status
-fi
-
-echo -n "Remounting root rw: "
-mount -o remount,rw /
 check_status
 
@@ -41,22 +25,37 @@
 check_status
 
-echo "Starting fsck for local filesystems."
-fsck -A -C -R -T -t nonfs,nosmbfs
-if [ "$?" -gt 2 ]; then
-  echo "WARNING: Errors found while checking filesystems."
-  echo "You can login as root now, the system will reboot after logout."
-  sulogin
-  reboot
-elif [ "$?" = "2" ]; then
-  echo "NOTICE: System needs to be rebooted now."
-  sleep 1
-  reboot
-else
-  echo -n "Checking local filesystems: "
-  check_status
+if [ -x /sbin/hwclock ] && [ -e /dev/rtc ]; then
+	echo -n "Setting system clock: "
+	hwclock --hctosys --utc
+	check_status
 fi
 
-echo -n "Enabling swap space: "
-swapon -a
+if [ -x /sbin/fsck ]; then
+	echo "Starting fsck for local filesystems."
+	fsck -A -C -R -T -t nonfs,nosmbfs
+	if [ "$?" -gt 2 ]; then
+		echo "WARNING: Errors found while checking filesystems."
+		echo "You can login as root now, the system will reboot after logout."
+		sulogin
+		reboot
+	elif [ "$?" = "2" ]; then
+		echo "NOTICE: System needs to be rebooted now."
+		sleep 1
+		reboot
+	else
+		echo -n "Checking local filesystems: "
+		check_status
+	fi
+fi
+
+
+if [ -x /sbin/swapon ]; then
+	echo -n "Enabling swap space: "
+	swapon -a
+	check_status
+fi
+
+echo -n "Remounting root rw: "
+mount -o remount,rw /
 check_status
 
@@ -82,7 +81,10 @@
 echo "Running start scripts."
 
-for i in /etc/rc.d/start/*; do
-  if [ -x $i ]; then
-    $i start
-  fi
+for i in /etc/rc.d/start/*
+do
+	if [ -x $i ]; then
+		$i start
+	fi
 done
+
+exit 0
