! /bin/sh
#
# Based on RO File system
#
# Set the path
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:.
# Mount /proc
echo "Mount /proc fs"
mount -t proc none /proc
# Mount RW tmpfs, rely on /proc being mounted
echo "Restore RW directories"
/bin/bash /etc/mountvar.sh
# Mount /dev/pts
echo "Mount /dev/pts"
mount -t devpts none /dev/pts
# Setup up /etc/mtab link
ln -sf /proc/mounts /etc/mtab
# Mount mtd dir
if [ -f /etc/mountmtd.sh ]; then
echo "mount mtd dir"
/bin/bash /etc/mountmtd.sh
fi
# usb hotplug daemon
if [ -f /usr/sbin/usbhd-start ]; then
echo "usb hotplug daemon"
/usr/sbin/usbhd-start
fi
# Turn it on only when having a HD
###mount -a
# Now allow user interrupt
# stty brkint
# Clean up utmp/wtmp
echo "Cleaning up utmp and wtmp"
cat /dev/null > /var/run/utmp
cat /dev/null > /var/log/wtmp
chgrp utmp /var/run/utmp /var/log/wtmp
chmod 0664 /var/run/utmp /var/log/wtmp
# Start syslogd
#echo "Start syslog daemon"
#syslogd &
# Configure network interface
# echo "Configure Network interface"
# For bcm97110-docsis only
###insmod /lib/modules/`uname -r`/kernel/drivers/net/et.o
# sleep 6
#
#
# If we boot from NFS, then we don't need the Network, use whatever
# was set up by NFS,
# otherwise look at the kernel parameter netconf=<device>,<ipaddr:netmask>
#
# if [ -z "`cat /proc/mounts |grep /dev/root |grep '\<nfs\>'`" ]; then
# if [ -z "$netconf" ]; then
# ifconfig lo 127.0.0.1 netmask 255.0.0.0
# rm -f /etc/resolv.conf
#
# if [ -f /var/run/dhcpcd-eth0.pid ]; then
# rm -f /var/run/dhcpcd-eth0.pid
# fi
#
# # PR21492 - new dhcpcd use different dir to store *.pid
# if [ -f /etc/config/dhcpc/dhcpcd-eth0.pid ]; then
# rm -f /etc/config/dhcpc/dhcpcd-eth0.pid
# fi
#
# #jipeng - PR22427 dhcpcd failed with cramfs
# echo "dhcpcd -Hd -L /var/run eth0"
# dhcpcd -Hd -L /var/run eth0 &
# #echo "dhcpcd -Hd eth0"
# #dhcpcd -Hd eth0 &
# else
# netdev=`echo "$netconf" | cut -f1 -d','`
# ip=`echo "$netconf" | cut -f2 -d','`
#
# case "$ip" in
# none)
# echo "Network not started"
# ;;
# dhcp)
# ifconfig lo 127.0.0.1 netmask 255.0.0.0
# rm -f /etc/resolv.conf
# if [ -f /var/run/dhcpcd-${netdev}.pid ]; then
# rm -f /var/run/dhcpcd-${netdev}.pid
# fi
# # PR21492 - new dhcpcd use different dir to store *.pid
# if [ -f /etc/config/dhcpc/dhcpcd-${netdev}.pid ]; then
# rm -f /etc/config/dhcpc/dhcpcd-${netdev}.pid
# fi
# #jipeng - PR22427 dhcpcd failed with cramfs
# echo "dhcpcd -Hd -L /var/run eth0"
# dhcpcd -Hd -L /var/run eth0 &
# #echo "dhcpcd -Hd $netdev"
# #dhcpcd -Hd "$netdev" &
# ;;
#
# *) # If the user specifies the wrong syntax, there is nothing we can do
# ipaddr=`echo "$ip" | cut -f1 -d':'`
# netmask=`echo "$ip" | cut -f2 -d':'`
# echo "ifconfig $netdev $ipaddr netmask $netmask up"
# ifconfig "$netdev" "$ipaddr" netmask "$netmask" up
# ifconfig lo 127.0.0.1 netmask 255.0.0.0
# ;;
# esac
# fi
# fi
# Start up services
echo "start services"
portmap &
# PR17638: Use daemon option for utelnetd
utelnetd -d
#Start user service if it exists
if [ -f /root/rc.user ]; then
echo "start user services"
/bin/sh /root/rc.user
fi