2 ############################################################################
4 # This file is part of the IPFire Firewall. #
6 # IPFire is free software; you can redistribute it and/or modify #
7 # it under the terms of the GNU General Public License as published by #
8 # the Free Software Foundation; either version 2 of the License, or #
9 # (at your option) any later version. #
11 # IPFire is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
16 # You should have received a copy of the GNU General Public License #
17 # along with IPFire; if not, write to the Free Software #
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
20 # Copyright (C) 2006 IPFire-Team <info@ipfire.eu>. #
22 ############################################################################
25 NAME
="IPFire" # Software name
26 SNAME
="ipfire" # Short name
27 VERSION
="2.0" # Version number
28 SLOGAN
="www.ipfire.eu" # Software slogan
29 CONFIG_ROOT
=/var
/ipfire
# Configuration rootdir
31 MAX_RETRIES
=1 # prefetch/check loop
32 KVER
=`grep --max-count=1 VER lfs/linux | awk '{ print $3 }'`
34 SVN_REVISION
=`svn info | grep Revision | cut -c 11-`
36 IPFVER
="full" # Which version should be compiled? (full|light|voice)
38 # Set an information about the build number
39 if [ -e .
/.svn
]; then
40 FIREBUILD
=`cat .svn/entries |sed -n 's/^[ \t]*revision=\"// p' | sed -n 's/\".*$// p'`
43 # Debian specific settings
44 if [ ! -e /etc
/debian_version
]; then
47 if [ -x /usr
/bin
/realpath
]; then
48 FULLPATH
=`/usr/bin/realpath $0`
50 echo "ERROR: Need to do apt-get install realpath"
56 BASENAME
=`basename $0`
57 BASEDIR
=`echo $FULLPATH | sed "s/\/$BASENAME//g"`
58 LOGFILE
=$BASEDIR/log
/_build.preparation.log
59 export BASEDIR LOGFILE
60 DIR_CHK
=$BASEDIR/cache
/check
61 mkdir
$BASEDIR/log
/ 2>/dev
/null
64 . tools
/make-functions
66 if [ -f .config
]; then
73 ############################################################################
75 # Are we running the right shell? #
77 ############################################################################
78 if [ ! "$BASH" ]; then
79 exiterror
"BASH environment variable is not set. You're probably running the wrong shell."
82 if [ -z "${BASH_VERSION}" ]; then
83 exiterror
"Not running BASH shell."
87 ############################################################################
89 # Trap on emergency exit #
91 ############################################################################
92 trap "exiterror 'Build process interrupted'" SIGINT SIGTERM SIGKILL SIGSTOP SIGQUIT
95 ############################################################################
97 # Resetting our nice level #
99 ############################################################################
100 echo -ne "Resetting our nice level to $NICE" |
tee -a $LOGFILE
101 renice
$NICE $$
> /dev
/null
102 if [ `nice` != "$NICE" ]; then
103 beautify message FAIL
104 exiterror
"Failed to set correct nice level"
106 beautify message DONE
110 ############################################################################
112 # Checking if running as root user #
114 ############################################################################
115 echo -ne "Checking if we're running as root user" |
tee -a $LOGFILE
116 if [ `id -u` != 0 ]; then
117 beautify message FAIL
118 exiterror
"Not building as root"
120 beautify message DONE
124 ############################################################################
126 # Checking for necessary temporary space #
128 ############################################################################
129 echo -ne "Checking for necessary space on disk $BASE_DEV" |
tee -a $LOGFILE
130 BASE_DEV
=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $1 }'`
131 BASE_ASPACE
=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $4 }'`
132 if (( 2202000 > $BASE_ASPACE )); then
133 BASE_USPACE
=`du -skx $BASEDIR | awk '{print $1}'`
134 if (( 2202000 - $BASE_USPACE > $BASE_ASPACE )); then
135 beautify message FAIL
136 exiterror
"Not enough temporary space available, need at least 2.1GB on $BASE_DEV"
139 beautify message DONE
142 ############################################################################
144 # Building Linux From Scratch system #
146 ############################################################################
153 # Check /tools symlink
154 if [ -h /tools
]; then
157 if [ ! -a /tools
]; then
158 ln -s $BASEDIR/build
/tools
/
160 if [ ! -h /tools
]; then
161 exiterror
"Could not create /tools symbolic link."
168 export LFS LC_ALL CFLAGS CXXFLAGS MAKETUNING
169 unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
171 # Make some extra directories
172 mkdir
-p $BASEDIR/build
/{tools
,etc
,usr
/src
} 2>/dev
/null
173 mkdir
-p $BASEDIR/build
/{dev
/{shm
,pts
},proc
,sys
}
174 mkdir
-p $BASEDIR/{cache
,ccache
} 2>/dev
/null
175 mkdir
-p $BASEDIR/build
/usr
/src
/{cache
,config
,doc
,html
,langs
,lfs
,log
,src
,ccache
}
177 mknod
-m 600 $BASEDIR/build
/dev
/console c
5 1 2>/dev
/null
178 mknod
-m 666 $BASEDIR/build
/dev
/null c
1 3 2>/dev
/null
180 # Make all sources and proc available under lfs build
181 mount
--bind /dev
$BASEDIR/build
/dev
182 mount
--bind /dev
/pts
$BASEDIR/build
/dev
/pts
183 mount
--bind /dev
/shm
$BASEDIR/build
/dev
/shm
184 mount
--bind /proc
$BASEDIR/build
/proc
185 mount
--bind /sys
$BASEDIR/build
/sys
186 mount
--bind $BASEDIR/cache
$BASEDIR/build
/usr
/src
/cache
187 mount
--bind $BASEDIR/ccache
$BASEDIR/build
/usr
/src
/ccache
188 mount
--bind $BASEDIR/config
$BASEDIR/build
/usr
/src
/config
189 mount
--bind $BASEDIR/doc
$BASEDIR/build
/usr
/src
/doc
190 mount
--bind $BASEDIR/html
$BASEDIR/build
/usr
/src
/html
191 mount
--bind $BASEDIR/langs
$BASEDIR/build
/usr
/src
/langs
192 mount
--bind $BASEDIR/lfs
$BASEDIR/build
/usr
/src
/lfs
193 mount
--bind $BASEDIR/log
$BASEDIR/build
/usr
/src
/log
194 mount
--bind $BASEDIR/src
$BASEDIR/build
/usr
/src
/src
196 # This is a temporary hack!!!
197 cp -f /bin
/hostname
/tools
/bin
/hostname
2>/dev
/null
199 # Run LFS static binary creation scripts one by one
200 export CCACHE_DIR
=$BASEDIR/ccache
201 export CCACHE_HASHDIR
=1
203 # Remove pre-install list of installed files in case user erase some files before rebuild
204 rm -f $BASEDIR/build
/usr
/src
/lsalr
2>/dev
/null
208 LOGFILE
="$BASEDIR/log/_build.toolchain.log"
211 NATIVEGCC
=`gcc --version | grep GCC | awk {'print $3'}`
212 export NATIVEGCC GCCmajor
=${NATIVEGCC:0:1} GCCminor=${NATIVEGCC:2:1} GCCrelease=${NATIVEGCC:4:1}
214 lfsmake1 binutils PASS
=1
216 export PATH
=$BASEDIR/build
/usr
/local
/bin
:$BASEDIR/build
/tools
/bin
:$PATH
217 lfsmake1 linux-libc-header
219 lfsmake1 cleanup-toolchain PASS
=1
224 lfsmake1 binutils PASS
=2
243 lfsmake1 cleanup-toolchain PASS
=2
244 export PATH
=$ORG_PATH
248 LOGFILE
="$BASEDIR/log/_build.base.log"
252 lfsmake2 linux-libc-header
255 lfsmake2 cleanup-toolchain PASS
=3
311 LOGFILE
="$BASEDIR/log/_build.ipfire.log"
313 ipfiremake configroot
318 # Temporary disabled.
319 # ipfiremake linux-atm
323 ipfiremake linux PASS
=installer
324 ipfiremake linux PASS
=SMP
325 # ipfiremake 3cp4218 PASS=SMP
326 # ipfiremake amedyn PASS=SMP
327 # ipfiremake cxacru PASS=SMP
328 # ipfiremake eagle PASS=SMP
329 # ipfiremake cnx_pci PASS=SMP
330 # ipfiremake fcdsl PASS=SMP
331 # ipfiremake fcdsl2 PASS=SMP
332 # ipfiremake fcdslsl PASS=SMP
333 # ipfiremake fcdslusb PASS=SMP
334 # ipfiremake fcdslslusb PASS=SMP
335 # ipfiremake fcpci PASS=SMP
336 # ipfiremake fcclassic PASS=SMP
337 # ipfiremake pulsar PASS=SMP
338 # ipfiremake unicorn PASS=SMP
339 # ipfiremake promise-sata-300-tx PASS=SMP
346 # ipfiremake speedtouch
351 # ipfiremake fcdslusb
352 # ipfiremake fcdslslusb
354 # ipfiremake fcclassic
357 # ipfiremake promise-sata-300-tx
381 ipfiremake BerkeleyDB
## The Perl module
383 ipfiremake saslauthd PASS
=1
387 ipfiremake subversion
388 ipfiremake apache2 PASS
=CONFIG
392 ipfiremake capi4k-utils
395 ipfiremake dosfstools
397 ipfiremake ez-ipupdate
403 ipfiremake initscripts
410 ipfiremake l7-protocols
411 ipfiremake isapnptools
412 ipfiremake isdn4k-utils
417 ipfiremake misc-progs
423 ipfiremake HTML-Tagset
424 ipfiremake HTML-Parser
425 ipfiremake Compress-Zlib
427 ipfiremake Digest-SHA1
428 ipfiremake Digest-HMAC
429 ipfiremake libwww-perl
431 ipfiremake Net-IPv4Addr
432 ipfiremake Net_SSLeay
433 ipfiremake IO-Stringy
434 ipfiremake Unix-Syslog
435 ipfiremake Mail-Tools
436 ipfiremake MIME-Tools
437 ipfiremake Net-Server
438 ipfiremake Convert-TNEF
439 ipfiremake Convert-UUlib
440 ipfiremake Archive-Tar
441 ipfiremake Archive-Zip
442 ipfiremake Text-Tabs
+Wrap
443 ipfiremake Locale-Country
446 ipfiremake noip_updater
448 ipfiremake oinkmaster
451 ipfiremake pptpclient
457 ipfiremake squid-graph
458 ipfiremake squidguard
460 ipfiremake
traceroute
464 ipfiremake
3c5x9setup
466 ipfiremake startscripts
468 ipfiremake bootsplash
472 ipfiremake pkg-config
476 ipfiremake saslauthd PASS
=2
478 ipfiremake ghostscript
485 ipfiremake bridge-utils
488 ipfiremake smartmontools
499 ipfiremake spamassassin
517 ipfiremake applejuice
522 ipfiremake tcpwrapper
539 # Run installer scripts one by one
540 LOGFILE
="$BASEDIR/log/_build.installer.log"
548 installmake e2fsprogs
549 installmake misc-progs
551 installmake util-linux
554 installmake pcmcia-cs
556 installmake installer
558 installmake driver.img
564 LOGFILE
="$BASEDIR/log/_build.packages.log"
566 echo "... see detailed log in _build.*.log files" >> $LOGFILE
567 echo -ne "`date -u '+%b %e %T'`: Stage5 packages build \n" |
tee -a $LOGFILE
569 echo "`date -u '+%b %e %T'`: Stripping files" |
tee -a $LOGFILE
570 find $LFS/lib
$LFS/usr
/lib
$LFS/usr
/share
/rrdtool-
* $LFS/install ! -type l \
( -name '*.so' -o -name '*.so[\.0-9]*' \
) \
571 ! -name 'libc.so' ! -name 'libpthread.so' ! -name 'libcrypto.so.0.9.7.sha1' \
572 -exec $LFS/tools
/bin
/strip
--strip-all {} \
; >> $LOGFILE 2>&1
573 # add -ls before -exec if you want to verify what files are stripped
575 find $LFS/{,s
}bin
$LFS/usr
/{,s
}bin
$LFS/usr
/local
/{,s
}bin
! -type l \
576 -exec file {} \
; |
grep " ELF " | cut
-f1 -d ':' |
xargs $LFS/tools
/bin
/strip
--strip-all >> $LOGFILE 2>&1
577 # there add -v to strip to verify
579 if [ 'i386' = $MACHINE ]; then
580 # Create fcdsl packages
581 echo "`date -u '+%b %e %T'`: Building fcdsl tgz" |
tee -a $LOGFILE
582 cp $LFS/install
/images
/fcdsl
/license.txt
$LFS >> $LOGFILE 2>&1
583 touch $LFS/var
/run
/{need-depmod-
$KVER,need-depmod-
$KVER-smp}
584 cd $LFS && tar cvfz
$LFS/install
/images
/$SNAME-fcdsl-$VERSION.
$MACHINE.tgz \
585 lib
/modules
/$KVER/misc
/fcdsl
*.o.gz \
586 lib
/modules
/$KVER-smp/misc
/fcdsl
*.o.gz \
587 usr
/lib
/isdn
/{fds?base.bin
,fd?ubase.frm
} \
588 etc
/fcdsl
/fcdsl
*.conf \
589 etc
/drdsl
/{drdsl
,drdsl.ini
} \
591 var
/run
/{need-depmod-
$KVER,need-depmod-
$KVER-smp} >> $LOGFILE 2>&1
592 rm -f $LFS/license.txt
>> $LOGFILE 2>&1
596 # Generating list of packages used
597 echo "`date -u '+%b %e %T'`: Generating packages list from logs" |
tee -a $LOGFILE
598 rm -f $BASEDIR/doc
/packages-list
599 for i
in `ls -1tr $BASEDIR/log/[^_]*`; do
600 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
601 echo "* `basename $i`" >>$BASEDIR/doc
/packages-list
604 echo "== List of softwares used to build $NAME Version: $VERSION ==" > $BASEDIR/doc
/packages-list.txt
605 grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|ipfire$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$\|.tgz$\|-config$' \
606 $BASEDIR/doc
/packages-list |
sort >> $BASEDIR/doc
/packages-list.txt
607 rm -f $BASEDIR/doc
/packages-list
608 # packages-list.txt is ready to be displayed for wiki page
610 # Create ISO for CDROM
612 rm -f $LFS/install
/images
/*usb
*
613 cp $LFS/install
/images
/{*.iso
,*.tgz
} $BASEDIR >> $LOGFILE 2>&1
619 rm -rf $BASEDIR/build
/tmp
/*
621 # Generating total list of files
622 echo "`date -u '+%b %e %T'`: Generating files list from logs" |
tee -a $LOGFILE
623 rm -f $BASEDIR/log
/FILES
624 for i
in `ls -1tr $BASEDIR/log/[^_]*`; do
625 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
626 echo "##" >>$BASEDIR/log
/FILES
627 echo "## `basename $i`" >>$BASEDIR/log
/FILES
628 echo "##" >>$BASEDIR/log
/FILES
629 cat $i |
sed "s%^\./%#%" |
sort >> $BASEDIR/log
/FILES
632 cd $BASEDIR/packages
; ls -w1 *.ipfire |
awk -F ".ipfire" '{ print $1 }' > $BASEDIR/packages
/packages_list.txt
633 echo -n "###EOF###" >> $BASEDIR/packages
/packages_list.txt
640 if [ -d "$BASEDIR/packages" ]; then
641 for i
in `ls $BASEDIR/packages`; do
642 touch $BASEDIR/build
/install
/packages
/$i.empty
646 ipfiredist applejuice
673 ipfiredist spamassassin
674 ipfiredist subversion
679 test -d $BASEDIR/packages || mkdir
$BASEDIR/packages
680 mv -f $LFS/install
/packages
/*.
{ipfire
,md5
} $BASEDIR/packages
>> $LOGFILE 2>&1
681 rm -rf $BASEDIR/build
/install
/packages
/*
684 # See what we're supposed to do
688 BUILDMACHINE
=`uname -m`
689 PACKAGE
=`ls -v -r $BASEDIR/cache/toolchains/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz 2> /dev/null | head -n 1`
690 #only restore on a clean disk
691 if [ ! -f log
/cleanup-toolchain-2-tools
]; then
692 if [ ! -n "$PACKAGE" ]; then
693 beautify build_stage
"Full toolchain compilation - Native GCC: `gcc --version | grep GCC | awk {'print $3'}`"
697 PACKAGENAME
=${PACKAGE%.tar.gz}
698 beautify build_stage
"Packaged toolchain compilation"
699 if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then
703 exiterror
"$PACKAGENAME md5 did not match, check downloaded package"
707 echo -n "Using installed toolchain" |
tee -a $LOGFILE
708 beautify message SKIP
712 beautify build_stage
"Building base"
715 beautify build_stage
"Building IPFire"
718 # Setzen des IPFire Builds
719 if [ "$FIREBUILD" ]; then
720 echo "$FIREBUILD" > $BASEDIR/build
/var
/ipfire
/firebuild
722 echo "_(OvO)_" > $BASEDIR/build
/var
/ipfire
/firebuild
725 beautify build_stage
"Building installer"
728 beautify build_stage
"Building packages"
732 # enter a shell inside LFS chroot
733 # may be used to changed kernel settings
738 echo -n "Loading new Changelog from SVN: "
739 svn log http
://svn.ipfire.eu
/svn
/ipfire
> doc
/ChangeLog
743 for i
in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do
744 $LOSETUP -d $i 2>/dev
/null
746 for i
in `mount | grep $BASEDIR | cut -d " " -f 1`; do
750 for i
in `seq 0 7`; do
751 if ( losetup
/dev
/loop
${i} 2>/dev
/null |
grep -q "/install/images" ); then
752 umount
/dev
/loop
${i} 2>/dev
/null
;
753 losetup
-d /dev
/loop
${i} 2>/dev
/null
;
756 rm -rf $BASEDIR/build
757 rm -rf $BASEDIR/cdrom
758 rm -rf $BASEDIR/packages
760 if [ -h /tools
]; then
765 # create structure for a new package
766 echo -e "Name of the new package: $2"
767 if [ ! -f "lfs/$2" ]; then
768 echo "`date -u '+%b %e %T'`: Creating directory src/paks/$2"
771 echo "`date -u '+%b %e %T'`: Creating files"
772 cp $BASEDIR/lfs
/postfix
$BASEDIR/lfs
/$2
775 touch {,un
}install.sh
777 echo '#!/bin/bash' > install.sh
778 echo '#' >> install.sh
779 echo '#################################################################' >> install.sh
780 echo '# #' >> install.sh
781 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> install.sh
782 echo '# #' >> install.sh
783 echo '#################################################################' >> install.sh
784 echo '#' >> install.sh
785 echo '# Extract the files' >> install.sh
786 echo 'tar xfz files.tgz -C /' >> install.sh
787 echo 'cp -f ROOTFILES /opt/pakfire/installed/ROOTFILES.$2' >> install.sh
789 echo '#!/bin/bash' > uninstall.sh
790 echo '#################################################################' >> uninstall.sh
791 echo '# #' >> uninstall.sh
792 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> uninstall.sh
793 echo '# #' >> uninstall.sh
794 echo '#################################################################' >> uninstall.sh
795 echo '#' >> uninstall.sh
796 echo '# Delete the files' >> uninstall.sh
797 echo '## Befehl fehlt noch' >> uninstall.sh
798 echo 'rm -f /opt/pakfire/installed/ROOTFILES.$2' >> uninstall.sh
799 echo "`date -u '+%b %e %T'`: Adding files to SVN"
800 cd - && svn add lfs
/$2 && svn add src
/paks
/$2
802 echo -n "Do you want to remove the folders? [y/n]"
804 if [ "$REM" == "y" ]; then
805 echo "Removing the folders..."
806 svn del src
/paks
/$2 --force
808 echo "Folders are kept."
811 echo "$2 already exists"
816 if [ ! -d $BASEDIR/cache
]; then
819 mkdir
-p $BASEDIR/log
820 echo -e "${BOLD}Preload all source files${NORMAL}" |
tee -a $LOGFILE
823 for c
in `seq $MAX_RETRIES`; do
824 if (( FINISHED
==1 )); then
830 if [ -f "$i" -a "$i" != "Config" ]; then
831 echo -ne "Loading $i"
832 make -s -f $i LFS_BASEDIR
=$BASEDIR MESSAGE
="$i\t ($c/$MAX_RETRIES)" download
>> $LOGFILE 2>&1
833 if [ $?
-ne 0 ]; then
834 beautify message FAIL
837 if [ $c -eq 1 ]; then
838 beautify message DONE
844 echo -e "${BOLD}***Verifying md5sums${NORMAL}"
847 if [ -f "$i" -a "$i" != "Config" ]; then
848 make -s -f $i LFS_BASEDIR
=$BASEDIR MESSAGE
="$i\t " md5
>> $LOGFILE 2>&1
849 if [ $?
-ne 0 ]; then
850 echo -ne "MD5 difference in lfs/$i"
851 beautify message FAIL
856 if [ $ERROR -eq 0 ]; then
857 echo -ne "${BOLD}all files md5sum match${NORMAL}"
858 beautify message DONE
860 echo -ne "${BOLD}not all files were correctly download${NORMAL}"
861 beautify message FAIL
868 beautify build_stage
"Toolchain compilation - Native GCC: `gcc --version | grep GCC | awk {'print $3'}`"
870 BUILDMACHINE
=`uname -m`
871 echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for $BUILDMACHINE" |
tee -a $LOGFILE
872 test -d $BASEDIR/cache
/toolchains || mkdir
$BASEDIR/cache
/toolchains
873 cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache
/toolchains
/$SNAME-$VERSION-toolchain-$BUILDMACHINE.
tar.gz \
874 build
/{bin
,etc
,usr
/bin
,usr
/local} \
875 build
/tools
/{bin
,etc
,*-linux-gnu,include
,lib
,libexec
,sbin
,share
,var
} \
877 md5sum cache
/toolchains
/$SNAME-$VERSION-toolchain-$BUILDMACHINE.
tar.gz \
878 > cache
/toolchains
/$SNAME-$VERSION-toolchain-$BUILDMACHINE.md5
882 BUILDMACHINE
=`uname -m`
883 # arbitrary name to be updated in case of new toolchain package upload
884 PACKAGE
=$SNAME-$VERSION-toolchain-$BUILDMACHINE
885 if [ ! -f $BASEDIR/cache
/toolchains
/$PACKAGE.
tar.gz
]; then
886 URL_IPFIRE
=`grep URL_IPFIRE lfs/Config | awk '{ print $3 }'`
887 test -d $BASEDIR/cache
/toolchains || mkdir
$BASEDIR/cache
/toolchains
888 echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for $BUILDMACHINE" |
tee -a $LOGFILE
889 cd $BASEDIR/cache
/toolchains
890 wget
$URL_IPFIRE/toolchains
/$PACKAGE.
tar.gz
$URL_IPFIRE/toolchains
/$PACKAGE.md5
>& /dev
/null
891 if [ $?
-ne 0 ]; then
892 echo "`date -u '+%b %e %T'`: error downloading toolchain for $BUILDMACHINE machine" |
tee -a $LOGFILE
894 if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then
895 echo "`date -u '+%b %e %T'`: toolchain md5 ok" |
tee -a $LOGFILE
897 exiterror
"$PACKAGE.md5 did not match, check downloaded package"
901 echo "Toolchain is already downloaded. Exiting..."
906 echo -ne "`date -u '+%b %e %T'`: Build sources iso for $MACHINE" |
tee -a $LOGFILE
907 chroot
$LFS /tools
/bin
/env
-i HOME
=/root \
908 TERM
=$TERM PS1
='\u:\w\$ ' \
909 PATH
=/usr
/local
/bin
:/bin
:/usr
/bin
:/sbin
:/usr
/sbin \
910 VERSION
=$VERSION NAME
="$NAME" SNAME
="$SNAME" MACHINE
=$MACHINE \
911 /bin
/bash
-x -c "cd /usr/src/lfs && make -f sources-iso LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
912 mv $LFS/install
/images
/ipfire-
* $BASEDIR >> $LOGFILE 2>&1
913 if [ $?
-eq "0" ]; then
914 beautify message DONE
916 beautify message FAIL
924 echo -ne "Loading the latest source files...\n"
926 svn update
-r $3 |
tee -a $PWD/log
/_build.svn.update.log
928 svn update |
tee -a $PWD/log
/_build.svn.update.log
930 if [ $?
-eq "0" ]; then
931 beautify message DONE
933 beautify message FAIL
936 echo -ne "Writing the svn-info to a file"
937 svn info
> $PWD/svn_status
938 if [ $?
-eq "0" ]; then
939 beautify message DONE
941 beautify message FAIL
949 if [ -e /sbin
/yast
]; then
950 if [ "`echo $SVN_REVISION | cut -c 3`" -eq "0" ]; then
954 echo "Upload the changed files..."
963 if [ -f ipfire-source-r
$SVN_REVISION.
tar.gz
]; then
964 echo -ne "REV $SVN_REVISION: SKIPPED!\n"
967 echo -en "REV $SVN_REVISION: Downloading..."
968 svn
export http
://svn.ipfire.eu
/svn
/ipfire
/trunk ipfire-source
/ --force > /dev
/null
969 svn log http
://svn.ipfire.eu
/svn
/ipfire
/trunk
-r 1:$SVN_REVISION > ipfire-source
/Changelog
970 #svn info http://svn.ipfire.eu/svn/ipfire/trunk -r $SVN_REVISION > ipfire-source/svn_status
973 echo -en "REV $SVN_REVISION: Compressing files..."
974 if [ -e ipfire-source
/trunk
/make.sh
]; then
975 chmod 755 ipfire-source
/trunk
/make.sh
977 tar cfz ipfire-source-r
$SVN_REVISION.
tar.gz ipfire-source
979 echo -en "REV $SVN_REVISION: Cleaning up..."
984 echo -ne "Make a local diff to last svn revision"
985 svn
diff > ipfire-diff-
`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.
diff
987 echo "Diff was successfully saved to ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff"
994 echo -e "Uploading cache to ftp server:"
995 ncftpls
-u $IPFIRE_FTP_USER_INT -p $IPFIRE_FTP_PASS_INT ftp://$IPFIRE_FTP_URL_INT$IPFIRE_FTP_PATH_INT/ > /var
/tmp
/ftplist
997 if [ "$i" == "toolchains" ]; then continue; fi
998 grep -q $i /var
/tmp
/ftplist
999 if [ "$?" -ne "0" ]; then
1001 ncftpput
-bb -u $IPFIRE_FTP_USER_INT -p $IPFIRE_FTP_PASS_INT $IPFIRE_FTP_URL_INT $IPFIRE_FTP_PATH_INT/ $i > /dev
/null
2>&1
1002 if [ "$?" -eq "0" ]; then
1003 beautify message DONE
1005 beautify message FAIL
1009 rm -f /var
/tmp
/ftplist
1010 UL_TIME_START
=`date +'%s'`
1011 ncftpbatch
-d > /dev
/null
2>&1
1012 while ps acx |
grep -q ncftpbatch
1014 UL_TIME
=$
(expr `date +'%s'` - $UL_TIME_START)
1015 echo -ne "\r ${UL_TIME}s : Upload is running..."
1018 beautify message DONE
1025 echo -e "Uploading the iso to $IPFIRE_FTP_URL_EXT."
1026 cat <<EOF > .ftp-commands
1027 mkdir $IPFIRE_FTP_PATH_EXT
1031 ncftp
-u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT < .ftp-commands
1033 md5sum ipfire-install-
$VERSION.i386.iso
> ipfire-install-
$VERSION.i386.iso.md5
1034 ncftpput
-u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT $IPFIRE_FTP_PATH_EXT/ ipfire-install-
$VERSION.i386.iso
1035 ncftpput
-u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT $IPFIRE_FTP_PATH_EXT/ ipfire-install-
$VERSION.i386.iso.md5
1036 ncftpput
-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
1037 ncftpput
-u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT $IPFIRE_FTP_PATH_EXT/ svn_status
1038 if [ "$?" -eq "0" ]; then
1039 echo -e "The iso of Revision $SVN_REVISION was successfully uploaded to $IPFIRE_FTP_URL_EXT$IPFIRE_FTP_PATH_EXT/."
1041 echo -e "There was an error while uploading the iso to the ftp server."
1044 if [ "$3" = "--with-sources-cd" ]; then
1045 ncftpput
-u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT $IPFIRE_FTP_PATH_EXT/ ipfire-sources-cd-
$VERSION.
$MACHINE.iso
1049 cat <<EOF > .ftp-commands
1050 mkdir $IPFIRE_FTP_PATH_PAK
1054 ncftp
-u $IPFIRE_FTP_USER_PAK -p $IPFIRE_FTP_PASS_PAK $IPFIRE_FTP_URL_PAK < .ftp-commands
1056 ncftpput
-z -u $IPFIRE_FTP_USER_PAK -p $IPFIRE_FTP_PASS_PAK $IPFIRE_FTP_URL_PAK $IPFIRE_FTP_PATH_PAK/ packages
/*
1057 if [ "$?" -eq "0" ]; then
1058 echo -e "The packages were successfully uploaded to $IPFIRE_FTP_URL_PAK$IPFIRE_FTP_PATH_PAK/."
1060 echo -e "There was an error while uploading the packages to the ftp server."
1067 if [ "$2" -eq "--background" ]; then
1071 if [ `screen -ls | grep -q ipfire` ]; then
1072 echo "Build is already running, sorry!"
1075 if [ "$2" = "--rebuild" ]; then
1076 export IPFIRE_REBUILD
=1
1079 export IPFIRE_REBUILD
=0
1081 echo -en "${BOLD}***IPFire-Batch-Build is starting...${NORMAL}"
1082 screen
-dmS ipfire
$0 batch --background
1093 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"
1099 "IPFIRE: Build (silent)")
1102 "IPFIRE: Watch Build")
1112 if [ -f /usr
/bin
/mcedit
]; then
1113 export EDITOR
=/usr
/bin
/mcedit
1115 if [ -f /usr
/bin
/nano
]; then
1116 export EDITOR
=/usr
/bin
/nano
1125 svn status
# | grep -v ^?
1131 echo "Usage: $0 {build|changelog|clean|gettoolchain|newpak|prefetch|shell|sync|toolchain}"
1132 cat doc
/make.sh-usage