Update:
[ipfire-2.x.git] / make.sh
diff --git a/make.sh b/make.sh
index 86c9dba..9fdf9fd 100644 (file)
--- a/make.sh
+++ b/make.sh
 
   NAME="IPFire"                        # Software name
   SNAME="ipfire"                       # Short name
-  VERSION="1.4"                        # Version number
-  SLOGAN="We secure your network"      # Software slogan
+  VERSION="2.0"                        # Version number
+  SLOGAN="www.ipfire.org"              # Software slogan
   CONFIG_ROOT=/var/ipfire              # Configuration rootdir
   NICE=10
   MAX_RETRIES=3                        # prefetch/check loop
   KVER=`grep --max-count=1 VER lfs/linux | awk '{ print $3 }'`
   MACHINE=`uname -m`
+  SVN_REVISION=`svn info | grep Revision | cut -c 11-`
 
   # Setzen des IPFire Builds
   if [ -e ./.svn ]; then
     FIREBUILD=`cat .svn/entries |sed -n 's/^[ \t]*revision=\"// p' | sed -n 's/\".*$// p'`
-#    VERSION="$VERSION (Build:$FIREBUILD)"
   fi
 
   # Debian specific settings
@@ -51,7 +51,6 @@
        fi
   fi
 
-
   PWD=`pwd`
   BASENAME=`basename $0`
   BASEDIR=`echo $FULLPATH | sed "s/\/$BASENAME//g"`
   DIR_CHK=$BASEDIR/cache/check
   mkdir $BASEDIR/log/ 2>/dev/null
 
-  if [ 'x86_64' = $MACHINE -o 'i686' = $MACHINE -o 'i586' = $MACHINE -o 'i486' = $MACHINE -o 'i386' = $MACHINE ]; then
+  if [ -f .config ]; then
+       . .config
+  fi
 
-       echo "`date -u '+%b %e %T'`: Machine is ix86 (or equivalent)" | tee -a $LOGFILE
+  if [ 'x86_64' = $MACHINE -o 'i686' = $MACHINE -o 'i586' = $MACHINE -o 'i486' = $MACHINE -o 'i386' = $MACHINE ]; then
+       echo "`date -u '+%b %e %T'`: Machine is ix86 (or equivalent)" >> $LOGFILE
        MACHINE=i386
        BUILDTARGET=i386-pc-linux-gnu
        CFLAGS="-O2 -mcpu=i386 -march=i386 -pipe -fomit-frame-pointer"
        CXXFLAGS="-O2 -mcpu=i386 -march=i386 -pipe -fomit-frame-pointer"
   elif [ 'alpha' = $MACHINE ]; then
-       echo "`date -u '+%b %e %T'`: Machine is Alpha AXP" | tee -a $LOGFILE
+       echo "`date -u '+%b %e %T'`: Machine is Alpha AXP" >> $LOGFILE
        BUILDTARGET=alpha-unknown-linux-gnu
        CFLAGS="-O2 -mcpu=ev4 -mieee -pipe"
        CXXFLAGS="-O2 -mcpu=ev4 -mieee -pipe"
   else
-       echo "`date -u '+%b %e %T'`: Can't determine your architecture - $MACHINE" | tee -a $LOGFILE
+       echo "`date -u '+%b %e %T'`: Can't determine your architecture - $MACHINE" >> $LOGFILE
        exit 1
   fi
 
