Just for fun I added an R to the ls:
and provided both contents of rc and rc.factory
N4100Plus:~# ls -laR /img/factory
/img/factory:
drwxr-xr-x 3 root root 1024 Apr 11 2007 ./
drwxr-xr-x 7 root root 1024 Nov 24 18:16 ../
-rw-r--r-- 1 root root 5096 Feb 15 2007 act.html
-rw-r--r-- 1 root root 2044 Feb 9 2007 fsck.htm
-rw-r--r-- 1 root root 3718 Feb 9 2007 fsck_.htm
-rw-r--r-- 1 root root 2045 Feb 9 2007 index.html
-rw-r--r-- 1 root root 2082 Feb 9 2007 index_.htm
drwxr-xr-x 2 root root 1024 Apr 11 2007 lang/
-rw-r--r-- 1 root root 6505 Feb 9 2007 rmraid.html
/img/factory/lang:
drwxr-xr-x 2 root root 1024 Apr 11 2007 ./
drwxr-xr-x 3 root root 1024 Apr 11 2007 ../
-rw-r--r-- 1 root root 2338 Feb 9 2007 en
******RC*****:
#!/bin/sh
/bin/rm -rf /etc
/bin/ln -s /app/etc /etc
modprobe thecus_io
modprobe r8169
modprobe sata_sil
echo "Buzzer 1" > /proc/thecus_io
echo "Freq 1 3" > /proc/thecus_io
echo "Freq 2 1" > /proc/thecus_io
echo "Busy 2" > /proc/thecus_io
echo "Init completed!"
/sbin/hwclock -s
HW_STATUS=`/opt/bin/redboot_config get /dev/mtdblock4 hw_status`
if [ "$HW_STATUS" = "1" ]; then
/app/cfg/rc.factory
exit 0
fi
/app/bin/btn_dispatcher > /dev/null 2>&1 &
if [ -f "/app/conf.tar.gz" ]; then
if [ -f "/app/factory_default.md5" ]; then
/usr/bin/md5sum -c /app/factory_default.md5
if [ $? -eq 0 ]; then
tar xzf /app/conf.tar.gz -C /
fi
rm -f /app/factory_default.md5
else
tar xzf /app/conf.tar.gz -C /
fi
rm -f /app/conf.tar.gz
if [ -f /raid/sys/smb.conf ]; then
cp /etc/samba/smb.conf.default /raid/sys/smb.conf.tmp
echo -n -e "\n" >> /raid/sys/smb.conf.tmp
cat /raid/sys/smb.conf | sed '/\[global\]/,/^$/d' >> /raid/sys/smb.conf.tmp
cp /raid/sys/smb.conf.tmp /raid/sys/smb.conf
rm /raid/sys/smb.conf.tmp
fi
fi
/bin/hostname `cat /etc/HOSTNAME |cut -d . -f1`
##
MAC=$(ifconfig eth0 | grep HWaddr | sed -e 's/^.*HWaddr //' | cut -d" " -f1)
echo $MAC > /img/mac
/app/cfg/cfg_nic0
NAT=`/opt/bin/sqlite /app/cfg/conf.db "select v from conf where k='nic1_nat'"`
if [ "$NAT" = "1" ];then
echo 1 > /proc/sys/net/ipv4/ip_forward
modprobe ipt_MASQUERADE
modprobe iptable_nat
modprobe nf_nat_ftp
modprobe nf_nat_h323
modprobe nf_nat_pptp
/opt/bin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
/opt/bin/iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
fi
is_reset=`/opt/bin/redboot_config get /dev/mtdblock4 reset_default`
if [ "$is_reset" = "Reset_1" ]; then
ifconfig eth0 192.168.1.100 netmask 255.255.255.0 broadcast +
/app/bin/raid_start FACTORY
/app/bin/raid_m >/dev/null 2>&1 &
/app/bin/mkswap.sh start
echo "<?header('Location: /factory/index.html');?>" > /img/htdocs/index.html
ln -fs /img/factory /img/htdocs/factory
/usr/bin/awk '{if ($1=="Listen")print $1 " 0.0.0.0:80";else print $0}' /etc/httpd/conf/httpd.conf > /tmp/http.conf
/opt/apache/bin/apachectl -f /tmp/http.conf -k start
echo "Buzzer 0" > /proc/thecus_io
sleep 1
echo "Buzzer 1" > /proc/thecus_io
echo "Busy 0" > /proc/thecus_io
exit
fi
MAC2=$(ifconfig eth1 | grep HWaddr | sed -e 's/^.*HWaddr //' | cut -d" " -f1)
echo $MAC2 > /img/mac2
/app/cfg/cfg_nic1
##
/app/bin/raid_start
/app/bin/raid_m >/dev/null 2>&1 &
##
#mknod /var/tmp/monitor_pipe p
/img/bin/udpr &
#/img/bin/monitor &
#/app/bin/rc/rc.cupsd
/opt/apache/bin/apachectl startssl
(/app/bin/rc/rc.upnpd start)&
(sleep 1; modprobe usbcore; modprobe ehci-hcd; modprobe uhci-hcd; modprobe usb-storage; modprobe usblp;/app/bin/cfg_wlan0;/app/bin/ntp_cfg ;/opt/samba/sbin/smbd; /opt/samba/sbin/nmbd; /app/bin/cfg_winad; /app/bin/rc/rc.ftpd boot; /app/bin/rc/rc.udhcpd_eth1 boot; /app/bin/rc/rc.nsyncd boot; /app/bin/rc/rc.atalk boot; touch /tmp/boot_ok1)&
/usr/sbin/crond -L /dev/null
/usr/bin/crontab /app/cfg/crond.conf -u root
SPIN_DOWN=`/opt/bin/sqlite /app/cfg/conf.db "select v from conf where k='disks_spin_down'"`
/usr/sbin/hdparm -S $SPIN_DOWN /dev/sda
/usr/sbin/hdparm -S $SPIN_DOWN /dev/sdb
/usr/sbin/hdparm -S $SPIN_DOWN /dev/sdc
/usr/sbin/hdparm -S $SPIN_DOWN /dev/sdd
/app/bin/mkswap.sh start &
/img/bin/logevent/event 102 &
/img/bin/logevent/scanad
/opt/bin/ifplugd -fwI -u0 -d1 -p -i eth0
/opt/bin/ifplugd -fwI -u0 -d1 -p -i eth1
/img/bin/nsync_qos.sh boot
rm -rf /raid/sys/ftp.pid/*
/img/bin/chk_power.sh &
Time=`date "+%R %Y:%m:%d"`
if [ `cat /proc/driver/rtc | awk -F: '/alrm_pending/{print $2 }'` = 'yes' ];then
/img/bin/logevent/event 140 "$Time"
/img/bin/logevent/event 217 "$Time"
fi
/app/bin/module_boot.sh
/img/bin/boot_ok &
*****RC.FACTORY******
#!/bin/sh
echo "Factory mode"
/bin/rm -rf /raid/usbhdd/*
modprobe usbcore
modprobe ehci-hcd
modprobe uhci-hcd
modprobe usb-storage
mount /dev/sda1 /opt/bin/factory
if [ $? = 0 ] && [ -f /opt/bin/factory/rc.factory ]; then
/opt/bin/factory/rc.factory
exit 0
else
umount /dev/sda1 > /dev/null 2>&1
fi
if [ -f "/app/conf.tar.gz" ]; then
tar xzf /app/conf.tar.gz -C /
rm -f /app/conf.tar.gz
fi
is_reset=`/opt/bin/redboot_config get /dev/mtdblock4 reset_default`
if [ "$is_reset" = "Reset_1" ]; then
/app/bin/btn_reset
fi
##
MAC=$(ifconfig eth0 | grep HWaddr | sed -e 's/^.*HWaddr //' | cut -d" " -f1)
echo $MAC > /img/mac
ifconfig eth0 192.168.1.100 netmask 255.255.255.0 broadcast +
#echo 1 > /proc/sys/net/ipv4/ip_forward
#/opt/bin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
MAC2=$(ifconfig eth1 | grep HWaddr | sed -e 's/^.*HWaddr //' | cut -d" " -f1)
echo $MAC2 > /img/mac2
ifconfig eth1 192.168.2.100 netmask 255.255.255.0 broadcast +
sleep 3
##
/opt/apache/bin/apachectl startssl
#
echo "Busy 0" > /proc/thecus_io
echo "Freq 1 3" > /proc/thecus_io
echo "Freq 2 1" > /proc/thecus_io
echo "Busy 2" > /proc/thecus_io
echo "S_LED 1 2" > /proc/thecus_io
echo "S_LED 2 2" > /proc/thecus_io
echo "S_LED 3 2" > /proc/thecus_io
echo "S_LED 4 2" > /proc/thecus_io
echo "Busy 1" > /proc/thecus_io
echo "Fail 1" > /proc/thecus_io
# cp set mac ui
echo "cp set mac ui"
tar -xzf /opt/bin/factory/work.tar.gz -C /img/htdocs
DISKS=`cat /proc/partitions | grep -e "sd[a-d]$" | wc -l`
if [ "$MAC" = "00:50:
:30:FF:B2" ]; then
/opt/bin/factory/btn.sh &
else
/app/bin/btn_dispatcher > /dev/null 2>&1 &
if [ $DISKS -eq 4 ]; then
echo "RAID full loading "
/opt/bin/factory/raid.sh &
else
noreply=`/usr/bin/arping -c 1 -w 1 -D -I eth0 192.168.2.100 | grep "Received 0 reply" | wc -l`
if [ $noreply -eq 0 ]; then
echo "NIC full loading"
/opt/bin/factory/ether-wake -b -l 0 -i eth0 $MAC2 &
/opt/bin/factory/ether-wake -b -l 0 -i eth1 $MAC &
else
echo "Reboot testing"
/opt/bin/factory/rb.sh &
fi
fi
fi