+ 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 $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
+ echo -e "There was an error while uploading $i to the ftp server."
+ fi
+ fi
+ done
+# 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
+ 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
+ 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
+ ;;
+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
+ 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
+ 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
+
+ echo "### UPLOADING PAKS"
+ $0 upload paks
+ if [ $? -ne 0 ]; then
+ $0 mail PAKS
+ exit 1
+ fi
+
+ echo "### SUCCESS!"
+ $0 mail SUCCESS
+ exit 0