@@ -551,6 +553,7 @@ buildipcop() {
        ipcopmake fcclassic     SMP=1
        ipcopmake pulsar        SMP=1
        ipcopmake unicorn       SMP=1
+       ipcopmake promise-sata-300-tx SMP=1
   fi
 
   ipcopmake linux      LFS_PASS=ipfire
@@ -571,8 +574,9 @@ buildipcop() {
        ipcopmake fcdslslusb 
        ipcopmake fcpci
        ipcopmake fcclassic
-       ipcopmake pulsar        
-       ipcopmake unicorn       
+       ipcopmake pulsar        
+       ipcopmake unicorn
+       ipcopmake promise-sata-300-tx
   fi
 
   ipcopmake pcmcia-cs
@@ -707,6 +711,7 @@ buildipcop() {
   ipcopmake bridge-utils
   ipcopmake screen
   ipcopmake hddtemp
+  ipcopmake smartmontools
   ipcopmake htop
   ipcopmake lynx
   echo -ne "`date -u '+%b %e %T'`: Building ### Mailserver ### \n" | tee -a $LOGFILE
@@ -728,11 +733,16 @@ buildipcop() {
   ipcopmake asterisk
   ipcopmake mpg123
   echo -ne "`date -u '+%b %e %T'`: Building ### MP3-Server ### \n" | tee -a $LOGFILE
+  ipcopmake libogg
+  ipcopmake libvorbis
   ipcopmake lame
+  ipcopmake sox
   ipcopmake gnump3d
   echo -ne "`date -u '+%b %e %T'`: Building ### P2P-Clients ### \n" | tee -a $LOGFILE
   ipcopmake applejuice
-  ipcopmake edonkeyclc
+  ipcopmake ocaml
+  ipcopmake mldonkey
+#  ipcopmake edonkeyclc
 #  ipcopmake sane
   echo -ne "`date -u '+%b %e %T'`: Building ### Net-Tools ### \n" | tee -a $LOGFILE
   ipcopmake ntop
@@ -741,11 +751,13 @@ buildipcop() {
   ipcopmake portmap
   ipcopmake nfs
   ipcopmake nmap
+  ipcopmake mbmon
   ipcopmake iftop
   ipcopmake ncftp
   ipcopmake cftp
   ipcopmake etherwake
   ipcopmake ethereal
+  ipcopmake tftp-hpa
 #  ipcopmake stunnel # Ausgeschaltet, weil wir es doch nicht nutzen
 }
 
@@ -819,7 +831,7 @@ buildpackages() {
        fi
   done
   echo "====== List of softwares used to build $NAME Version: $VERSION ======" > $BASEDIR/doc/packages-list.txt
-  grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|ipcop$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$' \
+  grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|ipfire$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$\|^ipfire-logs' \
        $BASEDIR/doc/packages-list | sort >> $BASEDIR/doc/packages-list.txt
   rm -f $BASEDIR/doc/packages-list
   # packages-list.txt is ready to be displayed for wiki page
@@ -859,7 +871,7 @@ ipfirepackages() {
   fi
   ipfiredist amavisd
   ipfiredist applejuice
-  ipfiredist asterisk
+  ipfiredist asterisk
   ipfiredist clamav
   ipfiredist cups
   ipfiredist cyrusimap
@@ -870,6 +882,7 @@ ipfirepackages() {
   ipfiredist libtiff
   ipfiredist libxml2
   ipfiredist mailx
+  ipfiredist mldonkey
   ipfiredist nfs
   ipfiredist nmap
   ipfiredist ntop
@@ -879,17 +892,22 @@ ipfirepackages() {
   ipfiredist spamassassin
   ipfiredist web-cyradm
   ipfiredist xampp
-  ipfiredist xinetd
+#  ipfiredist xinetd
   test -d $BASEDIR/packages || mkdir $BASEDIR/packages
   mv -f $LFS/install/packages/*.{tar.gz,md5} $BASEDIR/packages >> $LOGFILE 2>&1
   rm -rf  $BASEDIR/build/install/packages/*
 }
 
+update_logs() {
+       tar cfz log/ipfire-logs-`date +'%Y-%m-%d-%H:%M'`.tgz log/_build.*
+       rm -f log/_build.*
+}
+
 # See what we're supposed to do
 case "$1" in 
 build)
        BUILDMACHINE=`uname -m`
-       PACKAGE=`ls -v -r $BASEDIR/cache/$SNAME-1.4-toolchain-$BUILDMACHINE.tar.gz 2> /dev/null | head -n 1`
+       PACKAGE=`ls -v -r $BASEDIR/cache/toolchains/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz 2> /dev/null | head -n 1`
        #only restore on a clean disk
        if [ ! -f log/perl-*-tools ]; then
                if [ ! -n "$PACKAGE" ]; then
@@ -987,14 +1005,6 @@ clean)
                rm -f /tools
        fi
        ;;
-dist)
-       echo -ne "Updating & building source package from SVN: "
-       svn up > /dev/null
-       svn export http://svn.ipfire.eu/svn/ipfire ipfire-source/ --force > /dev/null
-       tar cfz ipfire-source-`date +'%Y-%m-%d'`-r`svn info | grep Revision | cut -c 11-`.tar.gz ipfire-source
-       rm ipfire-source/ -r
-       echo "Finished!"
-       ;;
 newpak)
        # create structure for a new package
        echo -e "Name of the new package: $2"
@@ -1095,70 +1105,217 @@ toolchain)
        buildtoolchain
        BUILDMACHINE=`uname -m`
        echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for $BUILDMACHINE" | tee -a $LOGFILE
-       cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \
+       test -d $BASEDIR/cache/toolchains || mkdir $BASEDIR/cache/toolchains
+       cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache/toolchains/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \
                build/{bin,etc,usr/bin,usr/local} \
                build/tools/{bin,etc,*-linux-gnu,include,lib,libexec,sbin,share,var} \
                log >> $LOGFILE
-       md5sum cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \
-               > cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.md5
+       md5sum cache/toolchains/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \
+               > cache/toolchains/$SNAME-$VERSION-toolchain-$BUILDMACHINE.md5
        stdumount
        ;;
 gettoolchain)
        BUILDMACHINE=`uname -m`
        # arbitrary name to be updated in case of new toolchain package upload
-       PACKAGE=$SNAME-1.4-toolchain-$BUILDMACHINE
-       URL_IPFIRE=`grep URL_IPFIRE lfs/Config | awk '{ print $3 }'`
-       echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for $BUILDMACHINE" | tee -a $LOGFILE
-       cd $BASEDIR/cache
-       wget $URL_IPFIRE/toolchains/$PACKAGE.tar.gz $URL_IPFIRE/toolchains/$PACKAGE.md5 >& /dev/null
-       if [ $? -ne 0 ]; then
-               echo "`date -u '+%b %e %T'`: error downloading toolchain for $BUILDMACHINE machine" | tee -a $LOGFILE
-       else
-               if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then
-                       echo "`date -u '+%b %e %T'`: toolchain md5 ok" | tee -a $LOGFILE
+       PACKAGE=$SNAME-$VERSION-toolchain-$BUILDMACHINE
+       if [ ! -f $BASEDIR/cache/toolchains/$PACKAGE.tar.gz ]; then
+               URL_IPFIRE=`grep URL_IPFIRE lfs/Config | awk '{ print $3 }'`
+               test -d $BASEDIR/cache/toolchains || mkdir $BASEDIR/cache/toolchains
+               echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for $BUILDMACHINE" | tee -a $LOGFILE
+               cd $BASEDIR/cache/toolchains
+               wget $URL_IPFIRE/toolchains/$PACKAGE.tar.gz $URL_IPFIRE/toolchains/$PACKAGE.md5 >& /dev/null
+               if [ $? -ne 0 ]; then
+                       echo "`date -u '+%b %e %T'`: error downloading toolchain for $BUILDMACHINE machine" | tee -a $LOGFILE
                else
-                       exiterror "$PACKAGE.md5 did not match, check downloaded package"
+                       if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then
+                               echo "`date -u '+%b %e %T'`: toolchain md5 ok" | tee -a $LOGFILE
+                       else
+                               exiterror "$PACKAGE.md5 did not match, check downloaded package"
+                       fi
                fi
+       else
+               echo "Toolchain is already downloaded. Exiting..."
        fi
        ;;
-paks)
+sources-iso)
        prepareenv
-       # buildpackages
-       ipfirepackages
-       ;;
-update)
-       echo "Load the latest source-files:"
-       svn update
-       ;;
-commit)
-       echo "Upload the changed files:"
-       svn commit
-       ./make.sh sync
-       svn up
-       ;;
-make)
-       echo "Do a complete compile:"   
-       ./make.sh prefetch && ./make.sh gettoolchain && ./make.sh build
+       echo "`date -u '+%b %e %T'`: Build sources iso for $MACHINE" | tee -a $LOGFILE
+       chroot $LFS /tools/bin/env -i   HOME=/root \
+       TERM=$TERM PS1='\u:\w\$ ' \
+       PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \
+       VERSION=$VERSION NAME="$NAME" SNAME="$SNAME" MACHINE=$MACHINE \
+       /bin/bash -x -c "cd /usr/src/lfs && make -f sources-iso LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
+       mv $LFS/install/images/ipfire-* $BASEDIR >> $LOGFILE 2>&1
+       stdumount
        ;;
-diff)
-       echo -ne "Make a local diff to last SVN revision: "
-       svn diff > ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff
-       echo "Finished!"
-       echo "Diff was successfully saved to ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff"
+svn)
+       case "$2" in
+         update|up)
+               # clear
+               echo -n "Load the latest source files..."
+               svn update >> $PWD/log/_build.svn.update.log
+               if [ $? -eq 0 ]; then
+                       echo ".Done!"
+               else
+                       echo ".Fail!"
+                       exit 1
+               fi
+               echo -n "Write the svn info to a file..."
+               svn info > $PWD/svn_status
+               if [ "$?" -eq "0" ]; then
+                       echo ".Done!"
+               else
+                       echo ".Fail!"
+                       exit 1
+               fi
+               chmod 755 $0
+               exit 0
+         ;;
+         commit|ci)
+               clear
+               #$0 changelog
+               #echo "Upload the changed files..."
+               sleep 1
+               svn commit
+               $0 svn up
+         ;;
+         dist)
+               $0 svn up
+               echo -ne "Download source package from svn..."
+               svn export http://svn.ipfire.eu/svn/ipfire ipfire-source/ --force > /dev/null
+               if [ "$?" -eq "0" ]; then
+                       echo ".Done!"
+               else
+                       echo ".Fail!"
+                       exit 1
+               fi
+               echo -n "Compress files..."
+               tar cfz ipfire-source-`date +'%Y-%m-%d'`-r`svn info | grep Revision | cut -c 11-`.tar.gz ipfire-source
+               if [ "$?" -eq "0" ]; then
+                       echo ".Done!"
+               else
+                       echo ".Fail!"
+                       exit 1
+               fi
+               echo -n "Cleanup..."
+               rm ipfire-source/ -r
+               if [ "$?" -eq "0" ]; then
+                       echo ".Done!"
+               else
+                       echo ".Fail!"
+                       exit 1
+               fi
+         ;;
+         diff)
+               echo -ne "Make a local diff to last svn revision..."
+               svn diff > ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff
+               if [ "$?" -eq "0" ]; then
+                       echo ".Done!"
+               else
+                       echo ".Fail!"
+                       exit 1
+               fi
+               echo "Diff was successfully saved to ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff"
+         ;;
+       esac
        ;;
-sync)
-       echo -e "Syncing Cache to FTP:"
-       if [ -f .pass ]; then
-               PASS="`cat .pass`"
+make-config)
+       echo -e "This is for creating your configuration..."
+       echo -e "We will need some input:"
+       echo -e ""
+       echo -n "FTP-DOMAIN FOR THE ISO: "
+       read IPFIRE_FTP_URL_EXT
+       echo -n "PATH FOR $IPFIRE_FTP_URL_EXT: "
+       read IPFIRE_FTP_PATH_EXT
+       echo -n "USERNAME FOR $IPFIRE_FTP_URL_EXT: "
+       read IPFIRE_FTP_USER_EXT
+       echo -n "PASSWORD FOR $IPFIRE_FTP_URL_EXT: "
+       read -s IPFIRE_FTP_PASS_EXT
+       echo ""
+       echo "(You can leave this empty if the cache-server is the same as your iso-server.)"
+       echo -n "FTP-DOMAIN FOR THE CACHE: "
+       read IPFIRE_FTP_URL_INT
+       echo -n "PATH FOR $IPFIRE_FTP_URL_INT: "
+       read IPFIRE_FTP_PATH_INT
+       if [ $IPFIRE_FTP_URL_INT ]; then
+               echo -n "USERNAME FOR $IPFIRE_FTP_URL_INT: "
+               read IPFIRE_FTP_USER_INT
+               echo -n "PASSWORD FOR $IPFIRE_FTP_URL_INT: "
+               read -s IPFIRE_FTP_PASS_INT
        else
-               echo -ne "Password for mirror.ipfire.org: "; read PASS
+               IPFIRE_FTP_URL_INT=$IPFIRE_FTP_URL_EXT
+               IPFIRE_FTP_USER_INT=$IPFIRE_FTP_USER_EXT
+               IPFIRE_FTP_PASS_INT=$IPFIRE_FTP_PASS_EXT
+               echo "USERNAME FOR $IPFIRE_FTP_URL_INT: $IPFIRE_FTP_USER_INT"
+               echo "PASSWORD FOR $IPFIRE_FTP_URL_INT: !HIDDEN!"
        fi
-       rm -f doc/packages-to-remove-from-ftp
-       ncftpls -u web3 -p $PASS ftp://mirror.ipfire.org/html/source-packages/source/ > ftplist
+       echo ""
+       echo "(You can leave this empty if the pak-server is the same as your iso-server.)"
+       echo -n "FTP-DOMAIN FOR THE PAKS: "
+       read IPFIRE_FTP_URL_PAK
+       echo -n "PATH FOR $IPFIRE_FTP_URL_PAK: "
+       read IPFIRE_FTP_PATH_PAK
+       if [ $IPFIRE_FTP_URL_PAK ]; then
+               echo -n "USERNAME FOR $IPFIRE_FTP_URL_PAK: "
+               read IPFIRE_FTP_USER_PAK
+               echo -n "PASSWORD FOR $IPFIRE_FTP_URL_PAK: "
+               read -s IPFIRE_FTP_PASS_PAK
+       else
+               IPFIRE_FTP_URL_PAK=$IPFIRE_FTP_URL_EXT
+               IPFIRE_FTP_USER_PAK=$IPFIRE_FTP_USER_EXT
+               IPFIRE_FTP_PASS_PAK=$IPFIRE_FTP_PASS_EXT
+               echo "USERNAME FOR $IPFIRE_FTP_URL_PAK: $IPFIRE_FTP_USER_PAK"
+               echo "PASSWORD FOR $IPFIRE_FTP_URL_PAK: !HIDDEN!"
+       fi
+       echo ""
+       echo -e "ONE OR MORE EMAIL ADDRESS(ES) TO WHICH THE REPORTS WILL BE SENT"
+       echo -e "(seperated by comma)"
+       read IPFIRE_MAIL_REPORT
+       echo -n "EMAIL FROM: "
+       read IPFIRE_MAIL_FROM
+       echo -n "EMAIL SERVER: "
+       read IPFIRE_MAIL_SERVER
+       echo -n "LOGIN TO MAIL SERVER: "
+       read IPFIRE_MAIL_USER
+       echo -n "MAIL PASSWORD: "
+       read -s IPFIRE_MAIL_PASS
+       echo -n "Saving..."
+       for i in `seq 20`; do
+               sleep 0.1; echo -n "."
+       done
+       echo ".Finished!"
+       cat <<END > .config
+### ISO server
+IPFIRE_FTP_URL_EXT=$IPFIRE_FTP_URL_EXT
+IPFIRE_FTP_PATH_EXT=$IPFIRE_FTP_PATH_EXT
+IPFIRE_FTP_USER_EXT=$IPFIRE_FTP_USER_EXT
+IPFIRE_FTP_PASS_EXT=$IPFIRE_FTP_PASS_EXT
+### cache server
+IPFIRE_FTP_URL_INT=$IPFIRE_FTP_URL_INT
+IPFIRE_FTP_PATH_INT=$IPFIRE_FTP_PATH_INT
+IPFIRE_FTP_USER_INT=$IPFIRE_FTP_USER_INT
+IPFIRE_FTP_PASS_INT=$IPFIRE_FTP_PASS_INT
+### paks server
+IPFIRE_FTP_URL_PAK=$IPFIRE_FTP_URL_PAK
+IPFIRE_FTP_PATH_PAK=$IPFIRE_FTP_PATH_PAK
+IPFIRE_FTP_USER_PAK=$IPFIRE_FTP_USER_PAK
+IPFIRE_FTP_PASS_PAK=$IPFIRE_FTP_PASS_PAK
+### mail reports
+IPFIRE_MAIL_REPORT=$IPFIRE_MAIL_REPORT
+IPFIRE_MAIL_FROM=$IPFIRE_MAIL_FROM
+IPFIRE_MAIL_SERVER=$IPFIRE_MAIL_SERVER
+IPFIRE_MAIL_USER=$IPFIRE_MAIL_USER
+IPFIRE_MAIL_PASS=$IPFIRE_MAIL_PASS
+END
+       ;;
+sync)
+       echo -e "Syncing cache to ftp:"
+#      rm -f doc/packages-to-remove-from-ftp
+       ncftpls -u $IPFIRE_FTP_USER_INT -p $IPFIRE_FTP_PASS_INT ftp://$IPFIRE_FTP_URL_INT$IPFIRE_FTP_PATH_INT/ > ftplist
        for i in `ls -w1 cache/`; do
                grep $i ftplist
                if [ "$?" -ne "0" ]; then
-                       ncftpput -u web3 -p $PASS mirror.ipfire.org /html/source-packages/source cache/$i
+                       ncftpput -u $IPFIRE_FTP_USER_INT -p $IPFIRE_FTP_PASS_INT $IPFIRE_FTP_URL_INT $IPFIRE_FTP_PATH_INT/ cache/$i
                        if [ "$?" -eq "0" ]; then
                                echo -e "$i was successfully uploaded to the ftp server."
                        else
@@ -1166,54 +1323,308 @@ sync)
                        fi
                fi
        done
-       for i in `cat ftplist`; do
-               ls -w1 cache/ | grep $i
+#      for i in `cat ftplist`; do
+#              ls -w1 cache/ | grep $i
+#              if [ "$?" -eq "1" ]; then
+#                      echo $i | grep -v toolchain >> doc/packages-to-remove-from-ftp
+#              fi
+#      done
+       rm -f ftplist
+       ;;
+upload)
+       case "$2" in
+         iso)
+               echo -e "Uploading the iso to $IPFIRE_FTP_URL_EXT."
+               ncftpls -u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT ftp://$IPFIRE_FTP_URL_EXT$IPFIRE_FTP_PATH_EXT/ | grep $SVN_REVISION
                if [ "$?" -eq "1" ]; then
-                       echo $i | grep -v toolchain >> doc/packages-to-remove-from-ftp
+                               cp $BASEDIR/ipfire-install-$VERSION.i386.iso $BASEDIR/ipfire-install-$VERSION.i386-r`svn info | grep Revision | cut -c 11-`.iso
+                               md5sum ipfire-install-$VERSION.i386-r$SVN_REVISION.iso > ipfire-install-$VERSION.i386-r$SVN_REVISION.iso.md5
+                               ncftpput -V -u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT $IPFIRE_FTP_PATH_EXT/ ipfire-install-$VERSION.i386-r$SVN_REVISION.iso
+                               ncftpput -V -u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT $IPFIRE_FTP_PATH_EXT/ ipfire-install-$VERSION.i386-r$SVN_REVISION.iso.md5
+                               ncftpput -V -u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT $IPFIRE_FTP_PATH_EXT/ ipfire-source-*-r$SVN_REVISION.tar.gz
+                               if [ "$?" -eq "0" ]; then
+                                       echo -e "The ISO of Revision $SVN_REVISION was successfully uploaded to the ftp server."
+                               else
+                                       echo -e "There was an error while uploading the iso to the ftp server."
+                                       exit 1
+                               fi
+               else
+                       echo -e "File with name ipfire-install-$VERSION.i386-r$SVN_REVISION.iso already exists on the ftp server!"
                fi
-       done
-       rm -f ftplist
+               rm -f ipfire-install-$VERSION.i386-r$SVN_REVISION.iso{,.md5}
+               ;;
+         paks)
+               ncftpput -z -u $IPFIRE_FTP_USER_PAK -p $IPFIRE_FTP_PASS_PAK $IPFIRE_FTP_URL_PAK $IPFIRE_FTP_PATH_PAK/ packages/*
+               if [ "$?" -eq "0" ]; then
+                       echo -e "The packages were successfully uploaded to the ftp server."
+               else
+                       echo -e "There was an error while uploading the packages to the ftp server."
+                       exit 1
+               fi
+         ;;
+       esac
        ;;
-pub-iso)
-       echo -e "Upload the ISO to the beta-mirror!"
-       if [ -f .pass ]; then
-               PASS="`cat .pass`"
-       else
-               echo -ne "Password for mirror.ipfire.org: "; read PASS
+build-only)
+       rm -f $BASEDIR/log/$2*
+       BUILDMACHINE=`uname -m`
+       prepareenv
+       ipcopmake $2
+       ;;
+build-silent)
+       screen -dmS ipfire $0 build
+       echo "Build started... This will take a while!"
+       echo "You can see the status with 'screen -x ipfire'."
+       ;;
+mail)
+       chmod 755 tools/sendEmail
+       ATTACHMENT=/tmp/ipfire-build-logs-R$SVN_REVISION.tar.gz
+       if [ "$2" = "ERROR" ]; then
+               SUBJECT="ERROR: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
+               echo "ERROR: $0 build!"
+               cat <<END > /tmp/ipfire_mail_body
+When I was building IPFire on `hostname`, I have found an ERROR!
+Here you can see the logs and detect the reason for this error.
+
+Best Regards
+Your IPFire-Build-Script
+END
        fi
-       ncftpls -u web3 -p $PASS ftp://mirror.ipfire.org/html/source-packages/beta/ | grep `svn info | grep Revision | cut -c 11-`
-       if [ "$?" -eq "1" ]; then
-                       cp $BASEDIR/ipfire-install-1.4.i386.iso $BASEDIR/ipfire-install-1.4.i386-r`svn info | grep Revision | cut -c 11-`.iso
-                       md5sum ipfire-install-1.4.i386-r`svn info | grep Revision | cut -c 11-`.iso > ipfire-install-1.4.i386-r`svn info | grep Revision | cut -c 11-`.iso.md5
-                       ncftpput -u web3 -p $PASS mirror.ipfire.org /html/source-packages/beta/ ipfire-install-1.4.i386-r`svn info | grep Revision | cut -c 11-`.iso
-                       ncftpput -u web3 -p $PASS mirror.ipfire.org /html/source-packages/beta/ ipfire-install-1.4.i386-r`svn info | grep Revision | cut -c 11-`.iso.md5
-                       if [ "$?" -eq "0" ]; then
-                               echo -e "The ISO of Revision `svn info | grep Revision | cut -c 11-` was successfully uploaded to the ftp server."
-                       else
-                               echo -e "There was an error while uploading the ISO to the ftp server."
-                       fi
-       else
-               echo -e "File with name ipfire-install-1.4.i386-r`svn info | grep Revision | cut -c 11-`.iso already exists on the ftp server!"
+       if [ "$2" = "SUCCESS" ]; then
+               SUBJECT="SUCCESS: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
+               cat <<END > /tmp/ipfire_mail_body
+Building IPFire on `hostname` in Revision $SVN_REVISION was successfull!
+You can find the ISO on your ftp server.
+
+Statistics:
+-----------
+Started:       $IPFIRE_START_TIME
+Finished:      `date`
+
+Best Regards
+Your IPFire-Build-Script
+END
+       fi
+       if [ "$2" = "SVNUPDATE" ]; then
+               SUBJECT="SVNUPDATE: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
+               echo "ERROR: $0 svn up!"
+               cat <<END > /tmp/ipfire_mail_body
+When I was downloading the latest svn source,
+I have found an ERROR!
+Here you can see the logs and detect the reason for this error.
+
+Best Regards
+Your IPFire-Build-Script
+END
+       fi
+
+       if [ "$2" = "SVNDIST" ]; then
+               SUBJECT="SVNDIST: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
+               echo "ERROR: $0 svn dist!"
+               cat <<END > /tmp/ipfire_mail_body
+When I was exporting the latest svn source,
+I have found an ERROR!
+Here you can see the logs and detect the reason for this error.
+
+Best Regards
+Your IPFire-Build-Script
+END
+       fi
+
+       if [ "$2" = "PREFETCH" ]; then
+               SUBJECT="PREFETCH: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
+               echo "ERROR: $0 prefetch!"
+               cat <<END > /tmp/ipfire_mail_body
+When I was downloading the source packages,
+I have found an ERROR!
+Here you can see the logs and detect the reason for this error.
+
+Best Regards
+Your IPFire-Build-Script
+END
+       fi
+
+       if [ "$2" = "ISO" ]; then
+               SUBJECT="ISO: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
+               echo "ERROR: $0 upload iso!"
+               cat <<END > /tmp/ipfire_mail_body
+When I was uploading the iso image,
+I have found an ERROR!
+Here you can see the logs and detect the reason for this error.
+
+Best Regards
+Your IPFire-Build-Script
+END
        fi
-       rm -f ipfire-install-1.4.i386-r`svn info | grep Revision | cut -c 11-`.iso{,.md5}
+
+       if [ "$2" = "PAKS" ]; then
+               SUBJECT="PAKS: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
+               echo "ERROR: $0 upload paks!"
+               cat <<END > /tmp/ipfire_mail_body
+When I was uploading the packages,
+I have found an ERROR!
+Here you can see the logs and detect the reason for this error.
+
+Best Regards
+Your IPFire-Build-Script
+END
+       fi
+
+       tar cfz $ATTACHMENT log/_build*
+       cat <<END >> /tmp/ipfire_mail_body
+
+Here is a summary... The full logs are in the attachment.
+---------------------------------------------------------
+
+`tail log/_*`
+END
+       cat /tmp/ipfire_mail_body | tools/sendEmail -q \
+               -f $IPFIRE_MAIL_FROM \
+               -t $IPFIRE_MAIL_REPORT \
+               -u $SUBJECT \
+               -s $IPFIRE_MAIL_SERVER:25 \
+               -xu $IPFIRE_MAIL_USER \
+               -xp $IPFIRE_MAIL_PASS \
+               -l log/_build.mail.log \
+               -a $ATTACHMENT # -v
+       rm -f /tmp/ipfire_mail_body $ATTACHMENT
        ;;
-pub-paks)
-       echo -e "Upload the packages to the beta-mirror!"
-       if [ -f .pass ]; then
-               PASS="`cat .pass`"
-       else
-               echo -ne "Password for mirror.ipfire.org: "; read PASS
+unattended)
+       if [ ! -f .config ]; then
+               echo "No configuration found. Try ./make.sh make-config."
+       fi
+       ### This is our procedure that will compile the IPFire by herself...
+       echo "### UPDATE LOGS"
+       update_logs
+       echo "### SAVING TIME"
+       export IPFIRE_START_TIME=`date`
+
+       echo "### GETTING TOOLCHAIN"
+       $0 gettoolchain
+
+       echo "### RUNNING SVN-UPDATE"
+       $0 svn update
+       if [ $? -ne 0 ]; then
+               $0 mail SVNUPDATE
+               exit 1
+       fi
+       
+       echo "### EXPORT SOURCES"
+       $0 svn dist
+       if [ $? -ne 0 ]; then
+               $0 mail SVNDIST
+               exit 1
+       fi
+
+       echo "### RUNNING PREFETCH"
+       $0 prefetch | grep -q "md5 difference"
+       if [ $? -eq 0 ]; then
+               $0 mail PREFETCH
+               exit 1
+       fi
+
+       echo "### RUNNING BUILD"
+       $0 build
+       if [ $? -ne 0 ]; then
+               $0 mail ERROR
+               exit 1
+       fi
+
+       echo "### MAKING SOURCES-ISO"
+       $0 sources-iso
+
+       echo "### UPLOADING ISO"
+       $0 upload iso
+       if [ $? -ne 0 ]; then
+               $0 mail ISO
+               exit 1
        fi
-       ncftpput -z -u web3 -p $PASS mirror.ipfire.org /html/source-packages/packages/ packages/*
-       if [ "$?" -eq "0" ]; then
-               echo -e "The packages were successfully uploaded to the ftp server."
+       
+       echo "### UPLOADING PAKS"
+       $0 upload paks
+       if [ $? -ne 0 ]; then
+               $0 mail PAKS
+               exit 1
+       fi
+
+       echo "### SUCCESS!"
+       $0 mail SUCCESS
+       exit 0
+       ;;
+batch)
+       if [ `screen -ls | grep batch` ]; then
+               echo "Build is already running, sorry!"
+               exit 1
        else
-               echo -e "There was an error while uploading the packages to the ftp server."
+               echo -n "IPFire-Batch-Build is starting..."
+               screen -dmS ipfire $0 unattended
+               if [ "$?" -eq "0" ]; then
+                       echo ".Done!"
+               else
+                       echo ".ERROR!"
+                       exit 1
+               fi
+               #if [ "$2" -eq "-v" ]; then
+               #       screen -x ipfire
+               #else
+               #       echo "You may attach you with '-v'."
+               #fi
+               exit 0
        fi
        ;;
 *)
-       echo "Usage: $0 {build|changelog|check|checkclean|clean|commit|diff|dist|gettoolchain|make|newpak|prefetch|pub-iso|pub-paks|shell|sync|toolchain|update}"
-       cat doc/make.sh-usage
-       exit 1
+       clear
+       svn info
+       select name in "Exit" "IPFIRE: Prefetch" "IPFIRE: Build (silent)" "IPFIRE: Watch Build" "IPFIRE: Batch" "IPFIRE: Clean" "SVN: Commit" "SVN: Update" "SVN: Status" "SVN: Diff" "LOG: Tail" "Help"
+       do
+       case $name in
+       "IPFIRE: Prefetch")
+               $0 prefetch
+               ;;
+       "IPFIRE: Build (silent)")
+               $0 build-silent
+               ;;
+       "IPFIRE: Watch Build")
+               echo "Exit with Ctrl+A, Ctrl+D."
+               echo -n "Preparing..."
+               for i in `seq 10`; do
+                       sleep 0.1; echo -n "."
+               done
+               echo ".Ready!"
+               sleep 0.3
+               screen -x ipfire
+               ;;
+       "IPFIRE: Batch")
+               $0 batch
+               ;;
+       "IPFIRE: Clean")
+               $0 clean
+               ;;
+       "SVN: Commit")
+               echo "Are your sure to Update all Files to the Server (write: yes)?"; read input
+               if [ "$input" == "yes" ]; then
+                       $0 svn commit
+               fi
+               ;;
+       "SVN: Update")
+               $0 svn update
+               ;;
+       "SVN: Status")
+               svn status # | grep -v ^?
+               ;;
+       "SVN: Diff")
+               $0 svn diff
+               ;;
+       "Help")
+               echo "Usage: $0 {build|changelog|check|checkclean|clean|gettoolchain|newpak|prefetch|shell|sync|toolchain}"
+               cat doc/make.sh-usage
+               ;;
+       "LOG: Tail")
+               tail -f log/_*
+               ;;
+       "Exit")
+               break
+               ;;
+       esac
+       done
        ;;
 esac