#!/bin/bash
-############################################################################
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
+###############################################################################
#
# Beautifying variables & presentation & input output interface
#
-############################################################################
+###############################################################################
## Screen Dimentions
# Find current screen size
}
ipfiredist() {
- if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then
- echo "`date -u '+%b %e %T'`: Packaging $1" | 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 \
- CONFIG_ROOT=$CONFIG_ROOT \
- NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
- CFLAGS="$C2FLAGS" CXXFLAGS="$CXX2FLAGS" \
- CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
- KVER=$KVER IPFVER="$IPFVER" \
- BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
- /bin/bash -x -c "cd /usr/src/lfs && \
- make -f $1 LFS_BASEDIR=/usr/src dist" >>$LOGFILE 2>&1
- if [ $? -ne 0 ]; then
- exiterror "Packaging $1"
- fi
+ lfsmakecommoncheck $*
+ [ $? == 1 ] && return 0
+
+ local PKG_TIME_START=`date +%s`
+ 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 \
+ CONFIG_ROOT=$CONFIG_ROOT \
+ NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
+ CFLAGS="$C2FLAGS" CXXFLAGS="$CXX2FLAGS" \
+ CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
+ KVER=$KVER IPFVER="$IPFVER" \
+ BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
+ /bin/bash -x -c "cd /usr/src/lfs && \
+ make -f $1 LFS_BASEDIR=/usr/src dist" >>$LOGFILE 2>&1
+
+ local COMPILE_SUCCESS=$?
+ local PKG_TIME_END=`date +%s`
+
+ if [ $COMPILE_SUCCESS -ne 0 ]; then
+ beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
+ exiterror "Packaging $*";
else
- exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
+ beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
fi
return 0
}
fi
echo "### RUNNING BUILD"
- $0 build
+ $0 build #--devel
evaluate 1 mail_me ERROR
-# echo "### UPLOADING ISO"
-# $0 upload iso
-# evaluate 1 mail_me ISO
+ echo "### UPLOADING ISO"
+ $0 upload iso
+ evaluate 1 mail_me ISO
-# echo -ne "### UPLOADING PAKS"
-# $0 upload paks
-# evaluate 1 mail_me PAKS
+ echo -ne "### UPLOADING PAKS"
+ $0 upload paks
+ evaluate 1 mail_me PAKS
echo -ne "${BOLD}***SUCCESS!${NORMAL}"
mail_me success
}
mail_me() {
- chmod 755 tools/sendEmail
- ATTACHMENT=/tmp/ipfire-build-logs-R$SVN_REVISION.tar.gz
+ echo "From: $MAIL_FROM" > /tmp/ipfire_mail_body.$$
+ echo "To: $MAIL_TO" >> /tmp/ipfire_mail_body.$$
case "$1" in
success)
- SUBJECT="SUCCESS: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
- cat <<END > /tmp/ipfire_mail_body
+ cat <<END >> /tmp/ipfire_mail_body.$$
+Subject: SUCCESS: IPFIRE-BUILD R$SVN_REVISION on `hostname`
Building IPFire on `hostname` in Revision $SVN_REVISION was successfull!
You can find the ISO on your ftp server if you told the script where it is.
echo -ne "${BOLD}***Sending success message${NORMAL}"
;;
*)
- SUBJECT="ERROR $1: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
- cat <<END > /tmp/ipfire_mail_body
+ cat <<END >> /tmp/ipfire_mail_body.$$
+Subject: ERROR $1: IPFIRE-BUILD R$SVN_REVISION on `hostname`
When I was building IPFire on `hostname`, I have found an ERROR with name $1!
Here you can see the logs and detect the reason for this error.
echo -ne "${BOLD}***Sending error message${NORMAL}"
;;
esac
- tar cfz $ATTACHMENT log/_build*
- cat /tmp/ipfire_mail_body | tools/sendEmail -q \
- -f $MAIL_USER \
- -t $MAIL_TO \
- -u $SUBJECT \
- -s $MAIL_SERVER:25 \
- -xu $MAIL_USER \
- -xp $MAIL_PASS \
- -l log/_build.mail.log \
- -a $ATTACHMENT # -v
+
+sleep 15
+ python tools/sendEmail < /tmp/ipfire_mail_body.$$
if [ "$?" -eq "0" ]; then
beautify message DONE
else
beautify message FAIL
fi
- rm -f /tmp/ipfire_mail_body $ATTACHMENT
+ rm -f /tmp/ipfire_mail_body.$$
}
make_config() {
echo -ne "You should enter a mail server to login...\n"
echo -ne "Please type the url: "
read MAIL_SERVER
+ echo -ne "Please type where the email is from: "
+ read MAIL_FROM
echo -ne "Please type the username: "
read MAIL_USER
echo -ne "Please type the password (hidden): "
FTP_CACHE_PASS=$FTP_CACHE_PASS
### mail reports
MAIL_TO="$MAIL_TO"
+MAIL_FROM=$MAIL_FROM
MAIL_SERVER=$MAIL_SERVER
MAIL_USER=$MAIL_USER
MAIL_PASS=$MAIL_PASS
update_langs() {
echo -ne "Checking the translations for missing or obsolete strings..."
- chmod 755 $BASEDIR/tools/{check_strings.pl,sort_strings.pl}
+ chmod 755 $BASEDIR/tools/{check_strings.pl,sort_strings.pl,check_langs.sh}
$BASEDIR/tools/sort_strings.pl en
$BASEDIR/tools/sort_strings.pl de
$BASEDIR/tools/check_strings.pl en > $BASEDIR/doc/language_issues.en