mkdir /jffs/opt
mount -o bind /jffs/opt /opt
wget http://www.3iii.dk/linux/optware/optware-install-ddwrt.sh -O - | tr -d "\r" > /tmp/optware-install.sh
sh /tmp/optware-install.sh
ipkg-opt install samba36 && ipkg-opt install samba36-swat && ipkg-opt install xinetd && ipkg-opt install nano && ipkg-opt install mc && ipkg-opt install bash && ipkg-opt install lighttpd && ipkg-opt install php-fcgi && ipkg-opt install perl && ipkg-opt install elinks && ipkg-opt install openvpn && ipkg-opt install busybox && ipkg-opt install microperl && ipkg-opt install eaccelerator && ipkg-opt install php-curl
nvram set http_lanport=8181
nvram commit
reboot
mkdir /jffs/etc
mkdir /jffs/etc/config
nano /jffs/etc/config/optware.startup
#!/bin/sh mount -o bind /jffs/opt /opt mount -o bind /jffs/ftp /mmc gpio enable 5 /opt/bin/busybox swapon /dev/scsi/host0/bus0/target0/lun0/part1 unset LD_LIBRARY_PATH unset LD_PRELOAD [ -e /opt/etc/profile ] && mount -o bind /opt/etc/profile /etc/profile if [ -d /opt/etc/init.d ]; then for f in /opt/etc/init.d/S* ; do [ -x $f ] && $f start done fi
chmod +x /jffs/etc/config/optware.startup
nano /opt/etc/profile
export PATH=/opt/bin:/opt/sbin:/bin:/sbin:/usr/bin:/usr/sbin
export SHELL="/opt/bin/bash"
export TERMINFO="/opt/share/terminfo"
export TERM="xterm"
nano /opt/etc/xinetd.d/swatservice swat
{
port = 901
socket_type = stream
wait = no
only_from = localhost 192.168.1.0/24
user = root
server = /opt/sbin/swat
log_on_failure += USERID
disable = No
}
nano /opt/etc/samba/smb.conf[global]
netbios name = HOME
interfaces = 192.168.1.1/24
bind interfaces only = Yes
security = SHARE
guest account = root
log level = 1
max log size = 100
dns proxy = No
guest only = Yes
guest ok = Yes
[root$]
path = /
read only = No
[WWW$]
path = /jffs/opt/share/www/
read only = No
[share]
path = /jffs/share
read only = No
Firewalliptables -I INPUT -p tcp --dport 80 -j ACCEPT
iptables -I INPUT -p tcp --dport 8181 -j ACCEPT
iptables -I INPUT -p tcp --dport 901 -j ACCEPT
iptables -I INPUT -p tcp --dport 65534 -j ACCEPT
iptables -I INPUT -p udp --dport 65534 -j ACCEPT
iptables -I INPUT -p tcp --dport 51413 -j ACCEPT
iptables -I INPUT -p tcp --dport 9091 -j ACCEPT
iptables -I INPUT -p tcp --dport 443 -j ACCEPT
iptables -I FORWARD -i br0 -o tun0 -j ACCEPT
iptables -I FORWARD -i tun0 -o br0 -j ACCEPT
iptables -I FORWARD -i ppp0 -o tun0 -j ACCEPT
iptables -I FORWARD -i tun0 -o ppp0 -j ACCEPT
iptables -A FORWARD -i tun0 -j ACCEPT
iptables -I INPUT -i tun0 -j ACCEPT
Shutdowngpio disable 5
sleep 10
Startgpio="gpio"
led=4
delay=2
full=100
high=70
med=40
while sleep $delay
do
set -- $(cat /proc/loadavg)
load="${1%.*}${1#*.}"
if [ $load -gt $full ]
then
flash=4
led=3
elif [ $load -gt $high ]
then
flash=3
led=4
elif [ $load -gt $med ]
then
flash=2
led=4
else
flash=1
led=4
fi
cur=1
while [ $cur -le $flash ]
do
$gpio disable $led
usleep 25000
$gpio enable $led
usleep 80000
cur=`expr $cur + 1`
done
done
openvpn
cgi scrips
proxy
lighttpd