#!/bin/sh


#################################
# Modifying /etc/init.d/syslogd
#################################
#echo -n "Modifying /etc/init.d/syslogd ... "
#cat $DEST/etc/init.d/sysklogd | \
#sed -e 's/^SYSLOGD=\"\"/SYSLOGD\=\"\-p \/rw\/dev\/log \-m 0\"/' \
#>  $DEST/etc/init.d/sysklogd.tmp
#mv  $DEST/etc/init.d/sysklogd.tmp  $DEST/etc/init.d/sysklogd
#chmod +x $DEST/etc/init.d/sysklogd
#echo "Done"

#################################
# Modifying /etc/mtab
#################################
echo -n "Modifying /etc/mtab ... "
rm -f /etc/mtab
ln -s /proc/mounts /etc/mtab
echo "Done"

#################################
# Modifying /etc/network/options
#################################
#echo -n "Modifying /etc/network/options ... "
#touch /etc/network/options 
#echo ip_forward=yes >> /etc/network/options 
#echo spoofprotect=yes >> /etc/network/options 
#echo syncookies=no >> /etc/network/options 
##sed -i -e "s/ip_forward=no/ip_forward=yes/" /etc/network/options 
#echo "Done"

#################################
# Modifying /etc/dnsmasq.conf
#################################
echo -n "Modifying /etc/dnsmasq.conf ... "
DNSMASQ_CONF=/etc/dnsmasq.conf 
DNSMASQ_MORE_CONF=/etc/dnsmasq.more.conf
if [ -f $DNSMASQ_CONF ] ; then
	echo "conf-file=$DNSMASQ_MORE_CONF" >> $DNSMASQ_CONF
fi	
#echo "dhcp-leasefile=/var/tmp/dnsmasq.leases" >> $DNSMASQ_MORE_CONF
#echo "dhcp-range=wlan0,10.1.10.10,10.1.10.250,24h" >> $DNSMASQ_MORE_CONF
#echo "dhcp-range=eth1,10.1.20.10,10.1.20.250,24h" >> $DNSMASQ_MORE_CONF
#echo "dhcp-range=eth2,10.1.30.10,10.1.30.250,24h" >> $DNSMASQ_MORE_CONF
#echo "dhcp-range=eth3,10.1.40.10,10.1.40.250,24h" >> $DNSMASQ_MORE_CONF
#echo "Done"
	
#################################
# Adding configuration for watchdog
#################################
echo -n "Adding configuration for watchdog ... "
WATCHDOG_CONF=/etc/watchdog.conf
if [ -f $WATCHDOG_CONF ] ; then
	echo "watchdog-device = /dev/watchdog" >> $WATCHDOG_CONF
	echo "interval	    = 15" >> $WATCHDOG_CONF
	mknod -m 600 /dev/wd c 10 130
fi;
echo "Done"

#################################
# Modifying /etc/init.d/mountall.sh
#################################
echo -n "Modifying /etc/init.d/mountall.sh ... "
echo "tar -C /ro -cf - . | tar -C /rw -xf -  > /dev/null 2>&1" >> /etc/init.d/mountall.sh
echo "Done"

#################################
# Modifying /etc/modules
#################################
echo -n "Modifying /etc/modules ... "
echo "natsemi" >> /etc/modules
echo "hostap_pci" >> /etc/modules
echo "options ath_pci autocreate=none" >> /etc/modprobe.d/madwifi
echo "Done"	
echo "Done"

#################################
# Modifying /etc/sysctl.conf
#################################
echo -n "Modifying /etc/sysctl.conf ... "
echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
echo "net.ipv4.conf.default.rp_filter=1" >> /etc/sysctl.conf
echo "net.ipv4.conf.all.rp_filter=1" >> /etc/sysctl.conf
echo "net.ipv4.tcp_syncookies=0" >> /etc/sysctl.conf
echo "kernel.panic=30" >> /etc/sysctl.conf
echo "Done"

#################################
# Modifying /root/.bashrc
#################################
echo -n "Modifying /root/.bashrc ... "
echo ". /etc/bash_completion" >> /ro/root/.bashrc
echo "Done"
