fdisk /dev/discs/disc0/disc
3particoes:
1 swap 2Gb
2 opt 2Gb
3 resto
reboot
insmod scsi_mod && insmod sd_mod && insmod usb-storage && sleep 5s
mkswap /dev/discs/disc0/part1
swapon /dev/discs/disc0/part1
mke2fs -j /dev/discs/disc0/part2
mount /dev/discs/disc0/part2 /opt
mke2fs -j /dev/discs/disc0/part3
#pacotes base
cd /opt/
mkdir /opt/tmp
mkdir /opt/tmp/ipkg
wget
http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/ipkg-opt_0.99.163-9_mipsel.ipk
ipkg.sh install ipkg-opt_0.99.163-9_mipsel.ipk
wget
http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/uclibc-opt_0.9.28-12_mipsel.ipk
ipkg.sh install uclibc-opt_0.9.28-12_mipsel.ipk
ipkg update
ipkg install nano
rm *.ipk
#dropbear(ssh)
mkdir -p /usr/local/etc/dropbear
dropbearkey -t dss -f /usr/local/etc/dropbear/dropbear_dss_host_key
dropbearkey -t rsa -f /usr/local/etc/dropbear/dropbear_rsa_host_key
mkdir -p /usr/local/sbin
nano /usr/local/sbin/post-boot
#inicio post-boot
#!/bin/sh
# Start SSH service
dropbear
# test if USB disc has been attached
# if not - then insert needed modules
if [ ! -d /dev/discs ]
then
insmod scsi_mod && insmod sd_mod && insmod usb-storage && sleep 5s
fi
# Wait for /opt to mount
mount /dev/discs/disc0/part2 /opt
mount /dev/discs/disc0/part3 /tmp/harddisk
i=0
while [ $i -le 30 ]
do
if [ -d /opt/etc ]
then
break
fi
sleep 1
i=`expr $i + 1`
done
# Activate swap
swapon /dev/discs/disc0/part1
#to let midnight commander run on terminals, make alias for colored mc
echo "export TERMINFO=/opt/share/terminfo">>/etc/profile
echo "alias mc=\"mc -c\"">>/etc/profile
# Run all active services - active means starts with S
/opt/etc/init.d/rc.unslung
#fim post-boot
nano /usr/local/sbin/post-firewall
#inicio post-firewall
#!/bin/sh
## FIREWALL
## set default policy
iptables -P INPUT DROP
## deny ftp access from WAN
iptables -I INPUT 1 -p tcp -i "$1" --syn --dport 21 -j DROP
## Allow access to various router services from WAN
## Ports 22 and 65534 are required by dropbear and transmission
for P in 65534 22; do
iptables -I INPUT 1 -p tcp --syn -i "$1" --dport $P -j ACCEPT
done
#fim post-firewall
touch /usr/local/sbin/post-mount
touch /usr/local/sbin/pre-shutdown
chmod +x /usr/local/sbin/*
flashfs save && flashfs commit && flashfs enable && reboot
mount
free
ipkg install mc
ipkg install xinetd
ipkg install samba2
mkdir /tmp/harddisk/share
chmod ugoa+w /tmp/harddisk/share
nano /opt/etc/init.d/rc.unslung
#inicio
# Start all init scripts in /opt/etc/init.d
# executing them in numerical order.
#
for i in /opt/etc/init.d/S??* ;do
# Ignore dangling symlinks (if any).
[ ! -f "$i" ] && continue
case "$i" in
*.sh)
# Source shell script for speed.
(
trap - INT QUIT TSTP
set start
. $i
)
;;
*)
# No sh extension, so fork subprocess.
$i start
;;
esac
done
#fim
nano /opt/etc/xinetd.d/swat #substituir Root pelo user do router
chmod +x /opt/etc/init.d/rc.unslung
/opt/etc/init.d/rc.unslung
testar "ip router":901
#criar 2 shares
- Share (pointing to /tmp/harddisk/share)
- Torrent (pointing to /tmp/harddisk/torrent)
#cron
ipkg install cron
mkdir /opt/etc/cron.5mins
mkdir /opt/etc/cron.hourly
mkdir /opt/etc/cron.daily
mkdir /opt/etc/cron.weekly
mkdir /opt/etc/cron.monthly
nano /opt/etc/crontab
#inicio
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/opt/bin:/opt/sbin:/opt/usr/bin:/opt/usr/sbin
MAILTO=""
HOME=/
# ---------- ---------- Default is Empty ---------- ---------- #
# Syntax for lines is : minute hour day month dayofweek command #
*/5 * * * * admin run-parts /opt/etc/cron.5mins
0 * * * * admin run-parts /opt/etc/cron.hourly
0 0 * * * admin run-parts /opt/etc/cron.daily
0 0 * * 0 admin run-parts /opt/etc/cron.weekly
0 0 1 * * admin run-parts /opt/etc/cron.monthly
#fim
#torrents
ipkg install ctorrent
ipkg install torrent
mkdir /opt/share/torrent
mkdir /opt/share/torrent/source
mkdir /opt/share/torrent/work
mkdir /opt/share/torrent/target
nano /usr/local/root/httpd.conf
#inicio
A:*
/cgi-bin:admin:admin
.au:audio/basic
.asp:text/html
#fim
nano /usr/local/sbin/post-mount
#inicio
#!/bin/sh
/usr/sbin/busybox_httpd -p 8008 -h /opt/share/www
#fim
nano /opt/etc/torrent.conf
#inicio
##########
# Configuration
# NOTE: no spaces around the = sign
# the config will be sourced (eg. . torrent.conf)
SOURCE=/opt/share/torrent/source
WORK=/opt/share/torrent/work
TARGET=/opt/share/torrent/target
MAILTO=
MAILFROM=
# default MAILER is mini_sendmail
#MAILOPT="-sblackhole.dyndns.org -f"
USER=admin
GROUP=root
DATE_FORMAT="%d %h %H:%M"
# btget port range environment
BTLIB_MINPORT=52846
export BTLIB_MINPORT
BTLIB_MAXPORT=52846
export BTLIB_MAXPORT
#time between logs
LOG_TIME=59
# Seed torrent after completition (YES or NO)
AUTOSEED="YES"
#Colors for command line. # comment out if not needed
GREEN="\033[32;1m"
#NC="\033[0m"
#BACK_UP="\033[1K\033[0G"
NORMAL="\033[0m"
WARN="\033[33;1m"
BAD="\033[31;1m"
BOLD="\033[1m"
GOOD="\033[32;1m"
#fim
flashfs save && flashfs commit && flashfs enable && reboot