X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=blobdiff_plain;f=tools%2Fmake-functions;h=fde6ef15bd1b859fdfa0090ab1ed219f80c865c5;hp=b81ce3c9527aad96a4e9748a0b1dbeab2a366a7e;hb=1065bfea84cb9bb8301aeedc900ea8c32673b6f1;hpb=c8ead4a543859582497e107173c650cec4203d4f diff --git a/tools/make-functions b/tools/make-functions index b81ce3c952..fde6ef15bd 100644 --- a/tools/make-functions +++ b/tools/make-functions @@ -108,8 +108,22 @@ beautify() ;; build_stage) MESSAGE=$2 - echo -ne "${BOLD}*** ${MESSAGE}${SET_VER_COL} version${SET_OPT_COL} options" - echo -ne "${SET_TIME_COL} time (sec)${SET_RESULT_COL} status${NORMAL}\n" + if [ "$STAGE_TIME_START" ]; then + LAST_STAGE_TIME=$[ `date +%s` - $STAGE_TIME_START ] + fi + STAGE_TIME_START=`date +%s` + echo -ne "${BOLD}*** ${MESSAGE}${NORMAL}" + if [ "$LAST_STAGE_TIME" ]; then + echo -ne "${DONE} (Last stage took $LAST_STAGE_TIME secs)${NORMAL}" + fi + echo -ne "${BOLD}${SET_VER_COL} version${SET_OPT_COL} options${SET_TIME_COL} time (sec)${SET_RESULT_COL} status${NORMAL}\n" + ;; + build_start) + BUILD_TIME_START=`date +%s` + ;; + build_end) + BUILD_TIME_END=`date +%s` + echo -ne "${DONE}***Build is finished now and took $[ $BUILD_TIME_END - $BUILD_TIME_START ] secs!${NORMAL}\n" ;; make_pkg) echo "$2" | while read PKG_VER PROGRAM OPTIONS @@ -259,7 +273,6 @@ entershell() { # lfsmakecommoncheck() { - # Script present? if [ ! -f $BASEDIR/lfs/$1 ]; then exiterror "No such file or directory: $BASEDIR/$1" @@ -272,7 +285,7 @@ lfsmakecommoncheck() local i for i in $SKIP_PACKAGE_LIST do - if [ "$i" == "$1" ]; then + if [ "$i" == "$1" ]; then beautify result SKIP return 1; fi @@ -406,19 +419,13 @@ ipfiredist() { } installmake() { - if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then - echo "`date -u '+%b %e %T'`: Building $*" | tee -a $LOGFILE - cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t " download >> $LOGFILE 2>&1 - if [ $? -ne 0 ]; then - exiterror "Download error in $1" - fi - cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1 - if [ $? -ne 0 ]; then - exiterror "md5sum error in $1, check file in cache or signature" - 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:/opt/$MACHINE-uClibc/usr/bin:/bin:/usr/bin:/sbin:/usr/sbin \ + PATH=/opt/i586-uClibc/i586-linux-uclibc/bin:/opt/i586-uClibc/bin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \ VERSION=$VERSION \ CONFIG_ROOT=$CONFIG_ROOT \ LFS_PASS="install" \ @@ -429,11 +436,15 @@ installmake() { BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \ /bin/bash -x -c "cd /usr/src/lfs && \ make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1 - if [ $? -ne 0 ]; then - exiterror "Building $*" - fi + + 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 "Building $*"; 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 } @@ -444,42 +455,37 @@ update_logs() { } batch_script() { - echo -ne "### UPDATE LOGS" + echo -ne "${BOLD}***This is our auto buildscript! Have fun...${NORMAL}\n" update_logs evaluate 1 if [ "$IPFIRE_REBUILD" -eq "0" ]; then - echo -ne "### SAVING TIME" export IPFIRE_START_TIME=`date` evaluate 1 echo "### RUNNING SVN-UPDATE" $0 svn update - evaluate 1 mail SVNUPDATE + evaluate 1 mail_me SVNUPDATE echo "### EXPORT SOURCES" $0 svn dist - evaluate 1 mail SVNDIST - - echo "### RUNNING PREFETCH" - $0 prefetch | grep -q "md5 difference" - evaluate 1 mail PREFETCH + evaluate 1 mail_me SVNDIST fi echo "### RUNNING BUILD" $0 build - evaluate 1 mail ERROR + evaluate 1 mail_me ERROR - echo "### UPLOADING ISO" - $0 upload iso - evaluate 1 mail ISO +# echo "### UPLOADING ISO" +# $0 upload iso +# evaluate 1 mail_me ISO - echo -ne "### UPLOADING PAKS" - $0 upload paks - evaluate 1 mail PAKS +# echo -ne "### UPLOADING PAKS" +# $0 upload paks +# evaluate 1 mail_me PAKS - echo -n "${BOLD}***SUCCESS!${NORMAL}" - evaluate 0 mail SUCCESS + echo -ne "${BOLD}***SUCCESS!${NORMAL}" + mail_me success exit 0 } @@ -489,7 +495,7 @@ watch_screen() { screen -x ipfire } -mail() { +mail_me() { chmod 755 tools/sendEmail ATTACHMENT=/tmp/ipfire-build-logs-R$SVN_REVISION.tar.gz case "$1" in @@ -497,7 +503,7 @@ mail() { SUBJECT="SUCCESS: IPFIRE-BUILD R$SVN_REVISION on `hostname`" cat < /tmp/ipfire_mail_body Building IPFire on `hostname` in Revision $SVN_REVISION was successfull! -You can find the ISO on your ftp server. +You can find the ISO on your ftp server if you told the script where it is. Statistics: ----------- @@ -530,12 +536,12 @@ END esac tar cfz $ATTACHMENT log/_build* cat /tmp/ipfire_mail_body | tools/sendEmail -q \ - -f $IPFIRE_MAIL_FROM \ - -t $IPFIRE_MAIL_REPORT \ + -f $MAIL_USER \ + -t $MAIL_TO \ -u $SUBJECT \ - -s $IPFIRE_MAIL_SERVER:25 \ - -xu $IPFIRE_MAIL_USER \ - -xp $IPFIRE_MAIL_PASS \ + -s $MAIL_SERVER:25 \ + -xu $MAIL_USER \ + -xp $MAIL_PASS \ -l log/_build.mail.log \ -a $ATTACHMENT # -v if [ "$?" -eq "0" ]; then @@ -547,88 +553,153 @@ END } 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 - 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!" + clear + echo -e "${BOLD}***This will create your configuration...${NORMAL}" + echo -ne "***If your are ready press !" + read + clear + echo -ne "***The buildscript will create a full iso image.\n" + echo -ne "***If you want to skip any package please enter its name here seperated with space.\n" + echo -ne "Actually in the list are: $SKIP_PACKAGE_LIST\n" + echo -ne "Do you want to change this? (y/N) " + read YESNO + if [ "$YESNO" == "y" ]; then + echo -ne "Please type: " + read SKIP_PACKAGE_LIST + echo -ne "You entered: $SKIP_PACKAGE_LIST\n" fi - 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!" + + clear + echo -ne "***When you have compiled successfully, there is the possibility\n" + echo -ne "***to upload the iso image to a ftp server.\n" + echo -ne "***If the url is empty there will be no upload.\n" + echo -ne "Actually there is: $FTP_ISO_URL\n" + echo -ne "Do you want to change this? (y/N) " + read YESNO + if [ "$YESNO" == "y" ]; then + echo -ne "Please type the url: " + read FTP_ISO_URL + echo -ne "Please type the path: " + read FTP_ISO_PATH + echo -ne "Please type the username: " + read FTP_ISO_USER + echo -ne "Please type the password (hidden): " + read -s FTP_ISO_PASS + + fi + + clear + echo -ne "***When you add some new software you can easyly\n" + echo -ne "***upload the source code to our repository server.\n" + echo -ne "***If the url is empty there will be no upload.\n" + echo -ne "Actually there is: $FTP_CACHE_URL\n" + echo -ne "Do you want to change this? (y/N) " + read YESNO + if [ "$YESNO" == "y" ]; then + echo -ne "Please type the url: " + read FTP_CACHE_URL + echo -ne "Please type the path: " + read FTP_CACHE_PATH + echo -ne "Please type the username: " + read FTP_CACHE_USER + echo -ne "Please type the password (hidden): " + read -s FTP_CACHE_PASS + + fi + + clear + echo -ne "***If there are some important messages you\n" + echo -ne "***can get a notification mail.\n" + echo -ne "***Please type one ore more email adresses (seperated by comma).\n" + echo -ne "Actually there is: $MAIL_TO\n" + echo -ne "Do you want to change this? (y/N) " + read YESNO + if [ "$YESNO" == "y" ]; then + echo -ne "Please type: " + read MAIL_TO + echo -ne "You should enter a mail server to login...\n" + echo -ne "Please type the url: " + read MAIL_SERVER + echo -ne "Please type the username: " + read MAIL_USER + echo -ne "Please type the password (hidden): " + read -s MAIL_PASS + 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..." - cat < .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 + echo -ne "\n${BOLD}***Saving...${NORMAL}" + cat < $BASEDIR/.config +### iso server +FTP_ISO_URL=$FTP_ISO_URL +FTP_ISO_PATH=$FTP_ISO_PATH +FTP_ISO_USER=$FTP_ISO_USER +FTP_ISO_PASS=$FTP_ISO_PASS ### 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 +FTP_CACHE_URL=$FTP_CACHE_URL +FTP_CACHE_PATH=$FTP_CACHE_PATH +FTP_CACHE_USER=$FTP_CACHE_USER +FTP_CACHE_PASS=$FTP_CACHE_PASS ### 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 +MAIL_TO="$MAIL_TO" +MAIL_SERVER=$MAIL_SERVER +MAIL_USER=$MAIL_USER +MAIL_PASS=$MAIL_PASS +### misc +SKIP_PACKAGE_LIST="$SKIP_PACKAGE_LIST" END beautify message DONE -} \ No newline at end of file +} + +compile_tftpd() { + mkdir $BASEDIR/tmp + tar xvfz $BASEDIR/cache/tftp-hpa-0.42.tar.gz -C $BASEDIR/tmp + cd $BASEDIR/tmp/tftp-hpa-* + ./configure --prefix=/ipfire/trunk/tools/ \ + --sbindir=/ipfire/trunk/tools/ --disable-nls + make + install -c tftpd/tftpd $BASEDIR/tools/in.tftpd + cd - + rm -rf $BASEDIR/tmp/tftp-hpa-* +} + +start_tftpd() { + if [ ! -e $BASEDIR/tools/in.tftpd ]; then + compile_tftpd + fi + reload_tftpd + if [ "$?" == "0" ]; then + $BASEDIR/tools/in.tftpd -l -s $BASEDIR/tftpboot + beautify message DONE + else + echo -en "You don not have a pxe boot image in your base directory.\nPlease compile first." + beautify message FAIL + exit 1 + fi +} + +stop_tftpd() { + echo -n "Stopping TFTPD..." + killall in.tftpd >/dev/null 2>&1 + sleep 3 + killall -9 in.tftp >/dev/null 2>&1 + beautify message DONE +} + +reload_tftpd() { + if [ -e $BASEDIR/ipfire-$VERSION.$MACHINE-pxe.tgz ]; then + mkdir -p $BASEDIR/tftpboot + tar xfz $BASEDIR/ipfire-$VERSION.$MACHINE-pxe.tgz -C $BASEDIR/tftpboot + return 0 + fi + return 1 +} + +update_langs() { + echo -ne "Checking the translations for missing or obsolete strings..." + 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 + $BASEDIR/tools/check_strings.pl de > $BASEDIR/doc/language_issues.de + $BASEDIR/tools/check_langs.sh > $BASEDIR/doc/language_missings + beautify message DONE +}