####################################
### The #Homicide Efnet Trivia Bot #
####################### Ophmisu ####
############# by WSergio ###########

scup="scup"
user=nobody
pass=nopass
host=localhost
dir=/public_html
ncftpput="tools/ncftpput"
if [ $1 ]; then user=$1; fi
if [ $2 ]; then pass=$2; fi
if [ $3 ]; then host=$3; fi
if [ $4 ]; then dir=$4; fi
if [ $5 ]; then
	cd ophmisu
fi
/bin/rm -rf $scup


echo "ncftpput=tools/ncftpput" >> $scup
echo "bk=tools/backup" >> $scup
echo "cd `pwd`" >> $scup
echo "user=$user" >> $scup
echo "pass=$pass" >> $scup
echo "host=$host" >> $scup
echo "dir=$dir" >> $scup
echo "sh $bk" >> $scup
echo "if [ -f index.html ]; then ./$ncftpput -u $user -p $pass $host $dir index.html; fi" >> $scup
echo "if [ -f .backups/lastbackup.tgz ]; then ./$ncftpput -u $user -p $pass $host $dir lastbackup.tgz; fi" >> $scup
echo 'if [ -f homicide.jpg ]; then ./$ncftpput -u $user -p $pass $host $dir homicide.jpg; fi' >> $scup
echo 'if [ -f greseli.txt ]; then ./$ncftpput -u $user -p $pass $host $dir greseli.txt; fi' >> $scup

/bin/chmod +x $scup
echo "[X] Generated cronfile for trivia web scores auto-update into $scup"
if [ $5 ]; then cd ../..; fi
