sollie
04-11-2007, 21:53
#!/bin/sh
pool=`nvram get apps_pool`
share=`nvram get apps_share`
internal_hdd=/dev/ide/host2/bus0/target0/lun0/disc
if [ \! -f /tmp/rc.local.done ]; then
# Indicate we've already done this
touch /tmp/rc.local.done
#
# Mount /opt and connect in various system files
#
if [ -e /shares/${pool}/opt ]; then
mount -o bind /shares/${pool}/opt /opt
cat /proc/mounts > /opt/etc/fstab
ln -s /opt/etc/shells /tmp/shells
ln -s /opt/etc/fstab /tmp/fstab
export PATH=/opt/bin:/opt/sbin:${PATH}
export LD_LIBRARY_PATH=/opt/lib:/shares/lib:${LD_LIBRARY_PATH}
PATH_SEPARATOR=:
CONFIG_SHELL=/opt/bin/bash
AWK=/opt/bin/gawk
# Sleep for a little bit to not interfere with normal system startup
# before we kill a bunch of Asus processes.
sleep 5
# The killing of watchdog is necessary
# to allow the disk to spin down (watchdog is a horribly written hack
# anyway!)
killall -q -9 watchdog
# Stop vsftpd
killall vsftpd
# Do the necessary steps so the internal HDD will spin down
mount -o remount,noatime,nodiratime /shares/${pool}
hdparm -S 60 ${internal_hdd}
smartctl -dT ${internal_hdd}
# Copy passwd to /tmp
cp /shares/MYVOLUME1/passwd /tmp
# Chmod 777 Complete folder
chmod 777 -R /shares/MYVOLUME1/MYSHARE1/Download/Complete
# Set hostname
# hostname Meterkast
# Set time(zone)
export TZ=CET-1CEST-2,M3.5.0/02:00:00,M10.5.0/03:00:00
# Start utelnetd on local interface only!
# /apps/bin/utelnetd -i br0 &
Start dropbear ssh server
if [ -x /opt/etc/init.d/S51dropbear ]; then
/opt/etc/init.d/S51dropbear
fi
fi
# Start firefly
if [ -x /opt/sbin/mt-daapd ]; then
/opt/sbin/mt-daapd -c /opt/etc/mt-daapd/mt-daapd.conf
fi
fi
# Start ushare mediaserver
# /opt/etc/init.d/S99ushare start
# Start TwonkyVision
/opt/etc/init.d/S99twonkyvision
# Start lighttpd (8082)
# /opt/etc/init.d/S80lighttpd start
# Start MLDonkey
/opt/etc/init.d/mlnet
# Start appWeb (8082)
# /opt/etc/init.d/S81appweb
# Start vsftpd
/sbin/vsftpd /opt/etc/vsftpd.conf &
# Opening ports for Enhanced-Ctorrent
# iptables -I INPUT 7 -p tcp --dport 2700:2706 -j ACCEPT
# Opening port for SSH
# iptables -I INPUT 7 -p tcp --dport 22 -j ACCEPT
# Opening port for Firefly
iptables -I INPUT 7 -p tcp --dport 8083 -j ACCEPT
# Opening port for FreeNX
iptables -I INPUT 7 -p tcp --dport 877 -j ACCEPT
# Opening port for FTP
iptables -I INPUT 7 -p tcp --dport 20:21 -j ACCEPT
# Opening port for vsftpd
iptables -I INPUT 7 -p tcp --dport 65000:65535 -j ACCEPT
# Opening port for MLDonkey
# Gui
iptables -I INPUT 7 -p tcp --dport 4001 -j ACCEPT
iptables -I INPUT 7 -p tcp --dport 8082 -j ACCEPT
# BitTorrent
iptables -I INPUT 7 -p tcp --dport 6881:6889 -j ACCEPT
iptables -I INPUT 7 -p tcp --dport 6882 -j ACCEPT
# eDonkey (chat)
iptables -I INPUT 7 -p udp --dport 4665 -j ACCEPT
# eDonkey
iptables -I INPUT 7 -p tcp --dport 2278 -j ACCEPT
iptables -I INPUT 7 -p udp --dport 2282 -j ACCEPT
# Fasttrack
iptables -I INPUT 7 -p tcp --dport 1214 -j ACCEPT
# OpenNAP
iptables -I INPUT 7 -p tcp --dport 6699 -j ACCEPT
# Gnutella
iptables -I INPUT 7 -p tcp --dport 6346 -j ACCEPT
# Fix the gpio driver
echo "interrupt=no" > /proc/miscio/power_enable_config
fi
pool=`nvram get apps_pool`
share=`nvram get apps_share`
internal_hdd=/dev/ide/host2/bus0/target0/lun0/disc
if [ \! -f /tmp/rc.local.done ]; then
# Indicate we've already done this
touch /tmp/rc.local.done
#
# Mount /opt and connect in various system files
#
if [ -e /shares/${pool}/opt ]; then
mount -o bind /shares/${pool}/opt /opt
cat /proc/mounts > /opt/etc/fstab
ln -s /opt/etc/shells /tmp/shells
ln -s /opt/etc/fstab /tmp/fstab
export PATH=/opt/bin:/opt/sbin:${PATH}
export LD_LIBRARY_PATH=/opt/lib:/shares/lib:${LD_LIBRARY_PATH}
PATH_SEPARATOR=:
CONFIG_SHELL=/opt/bin/bash
AWK=/opt/bin/gawk
# Sleep for a little bit to not interfere with normal system startup
# before we kill a bunch of Asus processes.
sleep 5
# The killing of watchdog is necessary
# to allow the disk to spin down (watchdog is a horribly written hack
# anyway!)
killall -q -9 watchdog
# Stop vsftpd
killall vsftpd
# Do the necessary steps so the internal HDD will spin down
mount -o remount,noatime,nodiratime /shares/${pool}
hdparm -S 60 ${internal_hdd}
smartctl -dT ${internal_hdd}
# Copy passwd to /tmp
cp /shares/MYVOLUME1/passwd /tmp
# Chmod 777 Complete folder
chmod 777 -R /shares/MYVOLUME1/MYSHARE1/Download/Complete
# Set hostname
# hostname Meterkast
# Set time(zone)
export TZ=CET-1CEST-2,M3.5.0/02:00:00,M10.5.0/03:00:00
# Start utelnetd on local interface only!
# /apps/bin/utelnetd -i br0 &
Start dropbear ssh server
if [ -x /opt/etc/init.d/S51dropbear ]; then
/opt/etc/init.d/S51dropbear
fi
fi
# Start firefly
if [ -x /opt/sbin/mt-daapd ]; then
/opt/sbin/mt-daapd -c /opt/etc/mt-daapd/mt-daapd.conf
fi
fi
# Start ushare mediaserver
# /opt/etc/init.d/S99ushare start
# Start TwonkyVision
/opt/etc/init.d/S99twonkyvision
# Start lighttpd (8082)
# /opt/etc/init.d/S80lighttpd start
# Start MLDonkey
/opt/etc/init.d/mlnet
# Start appWeb (8082)
# /opt/etc/init.d/S81appweb
# Start vsftpd
/sbin/vsftpd /opt/etc/vsftpd.conf &
# Opening ports for Enhanced-Ctorrent
# iptables -I INPUT 7 -p tcp --dport 2700:2706 -j ACCEPT
# Opening port for SSH
# iptables -I INPUT 7 -p tcp --dport 22 -j ACCEPT
# Opening port for Firefly
iptables -I INPUT 7 -p tcp --dport 8083 -j ACCEPT
# Opening port for FreeNX
iptables -I INPUT 7 -p tcp --dport 877 -j ACCEPT
# Opening port for FTP
iptables -I INPUT 7 -p tcp --dport 20:21 -j ACCEPT
# Opening port for vsftpd
iptables -I INPUT 7 -p tcp --dport 65000:65535 -j ACCEPT
# Opening port for MLDonkey
# Gui
iptables -I INPUT 7 -p tcp --dport 4001 -j ACCEPT
iptables -I INPUT 7 -p tcp --dport 8082 -j ACCEPT
# BitTorrent
iptables -I INPUT 7 -p tcp --dport 6881:6889 -j ACCEPT
iptables -I INPUT 7 -p tcp --dport 6882 -j ACCEPT
# eDonkey (chat)
iptables -I INPUT 7 -p udp --dport 4665 -j ACCEPT
# eDonkey
iptables -I INPUT 7 -p tcp --dport 2278 -j ACCEPT
iptables -I INPUT 7 -p udp --dport 2282 -j ACCEPT
# Fasttrack
iptables -I INPUT 7 -p tcp --dport 1214 -j ACCEPT
# OpenNAP
iptables -I INPUT 7 -p tcp --dport 6699 -j ACCEPT
# Gnutella
iptables -I INPUT 7 -p tcp --dport 6346 -j ACCEPT
# Fix the gpio driver
echo "interrupt=no" > /proc/miscio/power_enable_config
fi