3 ############################################################################
5 # This file is part of the IPFire Firewall. #
7 # IPFire is free software; you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation; either version 2 of the License, or #
10 # (at your option) any later version. #
12 # IPFire is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with IPFire; if not, write to the Free Software #
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
21 # Copyright (C) 2006 IPFire-Team <entwickler@ipfire.org>. #
23 ############################################################################
26 NAME
="IPFire" # Software name
27 SNAME
="ipfire" # Short name
28 VERSION
="2.0" # Version number
29 SLOGAN
="www.ipfire.org" # Software slogan
30 CONFIG_ROOT
=/var
/ipfire
# Configuration rootdir
32 MAX_RETRIES
=3 # prefetch/check loop
33 KVER
=`grep --max-count=1 VER lfs/linux | awk '{ print $3 }'`
36 # Setzen des IPFire Builds
37 if [ -e .
/.svn
]; then
38 FIREBUILD
=`cat .svn/entries |sed -n 's/^[ \t]*revision=\"// p' | sed -n 's/\".*$// p'`
39 # VERSION="$VERSION (Build:$FIREBUILD)"
42 # Debian specific settings
43 if [ ! -e /etc
/debian_version
]; then
46 if [ -x /usr
/bin
/realpath
]; then
47 FULLPATH
=`/usr/bin/realpath $0`
49 echo "ERROR: Need to do apt-get install realpath"
55 BASENAME
=`basename $0`
56 BASEDIR
=`echo $FULLPATH | sed "s/\/$BASENAME//g"`
57 LOGFILE
=$BASEDIR/log
/_build.preparation.log
58 export BASEDIR LOGFILE
59 DIR_CHK
=$BASEDIR/cache
/check
60 mkdir
$BASEDIR/log
/ 2>/dev
/null
62 if [ 'x86_64' = $MACHINE -o 'i686' = $MACHINE -o 'i586' = $MACHINE -o 'i486' = $MACHINE -o 'i386' = $MACHINE ]; then
63 echo "`date -u '+%b %e %T'`: Machine is ix86 (or equivalent)" >> $LOGFILE
65 BUILDTARGET
=i386-pc-linux-gnu
66 CFLAGS
="-O2 -mcpu=i386 -march=i386 -pipe -fomit-frame-pointer"
67 CXXFLAGS
="-O2 -mcpu=i386 -march=i386 -pipe -fomit-frame-pointer"
68 elif [ 'alpha' = $MACHINE ]; then
69 echo "`date -u '+%b %e %T'`: Machine is Alpha AXP" >> $LOGFILE
70 BUILDTARGET
=alpha-unknown-linux-gnu
71 CFLAGS
="-O2 -mcpu=ev4 -mieee -pipe"
72 CXXFLAGS
="-O2 -mcpu=ev4 -mieee -pipe"
74 echo "`date -u '+%b %e %T'`: Can't determine your architecture - $MACHINE" >> $LOGFILE
80 umount
$BASEDIR/build
/dev
/pts
2>/dev
/null
;
81 umount
$BASEDIR/build
/proc
2>/dev
/null
;
82 umount
$BASEDIR/build
/install
/mnt
2>/dev
/null
;
83 umount
$BASEDIR/build
/usr
/src
/cache
2>/dev
/null
;
84 umount
$BASEDIR/build
/usr
/src
/ccache
2>/dev
/null
;
85 umount
$BASEDIR/build
/usr
/src
/config
2>/dev
/null
;
86 umount
$BASEDIR/build
/usr
/src
/doc
2>/dev
/null
;
87 umount
$BASEDIR/build
/usr
/src
/html
2>/dev
/null
;
88 umount
$BASEDIR/build
/usr
/src
/langs
2>/dev
/null
;
89 umount
$BASEDIR/build
/usr
/src
/lfs
2>/dev
/null
;
90 umount
$BASEDIR/build
/usr
/src
/log
2>/dev
/null
;
91 umount
$BASEDIR/build
/usr
/src
/src
2>/dev
/null
;
96 for i
in `seq 0 7`; do
97 if ( losetup
/dev
/loop
${i} 2>/dev
/null |
grep -q "/install/images" ); then
98 losetup
-d /dev
/loop
${i} 2>/dev
/null
102 echo " Check $LOGFILE for errors if applicable"
107 if [ ! -e $BASEDIR/build
/usr
/src
/lfs
/ ]; then
108 exiterror
"No such file or directory: $BASEDIR/build/usr/src/lfs/"
110 echo "Entering to a shell inside LFS chroot, go out with exit"
111 chroot
$LFS /tools
/bin
/env
-i HOME
=/root TERM
=$TERM PS1
='\u:\w\$ ' \
112 PATH
=/usr
/local
/bin
:/bin
:/usr
/bin
:/sbin
:/usr
/sbin
:/tools
/bin \
113 VERSION
=$VERSION CONFIG_ROOT
=$CONFIG_ROOT \
114 NAME
="$NAME" SNAME
="$SNAME" SLOGAN
="$SLOGAN" \
115 CFLAGS
="$CFLAGS" CXXFLAGS
="$CXXFLAGS" \
116 CCACHE_DIR
=/usr
/src
/ccache \
119 BUILDTARGET
="$BUILDTARGET" MACHINE
="$MACHINE" \
120 KGCC
="ccache /usr/bin/gcc" \
122 if [ $?
-ne 0 ]; then
123 exiterror
"chroot error"
130 ############################################################################
132 # Are we running the right shell? #
134 ############################################################################
135 if [ ! "$BASH" ]; then
136 exiterror
"BASH environment variable is not set. You're probably running the wrong shell."
139 if [ -z "${BASH_VERSION}" ]; then
140 exiterror
"Not running BASH shell."
144 ############################################################################
146 # Trap on emergency exit #
148 ############################################################################
149 trap "exiterror 'Build process interrupted'" SIGINT SIGTERM SIGKILL SIGSTOP SIGQUIT
152 ############################################################################
154 # Resetting our nice level #
156 ############################################################################
157 echo "`date -u '+%b %e %T'`: Resetting our nice level to $NICE" |
tee -a $LOGFILE
158 renice
$NICE $$
> /dev
/null
159 if [ `nice` != "$NICE" ]; then
160 exiterror
"Failed to set correct nice level"
163 ############################################################################
165 # Checking if running as root user #
167 ############################################################################
168 echo "`date -u '+%b %e %T'`: Checking if we're running as root user" |
tee -a $LOGFILE
169 if [ `id -u` != 0 ]; then
170 exiterror
"Not building as root"
174 ############################################################################
176 # Checking for necessary temporary space #
178 ############################################################################
179 echo "`date -u '+%b %e %T'`: Checking for necessary space on disk $BASE_DEV" |
tee -a $LOGFILE
180 BASE_DEV
=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $1 }'`
181 BASE_ASPACE
=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $4 }'`
182 if (( 2202000 > $BASE_ASPACE )); then
183 BASE_USPACE
=`du -skx $BASEDIR | awk '{print $1}'`
184 if (( 2202000 - $BASE_USPACE > $BASE_ASPACE )); then
185 exiterror
"Not enough temporary space available, need at least 2.1GB on $BASE_DEV"
189 ############################################################################
191 # Building Linux From Scratch system #
193 ############################################################################
194 echo "`date -u '+%b %e %T'`: Building Linux From Scratch system" |
tee -a $LOGFILE
202 # Check /tools symlink
203 if [ -h /tools
]; then
206 if [ ! -a /tools
]; then
207 ln -s $BASEDIR/build
/tools
/
209 if [ ! -h /tools
]; then
210 exiterror
"Could not create /tools symbolic link."
216 export LFS LC_ALL CFLAGS CXXFLAGS
217 unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
219 # Make some extra directories
220 mkdir
-p $BASEDIR/build
/{tools
,etc
,usr
/src
} 2>/dev
/null
221 mkdir
-p $BASEDIR/{cache
,ccache
} 2>/dev
/null
222 mkdir
-p $BASEDIR/build
/dev
/pts
$BASEDIR/build
/proc
$BASEDIR/build
/usr
/src
/{cache
,config
,doc
,html
,langs
,lfs
,log
,src
,ccache
}
224 # Make all sources and proc available under lfs build
225 mount
--bind /dev
/pts
$BASEDIR/build
/dev
/pts
226 mount
--bind /proc
$BASEDIR/build
/proc
227 mount
--bind $BASEDIR/cache
$BASEDIR/build
/usr
/src
/cache
228 mount
--bind $BASEDIR/ccache
$BASEDIR/build
/usr
/src
/ccache
229 mount
--bind $BASEDIR/config
$BASEDIR/build
/usr
/src
/config
230 mount
--bind $BASEDIR/doc
$BASEDIR/build
/usr
/src
/doc
231 mount
--bind $BASEDIR/html
$BASEDIR/build
/usr
/src
/html
232 mount
--bind $BASEDIR/langs
$BASEDIR/build
/usr
/src
/langs
233 mount
--bind $BASEDIR/lfs
$BASEDIR/build
/usr
/src
/lfs
234 mount
--bind $BASEDIR/log
$BASEDIR/build
/usr
/src
/log
235 mount
--bind $BASEDIR/src
$BASEDIR/build
/usr
/src
/src
237 # Run LFS static binary creation scripts one by one
238 export CCACHE_DIR
=$BASEDIR/ccache
239 export CCACHE_HASHDIR
=1
241 # Remove pre-install list of installed files in case user erase some files before rebuild
242 rm -f $BASEDIR/build
/usr
/src
/lsalr
2>/dev
/null
246 ############################################################################
248 # Necessary shell functions #
250 ############################################################################
252 if [ -f $BASEDIR/lfs
/$1 ]; then
253 echo "`date -u '+%b %e %T'`: Building $*" |
tee -a $LOGFILE
254 cd $BASEDIR/lfs
&& make -s -f $
* LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t " download
>> $LOGFILE 2>&1
255 if [ $?
-ne 0 ]; then
256 exiterror
"Download error in $1"
258 cd $BASEDIR/lfs
&& make -s -f $
* LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t md5sum" md5
>> $LOGFILE 2>&1
259 if [ $?
-ne 0 ]; then
260 exiterror
"md5sum error in $1, check file in cache or signature"
262 cd $BASEDIR/lfs
&& make -f $
* BUILDTARGET
=$BUILDTARGET \
264 LFS_BASEDIR
=$BASEDIR \
267 install >> $LOGFILE 2>&1
268 if [ $?
-ne 0 ]; then
269 exiterror
"Building $*";
272 exiterror
"No such file or directory: $BASEDIR/$1"
278 if [ -f $BASEDIR/build
/usr
/src
/lfs
/$1 ]; then
279 echo "`date -u '+%b %e %T'`: Building $*" |
tee -a $LOGFILE
280 cd $BASEDIR/lfs
&& make -s -f $
* LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t " download
>> $LOGFILE 2>&1
281 if [ $?
-ne 0 ]; then
282 exiterror
"Download error in $1"
284 cd $BASEDIR/lfs
&& make -s -f $
* LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t md5sum" md5
>> $LOGFILE 2>&1
285 if [ $?
-ne 0 ]; then
286 exiterror
"md5sum error in $1, check file in cache or signature"
288 chroot
$LFS /tools
/bin
/env
-i HOME
=/root \
289 TERM
=$TERM PS1
='\u:\w\$ ' \
290 PATH
=/usr
/local
/bin
:/bin
:/usr
/bin
:/sbin
:/usr
/sbin
:/tools
/bin \
292 CONFIG_ROOT
=$CONFIG_ROOT \
293 NAME
="$NAME" SNAME
="$SNAME" SLOGAN
="$SLOGAN" \
294 CFLAGS
="$CFLAGS" CXXFLAGS
="$CXXFLAGS" \
295 CCACHE_DIR
=/usr
/src
/ccache CCACHE_HASHDIR
=1 \
297 BUILDTARGET
="$BUILDTARGET" MACHINE
="$MACHINE" \
298 /tools
/bin
/bash
-x -c "cd /usr/src/lfs && \
299 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
300 if [ $?
-ne 0 ]; then
301 exiterror
"Building $*"
304 exiterror
"No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
310 if [ -f $BASEDIR/build
/usr
/src
/lfs
/$1 ]; then
311 echo "`date -u '+%b %e %T'`: Building $*" |
tee -a $LOGFILE
312 cd $BASEDIR/lfs
&& make -s -f $
* LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t " download
>> $LOGFILE 2>&1
313 if [ $?
-ne 0 ]; then
314 exiterror
"Download error in $1"
316 cd $BASEDIR/lfs
&& make -s -f $
* LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t md5sum" md5
>> $LOGFILE 2>&1
317 if [ $?
-ne 0 ]; then
318 exiterror
"md5sum error in $1, check file in cache or signature"
320 chroot
$LFS /tools
/bin
/env
-i HOME
=/root \
321 TERM
=$TERM PS1
='\u:\w\$ ' \
322 PATH
=/usr
/local
/bin
:/bin
:/usr
/bin
:/sbin
:/usr
/sbin \
324 CONFIG_ROOT
=$CONFIG_ROOT \
325 NAME
="$NAME" SNAME
="$SNAME" SLOGAN
="$SLOGAN" \
326 CFLAGS
="$CFLAGS" CXXFLAGS
="$CXXFLAGS" \
327 CCACHE_DIR
=/usr
/src
/ccache CCACHE_HASHDIR
=1 \
329 BUILDTARGET
="$BUILDTARGET" MACHINE
="$MACHINE" \
330 /bin
/bash
-x -c "cd /usr/src/lfs && \
331 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
332 if [ $?
-ne 0 ]; then
333 exiterror
"Building $*"
336 exiterror
"No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
342 if [ -f $BASEDIR/build
/usr
/src
/lfs
/$1 ]; then
343 # if [ ! `ls -w1 $BASEDIR/packages/*.tar.gz | grep $1` ]; then
344 echo "`date -u '+%b %e %T'`: Packaging $1" |
tee -a $LOGFILE
345 chroot
$LFS /tools
/bin
/env
-i HOME
=/root \
346 TERM
=$TERM PS1
='\u:\w\$ ' \
347 PATH
=/usr
/local
/bin
:/bin
:/usr
/bin
:/sbin
:/usr
/sbin \
349 CONFIG_ROOT
=$CONFIG_ROOT \
350 NAME
="$NAME" SNAME
="$SNAME" SLOGAN
="$SLOGAN" \
351 CFLAGS
="$CFLAGS" CXXFLAGS
="$CXXFLAGS" \
352 CCACHE_DIR
=/usr
/src
/ccache CCACHE_HASHDIR
=1 \
354 BUILDTARGET
="$BUILDTARGET" MACHINE
="$MACHINE" \
355 /bin
/bash
-x -c "cd /usr/src/lfs && \
356 make -f $1 LFS_BASEDIR=/usr/src dist" >>$LOGFILE 2>&1
357 if [ $?
-ne 0 ]; then
358 exiterror
"Packaging $1"
361 # echo "`date -u '+%b %e %T'`: Packaging: The package $1 already exists"
364 exiterror
"No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
371 if [ -f $BASEDIR/build
/usr
/src
/lfs
/$1 ]; then
372 echo "`date -u '+%b %e %T'`: Building $*" |
tee -a $LOGFILE
373 cd $BASEDIR/lfs
&& make -s -f $
* LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t " download
>> $LOGFILE 2>&1
374 if [ $?
-ne 0 ]; then
375 exiterror
"Download error in $1"
377 cd $BASEDIR/lfs
&& make -s -f $
* LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t md5sum" md5
>> $LOGFILE 2>&1
378 if [ $?
-ne 0 ]; then
379 exiterror
"md5sum error in $1, check file in cache or signature"
381 chroot
$LFS /tools
/bin
/env
-i HOME
=/root \
382 TERM
=$TERM PS1
='\u:\w\$ ' \
383 PATH
=/usr
/local
/bin
:/opt
/$MACHINE-uClibc/usr
/bin
:/bin
:/usr
/bin
:/sbin
:/usr
/sbin \
385 CONFIG_ROOT
=$CONFIG_ROOT \
387 NAME
="$NAME" SNAME
="$SNAME" SLOGAN
="$SLOGAN" \
388 CFLAGS
="-Os" CXXFLAGS
="-Os" \
389 CCACHE_DIR
=/usr
/src
/ccache CCACHE_HASHDIR
=1 \
391 BUILDTARGET
="$BUILDTARGET" MACHINE
="$MACHINE" \
392 /bin
/bash
-x -c "cd /usr/src/lfs && \
393 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
394 if [ $?
-ne 0 ]; then
395 exiterror
"Building $*"
398 exiterror
"No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
404 LOGFILE
="$BASEDIR/log/_build.toolchain.log"
406 echo -ne "`date -u '+%b %e %T'`: Stage1 toolchain build \n" |
tee -a $LOGFILE
407 # Build sed now, as we use some extensions
409 NATIVEGCC
=`gcc --version | grep GCC | awk {'print $3'}`
410 export NATIVEGCC GCCmajor
=${NATIVEGCC:0:1} GCCminor=${NATIVEGCC:2:1} GCCrelease=${NATIVEGCC:4:1}
412 lfsmake1
sed LFS_PASS
=1
413 lfsmake1
m4 LFS_PASS
=1
414 lfsmake1 bison LFS_PASS
=1
415 lfsmake1 flex LFS_PASS
=1
416 lfsmake1 binutils LFS_PASS
=1
417 lfsmake1 gcc LFS_PASS
=1
418 export PATH
=$BASEDIR/build
/usr
/local
/bin
:$BASEDIR/build
/tools
/bin
:$PATH
425 lfsmake1 gcc LFS_PASS
=2
426 lfsmake1 binutils LFS_PASS
=2
435 lfsmake1
sed LFS_PASS
=2
436 lfsmake1
m4 LFS_PASS
=2
437 lfsmake1 bison LFS_PASS
=2
438 lfsmake1 flex LFS_PASS
=2
447 export PATH
=$ORG_PATH
451 LOGFILE
="$BASEDIR/log/_build.base.log"
453 echo -ne "`date -u '+%b %e %T'`: Stage2 linux base build \n" |
tee -a $LOGFILE
454 # Run LFS dynamic binary creation scripts one by one
492 if [ 'i386' = $MACHINE ]; then
494 elif [ 'alpha' = $MACHINE ]; then
513 # Run IPFire make scripts one by one
514 LOGFILE
="$BASEDIR/log/_build.ipfire.log"
516 echo -ne "`date -u '+%b %e %T'`: Stage3 $NAME build \n" |
tee -a $LOGFILE
518 # Build these first as some of the kernel packages below rely on
519 # these for some of their client program functionality
530 if [ 'i386' = $MACHINE ]; then
531 # abuse the SMP flag, and make an minimal installer kernel first
532 # so that the boot floppy always works.....
533 ipcopmake linux LFS_PASS
=ipfire SMP
=installer
534 ipcopmake linux LFS_PASS
=ipfire SMP
=1
535 ipcopmake
3cp4218 SMP
=1
536 ipcopmake amedyn SMP
=1
537 ipcopmake cxacru SMP
=1
538 ipcopmake eagle SMP
=1
540 # These are here because they have i386 only binary libraries
541 # included in the package.
542 ipcopmake cnx_pci SMP
=1
543 ipcopmake fcdsl SMP
=1
544 ipcopmake fcdsl2 SMP
=1
545 ipcopmake fcdslsl SMP
=1
546 ipcopmake fcdslusb SMP
=1
547 ipcopmake fcdslslusb SMP
=1
548 ipcopmake fcpci SMP
=1
549 ipcopmake fcclassic SMP
=1
550 ipcopmake pulsar SMP
=1
551 ipcopmake unicorn SMP
=1
552 ipcopmake promise-sata-300-tx SMP
=1
555 ipcopmake linux LFS_PASS
=ipfire
562 if [ 'i386' = $MACHINE ]; then
563 # These are here because they have i386 only binary libraries
564 # included in the package.
575 ipcopmake promise-sata-300-tx
597 ipcopmake capi4k-utils
602 ipcopmake ez-ipupdate
608 ipcopmake initscripts
615 ipcopmake l7-protocols
616 ipcopmake isapnptools
617 ipcopmake isdn4k-utils
628 ipcopmake HTML-Tagset
629 ipcopmake HTML-Parser
630 ipcopmake Compress-Zlib
632 ipcopmake Digest-SHA1
633 ipcopmake Digest-HMAC
634 ipcopmake libwww-perl
636 ipcopmake Net-IPv4Addr
639 ipcopmake Unix-Syslog
643 ipcopmake Convert-TNEF
644 ipcopmake Convert-UUlib
645 ipcopmake Archive-Tar
646 ipcopmake Archive-Zip
647 ipcopmake Text-Tabs
+Wrap
648 ipcopmake Locale-Country
652 ipcopmake BerkeleyDB
## The Perl module
653 ipcopmake noip_updater
664 ipcopmake saslauthd PASS
=1
667 ipcopmake squid-graph
675 # echo -ne "`date -u '+%b %e %T'`: Building ### IPFire modules ### \n" | tee -a $LOGFILE
677 ipcopmake startscripts
678 ## Zuerst die Libs und dann die Programme. Ordnung muss sein!
695 ipcopmake saslauthd PASS
=2
697 ipcopmake ghostscript
699 # ipcopmake lpd ## Im Moment aus, da CUPS vorhanden ist.
707 ipcopmake bridge-utils
710 ipcopmake smartmontools
713 echo -ne "`date -u '+%b %e %T'`: Building ### Mailserver ### \n" |
tee -a $LOGFILE
722 ipcopmake spamassassin
724 echo -ne "`date -u '+%b %e %T'`: Building ### VoIP-Server ### \n" |
tee -a $LOGFILE
731 echo -ne "`date -u '+%b %e %T'`: Building ### MP3-Server ### \n" |
tee -a $LOGFILE
734 echo -ne "`date -u '+%b %e %T'`: Building ### P2P-Clients ### \n" |
tee -a $LOGFILE
738 # ipcopmake edonkeyclc
740 echo -ne "`date -u '+%b %e %T'`: Building ### Net-Tools ### \n" |
tee -a $LOGFILE
753 # ipcopmake stunnel # Ausgeschaltet, weil wir es doch nicht nutzen
757 # Run installer scripts one by one
758 LOGFILE
="$BASEDIR/log/_build.installer.log"
760 echo -ne "`date -u '+%b %e %T'`: Stage4 installer build \n" |
tee -a $LOGFILE
761 if [ 'i386' = $MACHINE ]; then
769 installmake e2fsprogs
770 installmake misc-progs
772 installmake util-linux
775 installmake pcmcia-cs
777 installmake installer
779 installmake driver.img
785 LOGFILE
="$BASEDIR/log/_build.packages.log"
787 echo "... see detailed log in _build.*.log files" >> $LOGFILE
788 echo -ne "`date -u '+%b %e %T'`: Stage5 packages build \n" |
tee -a $LOGFILE
790 echo "`date -u '+%b %e %T'`: Stripping files" |
tee -a $LOGFILE
791 find $LFS/lib
$LFS/usr
/lib
$LFS/usr
/share
/rrdtool-
* $LFS/install ! -type l \
( -name '*.so' -o -name '*.so[\.0-9]*' \
) \
792 ! -name 'libc.so' ! -name 'libpthread.so' ! -name 'libcrypto.so.0.9.7.sha1' \
793 -exec $LFS/tools
/bin
/strip
--strip-all {} \
; >> $LOGFILE 2>&1
794 # add -ls before -exec if you want to verify what files are stripped
796 find $LFS/{,s
}bin
$LFS/usr
/{,s
}bin
$LFS/usr
/local
/{,s
}bin
! -type l \
797 -exec file {} \
; |
grep " ELF " | cut
-f1 -d ':' |
xargs $LFS/tools
/bin
/strip
--strip-all >> $LOGFILE 2>&1
798 # there add -v to strip to verify
800 if [ 'i386' = $MACHINE ]; then
801 # Create fcdsl packages
802 echo "`date -u '+%b %e %T'`: Building fcdsl tgz" |
tee -a $LOGFILE
803 cp $LFS/install
/images
/fcdsl
/license.txt
$LFS >> $LOGFILE 2>&1
804 touch $LFS/var
/run
/{need-depmod-
$KVER,need-depmod-
$KVER-smp}
805 cd $LFS && tar cvfz
$LFS/install
/images
/$SNAME-fcdsl-$VERSION.
$MACHINE.tgz \
806 lib
/modules
/$KVER/misc
/fcdsl
*.o.gz \
807 lib
/modules
/$KVER-smp/misc
/fcdsl
*.o.gz \
808 usr
/lib
/isdn
/{fds?base.bin
,fd?ubase.frm
} \
809 etc
/fcdsl
/fcdsl
*.conf \
810 etc
/drdsl
/{drdsl
,drdsl.ini
} \
812 var
/run
/{need-depmod-
$KVER,need-depmod-
$KVER-smp} >> $LOGFILE 2>&1
813 rm -f $LFS/license.txt
>> $LOGFILE 2>&1
817 # Generating list of packages used
818 echo "`date -u '+%b %e %T'`: Generating packages list from logs" |
tee -a $LOGFILE
819 rm -f $BASEDIR/doc
/packages-list
820 for i
in `ls -1tr $BASEDIR/log/[^_]*`; do
821 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
822 echo " * `basename $i`" >>$BASEDIR/doc
/packages-list
825 echo "====== List of softwares used to build $NAME Version: $VERSION ======" > $BASEDIR/doc
/packages-list.txt
826 grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|ipcop$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$' \
827 $BASEDIR/doc
/packages-list |
sort >> $BASEDIR/doc
/packages-list.txt
828 rm -f $BASEDIR/doc
/packages-list
829 # packages-list.txt is ready to be displayed for wiki page
831 # Create ISO for CDRom and USB-superfloppy
833 rm -f $LFS/install
/images
/*usb
*
834 cp $LFS/install
/images
/{*.iso
,*.tgz
} $BASEDIR >> $LOGFILE 2>&1
840 rm -rf $BASEDIR/build
/tmp
/*
842 # Generating total list of files
843 echo "`date -u '+%b %e %T'`: Generating files list from logs" |
tee -a $LOGFILE
844 rm -f $BASEDIR/log
/FILES
845 for i
in `ls -1tr $BASEDIR/log/[^_]*`; do
846 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
847 echo "##" >>$BASEDIR/log
/FILES
848 echo "## `basename $i`" >>$BASEDIR/log
/FILES
849 echo "##" >>$BASEDIR/log
/FILES
850 cat $i |
sed "s%^\./%#%" |
sort >> $BASEDIR/log
/FILES
859 if [ -d "$BASEDIR/packages" ]; then
860 for i
in `ls $BASEDIR/packages`; do
861 touch $BASEDIR/build
/install
/packages
/$i.empty
865 ipfiredist applejuice
866 # ipfiredist asterisk
884 ipfiredist spamassassin
885 ipfiredist web-cyradm
888 test -d $BASEDIR/packages || mkdir
$BASEDIR/packages
889 mv -f $LFS/install
/packages
/*.
{tar.gz
,md5
} $BASEDIR/packages
>> $LOGFILE 2>&1
890 rm -rf $BASEDIR/build
/install
/packages
/*
893 # See what we're supposed to do
896 BUILDMACHINE
=`uname -m`
897 PACKAGE
=`ls -v -r $BASEDIR/cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz 2> /dev/null | head -n 1`
898 #only restore on a clean disk
899 if [ ! -f log
/perl-
*-tools ]; then
900 if [ ! -n "$PACKAGE" ]; then
901 echo "`date -u '+%b %e %T'`: Full toolchain compilation" |
tee -a $LOGFILE
905 PACKAGENAME
=${PACKAGE%.tar.gz}
906 echo "`date -u '+%b %e %T'`: Restore from $PACKAGE" |
tee -a $LOGFILE
907 if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then
911 exiterror
"$PACKAGENAME md5 did not match, check downloaded package"
915 echo "`date -u '+%b %e %T'`: Using installed toolchain" |
tee -a $LOGFILE
922 # Setzen des IPFire Builds
923 if [ "$FIREBUILD" ]; then
924 echo "$FIREBUILD" > $BASEDIR/build
/var
/ipfire
/firebuild
926 echo "_(OvO)_" > $BASEDIR/build
/var
/ipfire
/firebuild
933 # enter a shell inside LFS chroot
934 # may be used to changed kernel settings
939 echo -n "Loading new Changelog from SVN: "
940 svn log http
://svn.ipfire.eu
/svn
/ipfire
> doc
/ChangeLog
944 echo "Checking sources files availability on the web"
945 if [ ! -d $DIR_CHK ]; then
950 for c
in `seq $MAX_RETRIES`; do
951 if (( FINISHED
==1 )); then
957 if [ -f "$i" -a "$i" != "Config" ]; then
958 make -s -f $i MACHINE
=$MACHINE LFS_BASEDIR
=$BASEDIR ROOT
=$BASEDIR/build \
959 MESSAGE
="$i\t ($c/$MAX_RETRIES)" check
960 if [ $?
-ne 0 ]; then
961 echo "Check : wget error in lfs/$i"
970 echo "Erasing sources files availability tags"
974 for i
in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do
975 $LOSETUP -d $i 2>/dev
/null
977 for i
in `mount | grep $BASEDIR | cut -d " " -f 1`; do
981 for i
in `seq 0 7`; do
982 if ( losetup
/dev
/loop
${i} 2>/dev
/null |
grep -q "/install/images" ); then
983 umount
/dev
/loop
${i} 2>/dev
/null
;
984 losetup
-d /dev
/loop
${i} 2>/dev
/null
;
987 rm -rf $BASEDIR/build
988 rm -rf $BASEDIR/cdrom
989 rm -rf $BASEDIR/packages
991 if [ -h /tools
]; then
996 # create structure for a new package
997 echo -e "Name of the new package: $2"
998 if [ ! -f "lfs/$2" ]; then
999 echo "`date -u '+%b %e %T'`: Creating directory src/paks/$2"
1000 mkdir
-p src
/paks
/$2
1002 echo "`date -u '+%b %e %T'`: Creating files"
1003 cp $BASEDIR/lfs
/postfix
$BASEDIR/lfs
/$2
1006 touch {,un
}install.sh
1008 echo '#!/bin/bash' > install.sh
1009 echo '#' >> install.sh
1010 echo '#################################################################' >> install.sh
1011 echo '# #' >> install.sh
1012 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> install.sh
1013 echo '# #' >> install.sh
1014 echo '#################################################################' >> install.sh
1015 echo '#' >> install.sh
1016 echo '# Extract the files' >> install.sh
1017 echo 'tar xfz files.tgz -C /' >> install.sh
1018 echo 'cp -f ROOTFILES /opt/pakfire/installed/ROOTFILES.$2' >> install.sh
1020 echo '#!/bin/bash' > uninstall.sh
1021 echo '#################################################################' >> uninstall.sh
1022 echo '# #' >> uninstall.sh
1023 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> uninstall.sh
1024 echo '# #' >> uninstall.sh
1025 echo '#################################################################' >> uninstall.sh
1026 echo '#' >> uninstall.sh
1027 echo '# Delete the files' >> uninstall.sh
1028 echo '## Befehl fehlt noch' >> uninstall.sh
1029 echo 'rm -f /opt/pakfire/installed/ROOTFILES.$2' >> uninstall.sh
1030 echo "`date -u '+%b %e %T'`: Adding files to SVN"
1031 cd - && svn add lfs
/$2 && svn add src
/paks
/$2
1033 echo -n "Do you want to remove the folders? [y/n]"
1035 if [ "$REM" == "y" ]; then
1036 echo "Removing the folders..."
1037 svn del src
/paks
/$2 --force
1039 echo "Folders are kept."
1042 echo "$2 already exists"
1047 if [ ! -d $BASEDIR/cache
]; then
1048 mkdir
$BASEDIR/cache
1050 mkdir
-p $BASEDIR/log
1051 echo "`date -u '+%b %e %T'`:Preload all source files" |
tee -a $LOGFILE
1054 for c
in `seq $MAX_RETRIES`; do
1055 if (( FINISHED
==1 )); then
1061 if [ -f "$i" -a "$i" != "Config" ]; then
1062 make -s -f $i LFS_BASEDIR
=$BASEDIR MESSAGE
="$i\t ($c/$MAX_RETRIES)" download
>> $LOGFILE 2>&1
1063 if [ $?
-ne 0 ]; then
1064 echo "Prefetch : wget error in lfs/$i"
1067 if [ $c -eq 1 ]; then
1068 echo "Prefetch : lfs/$i files loaded"
1074 echo "Prefetch : verifying md5sum"
1077 if [ -f "$i" -a "$i" != "Config" ]; then
1078 make -s -f $i LFS_BASEDIR
=$BASEDIR MESSAGE
="$i\t " md5
>> $LOGFILE 2>&1
1079 if [ $?
-ne 0 ]; then
1080 echo "md5 difference in lfs/$i"
1085 if [ $ERROR -eq 0 ]; then
1086 echo "Prefetch : all files md5sum match"
1093 BUILDMACHINE
=`uname -m`
1094 echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for $BUILDMACHINE" |
tee -a $LOGFILE
1095 cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache
/$SNAME-$VERSION-toolchain-$BUILDMACHINE.
tar.gz \
1096 build
/{bin
,etc
,usr
/bin
,usr
/local} \
1097 build
/tools
/{bin
,etc
,*-linux-gnu,include
,lib
,libexec
,sbin
,share
,var
} \
1099 md5sum cache
/$SNAME-$VERSION-toolchain-$BUILDMACHINE.
tar.gz \
1100 > cache
/$SNAME-$VERSION-toolchain-$BUILDMACHINE.md5
1104 BUILDMACHINE
=`uname -m`
1105 # arbitrary name to be updated in case of new toolchain package upload
1106 PACKAGE
=$SNAME-$VERSION-toolchain-$BUILDMACHINE
1107 URL_IPFIRE
=`grep URL_IPFIRE lfs/Config | awk '{ print $3 }'`
1108 echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for $BUILDMACHINE" |
tee -a $LOGFILE
1110 wget
$URL_IPFIRE/toolchains
/$PACKAGE.
tar.gz
$URL_IPFIRE/toolchains
/$PACKAGE.md5
>& /dev
/null
1111 if [ $?
-ne 0 ]; then
1112 echo "`date -u '+%b %e %T'`: error downloading toolchain for $BUILDMACHINE machine" |
tee -a $LOGFILE
1114 if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then
1115 echo "`date -u '+%b %e %T'`: toolchain md5 ok" |
tee -a $LOGFILE
1117 exiterror
"$PACKAGE.md5 did not match, check downloaded package"
1125 echo -n "Load the latest source files..."
1126 svn update
>> $PWD/log
/_build.svn.update.log
1127 if [ $?
-eq 0 ]; then
1133 echo -n "Write the svn info to a file..."
1134 svn info
> $PWD/svn_status
1135 if [ "$?" -eq "0" ]; then
1144 echo "Upload the changed files..."
1151 echo -ne "Download source package from svn..."
1152 svn
export http
://svn.ipfire.eu
/svn
/ipfire ipfire-source
/ --force > /dev
/null
1153 if [ "$?" -eq "0" ]; then
1159 echo -n "Compress files..."
1160 tar cfz ipfire-source-
`date +'%Y-%m-%d'`-r`svn info | grep Revision | cut -c 11-`.
tar.gz ipfire-source
1161 if [ "$?" -eq "0" ]; then
1167 echo -n "Cleanup..."
1168 rm ipfire-source
/ -r
1169 if [ "$?" -eq "0" ]; then
1177 echo -ne "Make a local diff to last svn revision..."
1178 svn
diff > ipfire-diff-
`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.
diff
1179 if [ "$?" -eq "0" ]; then
1185 echo "Diff was successfully saved to ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff"
1190 echo -e "Syncing Cache to FTP:"
1191 if [ -f .pass
]; then
1194 echo -ne "Password for mirror.ipfire.org: "; read PASS
1196 rm -f doc
/packages-to-remove-from-ftp
1197 ncftpls
-u web3
-p $PASS ftp://mirror.ipfire.org
/html
/source-packages
/source
/ > ftplist
1198 for i
in `ls -w1 cache/`; do
1200 if [ "$?" -ne "0" ]; then
1201 ncftpput
-u web3
-p $PASS mirror.ipfire.org
/html
/source-packages
/source cache
/$i
1202 if [ "$?" -eq "0" ]; then
1203 echo -e "$i was successfully uploaded to the ftp server."
1205 echo -e "There was an error while uploading $i to the ftp server."
1209 for i
in `cat ftplist`; do
1210 ls -w1 cache
/ |
grep $i
1211 if [ "$?" -eq "1" ]; then
1212 echo $i |
grep -v toolchain
>> doc
/packages-to-remove-from-ftp
1218 echo -e "Upload the ISO to the beta-mirror!"
1219 if [ -f .pass
]; then
1222 echo -ne "Password for mirror.ipfire.org: "; read PASS
1224 ncftpls
-u web3
-p $PASS ftp://mirror.ipfire.org
/html
/source-packages
/beta
/ |
grep `svn info | grep Revision | cut -c 11-`
1225 if [ "$?" -eq "1" ]; then
1226 cp $BASEDIR/ipfire-install-1.4.i386.iso
$BASEDIR/ipfire-install-1.4.i386-r
`svn info | grep Revision | cut -c 11-`.iso
1227 md5sum ipfire-install-1.4.i386-r
`svn info | grep Revision | cut -c 11-`.iso
> ipfire-install-1.4.i386-r
`svn info | grep Revision | cut -c 11-`.iso.md5
1228 ncftpput
-u web3
-p $PASS mirror.ipfire.org
/html
/source-packages
/beta
/ ipfire-install-1.4.i386-r
`svn info | grep Revision | cut -c 11-`.iso
1229 ncftpput
-u web3
-p $PASS mirror.ipfire.org
/html
/source-packages
/beta
/ ipfire-install-1.4.i386-r
`svn info | grep Revision | cut -c 11-`.iso.md5
1230 if [ "$?" -eq "0" ]; then
1231 echo -e "The ISO of Revision `svn info | grep Revision | cut -c 11-` was successfully uploaded to the ftp server."
1233 echo -e "There was an error while uploading the ISO to the ftp server."
1236 echo -e "File with name ipfire-install-1.4.i386-r`svn info | grep Revision | cut -c 11-`.iso already exists on the ftp server!"
1238 rm -f ipfire-install-1.4.i386-r
`svn info | grep Revision | cut -c 11-`.iso
{,.md5
}
1241 echo -e "Upload the packages to the beta-mirror!"
1242 if [ -f .pass
]; then
1245 echo -ne "Password for mirror.ipfire.org: "; read PASS
1247 ncftpput
-z -u web3
-p $PASS mirror.ipfire.org
/html
/source-packages
/packages
/ packages
/*
1248 if [ "$?" -eq "0" ]; then
1249 echo -e "The packages were successfully uploaded to the ftp server."
1251 echo -e "There was an error while uploading the packages to the ftp server."
1255 rm -f $BASEDIR/log
/$2*
1256 BUILDMACHINE
=`uname -m`
1261 screen
-dmS ipfire
$0 build
1262 echo "Build started... This will take a while!"
1263 echo "You can see the status with 'screen -x ipfire'."
1268 select name
in "Exit" "IPFIRE: Prefetch" "IPFIRE: Build (silent)" "IPFIRE: Watch Build" "IPFIRE: Clean" "SVN: Commit" "SVN: Update" "SVN: Status" "SVN: Diff" "Help"
1274 "IPFIRE: Build (silent)")
1277 "IPFIRE: Watch Build")
1278 echo "Exit with Ctrl+A, Ctrl+D."
1279 echo -n "Preparing..."
1280 for i
in `seq 10`; do
1281 sleep 0.1; echo -n "."
1297 svn status
# | grep -v ^?
1303 echo "Usage: $0 {build|changelog|check|checkclean|clean|gettoolchain|newpak|prefetch|shell|sync|toolchain}"
1304 cat doc
/make.sh-usage