+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
+ 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
+
+ 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
+ ;;
+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
+
+ if [ "$IPFIRE_REBUILD" -eq "0" ]; then
+ 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
+ fi
+
+ echo "### RUNNING BUILD"
+ $0 build
+ if [ $? -ne 0 ]; then
+ $0 mail ERROR
+ exit 1
+ fi
+
+ echo "### MAKING SOURCES-ISO"
+ echo "DISABLED by Delaco!"
+ #$0 sources-iso
+
+ echo "### UPLOADING ISO"
+ $0 upload iso
+ if [ $? -ne 0 ]; then
+ $0 mail ISO
+ exit 1
+ fi
+
+ 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 -q ipfire` ]; then
+ echo "Build is already running, sorry!"
+ exit 1
+ else
+ if [ "$2" = "--rebuild" ]; then
+ export IPFIRE_REBUILD=1
+ echo "REBUILD!"
+ else
+ export IPFIRE_REBUILD=0
+ fi
+ echo -n "IPFire-Batch-Build is starting..."
+ screen -dmS ipfire $0 unattended
+ if [ "$?" -eq "0" ]; then
+ echo ".Done!"
+ else
+ echo ".ERROR!"
+ exit 1
+ fi
+ exit 0
+ fi
+ ;;
+watch)
+ echo "Exit with Ctrl+A, Ctrl+D."
+ echo -n "Preparing..."
+ for i in `seq 5`; do
+ sleep 0.1; echo -n "."
+ done
+ echo ".Ready!"
+ sleep 0.3
+ screen -x ipfire