New version - but all I added to this one was a short intro kinda thing using some of the stuff from jbsnakes rat project (note: some of it).
It's a long script now so it may take a bit of reading...
run the script to see what the intro is...
Oh and before you say anything crouse - I am not advertising another forum, just putting their site in their as they are who it is made for.
Oh and if you want to use it, this script alone will not suffice - please download the script from
http://www.bashscripts.org/downloads/Sc ... eed.tar.gz
Code:
#!/bin/bash
###########################################
#This script was written by rob newland #
#and is free (as in speech) for all uses. #
#it may be modified or have anything done #
#to it as long as this notice remains. #
# Contact: robnewland@gmail.com #
# Or : Find me on USALUG.org :D under #
#the username crudball. #
#Also a thanks goes out to Dave Crouse #
#who is also known as crouse on usalug.org#
#and bashscripts.org for helping with some#
#code. #
###########################################
############# FUNCTIONS #############
delay1='sleep .08'
wipescreen='echo -ne \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b'
-nointro ()
{
Main_Menu
}
checkforroot ()
{
# Proceeds silently if running as root.
ROOT_UID=0
if [ "$UID" -ne "$ROOT_UID" ]
then
echo "********ERROR********"
echo "You must be logged in as root to run this script"
echo "Please log in as root and re-run this script."
echo "Aborting installation."
echo "********ERROR********"
exit
fi
}
function checkdeps ()
{
checkforroot
echo "Checking for bittorrent"
which launchmany-curses.py &>/dev/null
if [ $? != "0" ];
then
echo -e "ERROR: bittorrent is either not installed or the required scripts are not installed." ;
echo "";echo "Please choose menu option #2 Install Dependencies" ; echo ""
read -p "Hit Enter to continue" var
else
echo "Bittorrent is installed" ;
fi
echo ""
echo "Checking for cron"
if [[ -d /etc/cron.hourly ]]
then
echo "cron is installed" ;
else
echo "You do not have cron." ;
fi
echo ""
echo "checking for rsync"
which rsync &>/dev/null
if [ $? != "0" ];
then
echo -e "rsync is not installed. Run instdeps from the menu." ;
read -p "hit return to continue" var ;
else
echo "rsync is installed" ;
fi
sleep 5
}
function instdeps ()
{
checkforroot
echo checking for bittorrent
which launchmany-curses.py &>/dev/null
if [ $? != "0" ];
then
echo -e "bittorrent -- NOT INSTALLED";
cd /home/$USER ;
echo "Downloading bittorrent" ;
sleep 1 ;
wget http://download.bittorrent.com/dl/BitTorrent-4.4.0.tar.gz ;
tar -zxvf BitTorrent-4.4.0.tar.gz ;
cd BitTorrent-4.4.0 ;
echo "#!/bin/bash" >> /usr/bin/launchmany-curses.py ;
echo "cd /home/$USER/BitTorrent-4.4.0 && ./launchmany-curses.py --torrent_dir /home/$USER/torrents --save_in /home/$USER/data --max_upload_rate 200" >> /usr/bin/launchmany-curses.py ;
chmod 777 /usr/bin/launchmany-curses.py ;
echo ""
fi
echo "Bittorrent is installed"
echo ""
echo checking for cron
if [[ -d /etc/cron.hourly ]]
then
echo "cron is installed"
else
echo "You do not have crond. Please find a way to install it. "
fi
echo ""
echo checking for rsync...
which rsync &>/dev/null
if [ $? != "0" ];
then
echo "rsync -- NOT INSTALLED" ;
wget http://samba.anu.edu.au/ftp/rsync/rsync-2.6.7.tar.gz
tar -zxvf rsync-2.6.7.tar.gz
cd rsync*
/configure && make & make install
read -p "hit return to continue" var
echo ""
fi
echo "rsync is installed."
}
function installandcheck ()
{
checkforroot
echo "You need the following installed to run a seed server."
echo "1. bittorrent"
echo "2. cron"
echo "3. rsync "
echo ""
read -p "Press ENTER to start" enter
echo ""
echo "Checking for bittorrent"
which launchmany-curses.py &>/dev/null
if [ $? != "0" ];
then
echo -e "bittorrent -- NOT INSTALLED";
read -p "hit return to continue" var
exit;
fi
echo bittorrent is installed
echo ""
echo checking for cron
if [[ -d /etc/cron.hourly ]]
then
echo "cron is installed"
else
echo "You do not have cron. Installation will now quit"; sleep 3; exit 0
fi
echo ""
echo checking for rsync...
which rsync &>/dev/null
if [ $? != "0" ];
then
echo -e "rsync -- NOT INSTALLED";
read -p "Hit Enter to continue" var
exit;
fi
echo "rsync is installed."
echo ""
echo "Making directories."
mkdir /home/$USER/data
mkdir /home/$USER/torrents
read -p "How many torrents would you like to seed? - CHOOSE 5, 10, 15 or 20 : " torrents
cp $torrents /etc/cron.hourly/torrents
chmod 777 /etc/cron.hourly/torrents
cp torrentserver /usr/bin/torrentserver
chmod 777 /usr/bin/torrentserver
read -p "Press ENTER to run the server or type exit to quit" comm
$comm
cd /etc/cron.hourly/
./torrents
torrentserver
}
Main_Menu ()
{
mainmenu="\t1)\tCheck for installed programs\n\t2)\tInstall Dependencies\n\t3)\tSetup and run torrent server\n\t0)\tExit"
clear
echo " ---------- Seed Server Installation Program -----------";
echo "";
echo -e "$mainmenu"
echo "";
read -p "Please choose one of the options above : " option ;
while true
do
case $option in
1) checkdeps;
;;
2) instdeps;
;;
3) installandcheck;
;;
0) option="";
exit;
;;
*) echo "That choice was invalid!!";
;;
esac
clear
echo " ---------- Seed Server Installation Program -----------";
echo "";
echo -e "$mainmenu"
echo "";
read -p "Please choose one of the options above : " option ;
done
}
function G ()
{
echo -e " ________ "; $delay1;$wipescreen
echo -e " | ______|"; $delay1;$wipescreen
echo -e " | | ____"; $delay1;$wipescreen
echo -e " | ||__ |"; $delay1;$wipescreen
echo -e " | |___| |"; $delay1;$wipescreen
echo -e " |________|"; $delay1;$wipescreen
}
function dot
{
echo "" ;
echo " " ;
echo "/ \ " ;
echo "\_/ " ;
}
function C ()
{
echo -e " _______ "; $delay1;$wipescreen
echo -e " | _____|"; $delay1;$wipescreen
echo -e " | | "; $delay1;$wipescreen
echo -e " | |____ "; $delay1;$wipescreen
echo -e " |_______|"; $delay1;$wipescreen
}
function E ()
{
echo -e " _______"; $delay1;$wipescreen
echo -e " | _____|"; $delay1;$wipescreen
echo -e " | |____ "; $delay1;$wipescreen
echo -e " | ____|"; $delay1;$wipescreen
echo -e " | |____"; $delay1;$wipescreen
echo -e " |_______|"; $delay1;$wipescreen
}
function J ()
{
echo -e " ________"; $delay1;$wipescreen
echo -e " |___ ___|"; $delay1;$wipescreen
echo -e " | |"; $delay1;$wipescreen
echo -e " _ / /"; $delay1;$wipescreen
echo -e " |____/"; $delay1;$wipescreen
}
function O ()
{
echo -e " _______"; $delay1;$wipescreen
echo -e " / _ \ "; $delay1;$wipescreen
echo -e " | | | |"; $delay1;$wipescreen
echo -e " | |_| |"; $delay1;$wipescreen
echo -e " \_______/"; $delay1;$wipescreen
}
function R ()
{
echo -e " _____"; $delay1;$wipescreen
echo -e " | _ |"; $delay1;$wipescreen
echo -e " | |_| |"; $delay1;$wipescreen
echo -e " | \ \ "; $delay1;$wipescreen
echo -e " |__|\__\ "; $delay1;$wipescreen
}
function P ()
{
echo -e " ________"; $delay1;$wipescreen
echo -e " | ____ |"; $delay1;$wipescreen
echo -e " | |____| |"; $delay1;$wipescreen
echo -e " | ______|"; $delay1;$wipescreen
echo -e " |__|"; $delay1;$wipescreen
}
function dash ()
{
echo -e " "; $delay1;$wipescreen
echo -e " _________"; $delay1;$wipescreen
echo -e " |_________| "; $delay1;$wipescreen
echo -e " "; $delay1;$wipescreen
}
function M ()
{
echo -e " __ __"; $delay1;$wipescreen
echo -e " / \/ \ "; $delay1;$wipescreen
echo -e " / /\ /\ \ "; $delay1;$wipescreen
echo -e " /_/ \/ \_\ "; $delay1;$wipescreen
}
function L ()
{
echo -e " ___"; $delay1;$wipescreen
echo -e " | |"; $delay1;$wipescreen
echo -e " | |"; $delay1;$wipescreen
echo -e " | |___"; $delay1;$wipescreen
echo -e " |_______|"; $delay1;$wipescreen
}
function T ()
{
echo -e " ________"; $delay1;$wipescreen
echo -e " |___ ___|"; $delay1;$wipescreen
echo -e " | |"; $delay1;$wipescreen
echo -e " | |"; $delay1;$wipescreen
echo -e " |__|"; $delay1;$wipescreen
}
function intro ()
{
clear
T
clear
L
clear
M
clear
dash
clear
P
clear
R
clear
O
clear
J
clear
E
clear
C
clear
T
clear
dot
clear
O
clear
R
clear
G
clear
echo "To skip the intro next time - run $0 -nointro"
sleep 2
}
########## END OF FUNCTIONS #########
############## PROGRAM ##############
$1
intro
Main_Menu
exit
Phew....
