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"
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
63 if [ 'x86_64' = $MACHINE -o 'i686' = $MACHINE -o 'i586' = $MACHINE -o 'i486' = $MACHINE -o 'i386' = $MACHINE ]; then
65 echo "`date -u '+%b %e %T'`: Machine is ix86 (or equivalent)" |
tee -a $LOGFILE
67 BUILDTARGET
=i386-pc-linux-gnu
68 CFLAGS
="-O2 -mcpu=i386 -march=i386 -pipe -fomit-frame-pointer"
69 CXXFLAGS
="-O2 -mcpu=i386 -march=i386 -pipe -fomit-frame-pointer"
70 elif [ 'alpha' = $MACHINE ]; then
71 echo "`date -u '+%b %e %T'`: Machine is Alpha AXP" |
tee -a $LOGFILE
72 BUILDTARGET
=alpha-unknown-linux-gnu
73 CFLAGS
="-O2 -mcpu=ev4 -mieee -pipe"
74 CXXFLAGS
="-O2 -mcpu=ev4 -mieee -pipe"
76 echo "`date -u '+%b %e %T'`: Can't determine your architecture - $MACHINE" |
tee -a $LOGFILE
82 umount
$BASEDIR/build
/dev
/pts
2>/dev
/null
;
83 umount
$BASEDIR/build
/proc
2>/dev
/null
;
84 umount
$BASEDIR/build
/install
/mnt
2>/dev
/null
;
85 umount
$BASEDIR/build
/usr
/src
/cache
2>/dev
/null
;
86 umount
$BASEDIR/build
/usr
/src
/ccache
2>/dev
/null
;
87 umount
$BASEDIR/build
/usr
/src
/config
2>/dev
/null
;
88 umount
$BASEDIR/build
/usr
/src
/doc
2>/dev
/null
;
89 umount
$BASEDIR/build
/usr
/src
/html
2>/dev
/null
;
90 umount
$BASEDIR/build
/usr
/src
/langs
2>/dev
/null
;
91 umount
$BASEDIR/build
/usr
/src
/lfs
2>/dev
/null
;
92 umount
$BASEDIR/build
/usr
/src
/log
2>/dev
/null
;
93 umount
$BASEDIR/build
/usr
/src
/src
2>/dev
/null
;
98 for i
in `seq 0 7`; do
99 if ( losetup
/dev
/loop
${i} 2>/dev
/null |
grep -q "/install/images" ); then
100 losetup
-d /dev
/loop
${i} 2>/dev
/null
104 echo " Check $LOGFILE for errors if applicable"
109 if [ ! -e $BASEDIR/build
/usr
/src
/lfs
/ ]; then
110 exiterror
"No such file or directory: $BASEDIR/build/usr/src/lfs/"
112 echo "Entering to a shell inside LFS chroot, go out with exit"
113 chroot
$LFS /tools
/bin
/env
-i HOME
=/root TERM
=$TERM PS1
='\u:\w\$ ' \
114 PATH
=/usr
/local
/bin
:/bin
:/usr
/bin
:/sbin
:/usr
/sbin
:/tools
/bin \
115 VERSION
=$VERSION CONFIG_ROOT
=$CONFIG_ROOT \
116 NAME
="$NAME" SNAME
="$SNAME" SLOGAN
="$SLOGAN" \
117 CFLAGS
="$CFLAGS" CXXFLAGS
="$CXXFLAGS" \
118 CCACHE_DIR
=/usr
/src
/ccache \
121 BUILDTARGET
="$BUILDTARGET" MACHINE
="$MACHINE" \
122 KGCC
="ccache /usr/bin/gcc" \
124 if [ $?
-ne 0 ]; then
125 exiterror
"chroot error"
132 ############################################################################
134 # Are we running the right shell? #
136 ############################################################################
137 if [ ! "$BASH" ]; then
138 exiterror
"BASH environment variable is not set. You're probably running the wrong shell."
141 if [ -z "${BASH_VERSION}" ]; then
142 exiterror
"Not running BASH shell."
146 ############################################################################
148 # Trap on emergency exit #
150 ############################################################################
151 trap "exiterror 'Build process interrupted'" SIGINT SIGTERM SIGKILL SIGSTOP SIGQUIT
154 ############################################################################
156 # Resetting our nice level #
158 ############################################################################
159 echo "`date -u '+%b %e %T'`: Resetting our nice level to $NICE" |
tee -a $LOGFILE
160 renice
$NICE $$
> /dev
/null
161 if [ `nice` != "$NICE" ]; then
162 exiterror
"Failed to set correct nice level"
165 ############################################################################
167 # Checking if running as root user #
169 ############################################################################
170 echo "`date -u '+%b %e %T'`: Checking if we're running as root user" |
tee -a $LOGFILE
171 if [ `id -u` != 0 ]; then
172 exiterror
"Not building as root"
176 ############################################################################
178 # Checking for necessary temporary space #
180 ############################################################################
181 echo "`date -u '+%b %e %T'`: Checking for necessary space on disk $BASE_DEV" |
tee -a $LOGFILE
182 BASE_DEV
=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $1 }'`
183 BASE_ASPACE
=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $4 }'`
184 if (( 2202000 > $BASE_ASPACE )); then
185 BASE_USPACE
=`du -skx $BASEDIR | awk '{print $1}'`
186 if (( 2202000 - $BASE_USPACE > $BASE_ASPACE )); then
187 exiterror
"Not enough temporary space available, need at least 2.1GB on $BASE_DEV"
191 ############################################################################
193 # Building Linux From Scratch system #
195 ############################################################################
196 echo "`date -u '+%b %e %T'`: Building Linux From Scratch system" |
tee -a $LOGFILE
204 # Check /tools symlink
205 if [ -h /tools
]; then
208 if [ ! -a /tools
]; then
209 ln -s $BASEDIR/build
/tools
/
211 if [ ! -h /tools
]; then
212 exiterror
"Could not create /tools symbolic link."
218 export LFS LC_ALL CFLAGS CXXFLAGS
219 unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
221 # Make some extra directories
222 mkdir
-p $BASEDIR/build
/{tools
,etc
,usr
/src
} 2>/dev
/null
223 mkdir
-p $BASEDIR/{cache
,ccache
} 2>/dev
/null
224 mkdir
-p $BASEDIR/build
/dev
/pts
$BASEDIR/build
/proc
$BASEDIR/build
/usr
/src
/{cache
,config
,doc
,html
,langs
,lfs
,log
,src
,ccache
}
226 # Make all sources and proc available under lfs build
227 mount
--bind /dev
/pts
$BASEDIR/build
/dev
/pts
228 mount
--bind /proc
$BASEDIR/build
/proc
229 mount
--bind $BASEDIR/cache
$BASEDIR/build
/usr
/src
/cache
230 mount
--bind $BASEDIR/ccache
$BASEDIR/build
/usr
/src
/ccache
231 mount
--bind $BASEDIR/config
$BASEDIR/build
/usr
/src
/config
232 mount
--bind $BASEDIR/doc
$BASEDIR/build
/usr
/src
/doc
233 mount
--bind $BASEDIR/html
$BASEDIR/build
/usr
/src
/html
234 mount
--bind $BASEDIR/langs
$BASEDIR/build
/usr
/src
/langs
235 mount
--bind $BASEDIR/lfs
$BASEDIR/build
/usr
/src
/lfs
236 mount
--bind $BASEDIR/log
$BASEDIR/build
/usr
/src
/log
237 mount
--bind $BASEDIR/src
$BASEDIR/build
/usr
/src
/src
239 # Run LFS static binary creation scripts one by one
240 export CCACHE_DIR
=$BASEDIR/ccache
241 export CCACHE_HASHDIR
=1
243 # Remove pre-install list of installed files in case user erase some files before rebuild
244 rm -f $BASEDIR/build
/usr
/src
/lsalr
2>/dev
/null
248 ############################################################################
250 # Necessary shell functions #
252 ############################################################################
254 if [ -f $BASEDIR/lfs
/$1 ]; then
255 echo "`date -u '+%b %e %T'`: Building $*" |
tee -a $LOGFILE
256 cd $BASEDIR/lfs
&& make -s -f $
* LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t " download
>> $LOGFILE 2>&1
257 if [ $?
-ne 0 ]; then
258 exiterror
"Download error in $1"
260 cd $BASEDIR/lfs
&& make -s -f $
* LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t md5sum" md5
>> $LOGFILE 2>&1
261 if [ $?
-ne 0 ]; then
262 exiterror
"md5sum error in $1, check file in cache or signature"
264 cd $BASEDIR/lfs
&& make -f $
* BUILDTARGET
=$BUILDTARGET \
266 LFS_BASEDIR
=$BASEDIR \
269 install >> $LOGFILE 2>&1
270 if [ $?
-ne 0 ]; then
271 exiterror
"Building $*";
274 exiterror
"No such file or directory: $BASEDIR/$1"
280 if [ -f $BASEDIR/build
/usr
/src
/lfs
/$1 ]; then
281 echo "`date -u '+%b %e %T'`: Building $*" |
tee -a $LOGFILE
282 cd $BASEDIR/lfs
&& make -s -f $
* LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t " download
>> $LOGFILE 2>&1
283 if [ $?
-ne 0 ]; then
284 exiterror
"Download error in $1"
286 cd $BASEDIR/lfs
&& make -s -f $
* LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t md5sum" md5
>> $LOGFILE 2>&1
287 if [ $?
-ne 0 ]; then
288 exiterror
"md5sum error in $1, check file in cache or signature"
290 chroot
$LFS /tools
/bin
/env
-i HOME
=/root \
291 TERM
=$TERM PS1
='\u:\w\$ ' \
292 PATH
=/usr
/local
/bin
:/bin
:/usr
/bin
:/sbin
:/usr
/sbin
:/tools
/bin \
294 CONFIG_ROOT
=$CONFIG_ROOT \
295 NAME
="$NAME" SNAME
="$SNAME" SLOGAN
="$SLOGAN" \
296 CFLAGS
="$CFLAGS" CXXFLAGS
="$CXXFLAGS" \
297 CCACHE_DIR
=/usr
/src
/ccache CCACHE_HASHDIR
=1 \
299 BUILDTARGET
="$BUILDTARGET" MACHINE
="$MACHINE" \
300 /tools
/bin
/bash
-x -c "cd /usr/src/lfs && \
301 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
302 if [ $?
-ne 0 ]; then
303 exiterror
"Building $*"
306 exiterror
"No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
312 if [ -f $BASEDIR/build
/usr
/src
/lfs
/$1 ]; then
313 echo "`date -u '+%b %e %T'`: Building $*" |
tee -a $LOGFILE
314 cd $BASEDIR/lfs
&& make -s -f $
* LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t " download
>> $LOGFILE 2>&1
315 if [ $?
-ne 0 ]; then
316 exiterror
"Download error in $1"
318 cd $BASEDIR/lfs
&& make -s -f $
* LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t md5sum" md5
>> $LOGFILE 2>&1
319 if [ $?
-ne 0 ]; then
320 exiterror
"md5sum error in $1, check file in cache or signature"
322 chroot
$LFS /tools
/bin
/env
-i HOME
=/root \
323 TERM
=$TERM PS1
='\u:\w\$ ' \
324 PATH
=/usr
/local
/bin
:/bin
:/usr
/bin
:/sbin
:/usr
/sbin \
326 CONFIG_ROOT
=$CONFIG_ROOT \
327 NAME
="$NAME" SNAME
="$SNAME" SLOGAN
="$SLOGAN" \
328 CFLAGS
="$CFLAGS" CXXFLAGS
="$CXXFLAGS" \
329 CCACHE_DIR
=/usr
/src
/ccache CCACHE_HASHDIR
=1 \
331 BUILDTARGET
="$BUILDTARGET" MACHINE
="$MACHINE" \
332 /bin
/bash
-x -c "cd /usr/src/lfs && \
333 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
334 if [ $?
-ne 0 ]; then
335 exiterror
"Building $*"
338 exiterror
"No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
344 if [ -f $BASEDIR/build
/usr
/src
/lfs
/$1 ]; then
345 # if [ ! `ls -w1 $BASEDIR/packages/*.tar.gz | grep $1` ]; then
346 echo "`date -u '+%b %e %T'`: Packaging $1" |
tee -a $LOGFILE
347 chroot
$LFS /tools
/bin
/env
-i HOME
=/root \
348 TERM
=$TERM PS1
='\u:\w\$ ' \
349 PATH
=/usr
/local
/bin
:/bin
:/usr
/bin
:/sbin
:/usr
/sbin \
351 CONFIG_ROOT
=$CONFIG_ROOT \
352 NAME
="$NAME" SNAME
="$SNAME" SLOGAN
="$SLOGAN" \
353 CFLAGS
="$CFLAGS" CXXFLAGS
="$CXXFLAGS" \
354 CCACHE_DIR
=/usr
/src
/ccache CCACHE_HASHDIR
=1 \
356 BUILDTARGET
="$BUILDTARGET" MACHINE
="$MACHINE" \
357 /bin
/bash
-x -c "cd /usr/src/lfs && \
358 make -f $1 LFS_BASEDIR=/usr/src dist" >>$LOGFILE 2>&1
359 if [ $?
-ne 0 ]; then
360 exiterror
"Packaging $1"
363 # echo "`date -u '+%b %e %T'`: Packaging: The package $1 already exists"
366 exiterror
"No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
373 if [ -f $BASEDIR/build
/usr
/src
/lfs
/$1 ]; then
374 echo "`date -u '+%b %e %T'`: Building $*" |
tee -a $LOGFILE
375 cd $BASEDIR/lfs
&& make -s -f $
* LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t " download
>> $LOGFILE 2>&1
376 if [ $?
-ne 0 ]; then
377 exiterror
"Download error in $1"
379 cd $BASEDIR/lfs
&& make -s -f $
* LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t md5sum" md5
>> $LOGFILE 2>&1
380 if [ $?
-ne 0 ]; then
381 exiterror
"md5sum error in $1, check file in cache or signature"
383 chroot
$LFS /tools
/bin
/env
-i HOME
=/root \
384 TERM
=$TERM PS1
='\u:\w\$ ' \
385 PATH
=/usr
/local
/bin
:/opt
/$MACHINE-uClibc/usr
/bin
:/bin
:/usr
/bin
:/sbin
:/usr
/sbin \
387 CONFIG_ROOT
=$CONFIG_ROOT \
389 NAME
="$NAME" SNAME
="$SNAME" SLOGAN
="$SLOGAN" \
390 CFLAGS
="-Os" CXXFLAGS
="-Os" \
391 CCACHE_DIR
=/usr
/src
/ccache CCACHE_HASHDIR
=1 \
393 BUILDTARGET
="$BUILDTARGET" MACHINE
="$MACHINE" \
394 /bin
/bash
-x -c "cd /usr/src/lfs && \
395 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
396 if [ $?
-ne 0 ]; then
397 exiterror
"Building $*"
400 exiterror
"No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
406 LOGFILE
="$BASEDIR/log/_build.toolchain.log"
408 echo -ne "`date -u '+%b %e %T'`: Stage1 toolchain build \n" |
tee -a $LOGFILE
409 # Build sed now, as we use some extensions
411 NATIVEGCC
=`gcc --version | grep GCC | awk {'print $3'}`
412 export NATIVEGCC GCCmajor
=${NATIVEGCC:0:1} GCCminor=${NATIVEGCC:2:1} GCCrelease=${NATIVEGCC:4:1}
414 lfsmake1
sed LFS_PASS
=1
415 lfsmake1
m4 LFS_PASS
=1
416 lfsmake1 bison LFS_PASS
=1
417 lfsmake1 flex LFS_PASS
=1
418 lfsmake1 binutils LFS_PASS
=1
419 lfsmake1 gcc LFS_PASS
=1
420 export PATH
=$BASEDIR/build
/usr
/local
/bin
:$BASEDIR/build
/tools
/bin
:$PATH
427 lfsmake1 gcc LFS_PASS
=2
428 lfsmake1 binutils LFS_PASS
=2
437 lfsmake1
sed LFS_PASS
=2
438 lfsmake1
m4 LFS_PASS
=2
439 lfsmake1 bison LFS_PASS
=2
440 lfsmake1 flex LFS_PASS
=2
449 export PATH
=$ORG_PATH
453 LOGFILE
="$BASEDIR/log/_build.base.log"
455 echo -ne "`date -u '+%b %e %T'`: Stage2 linux base build \n" |
tee -a $LOGFILE
456 # Run LFS dynamic binary creation scripts one by one
494 if [ 'i386' = $MACHINE ]; then
496 elif [ 'alpha' = $MACHINE ]; then
515 # Run IPFire make scripts one by one
516 LOGFILE
="$BASEDIR/log/_build.ipfire.log"
518 echo -ne "`date -u '+%b %e %T'`: Stage3 $NAME build \n" |
tee -a $LOGFILE
520 # Build these first as some of the kernel packages below rely on
521 # these for some of their client program functionality
532 if [ 'i386' = $MACHINE ]; then
533 # abuse the SMP flag, and make an minimal installer kernel first
534 # so that the boot floppy always works.....
535 ipcopmake linux LFS_PASS
=ipfire SMP
=installer
536 ipcopmake linux LFS_PASS
=ipfire SMP
=1
537 ipcopmake
3cp4218 SMP
=1
538 ipcopmake amedyn SMP
=1
539 ipcopmake cxacru SMP
=1
540 ipcopmake eagle SMP
=1
542 # These are here because they have i386 only binary libraries
543 # included in the package.
544 ipcopmake cnx_pci SMP
=1
545 ipcopmake fcdsl SMP
=1
546 ipcopmake fcdsl2 SMP
=1
547 ipcopmake fcdslsl SMP
=1
548 ipcopmake fcdslusb SMP
=1
549 ipcopmake fcdslslusb SMP
=1
550 ipcopmake fcpci SMP
=1
551 ipcopmake fcclassic SMP
=1
552 ipcopmake pulsar SMP
=1
553 ipcopmake unicorn SMP
=1
554 ipcopmake promise-sata-300-tx SMP
=1
557 ipcopmake linux LFS_PASS
=ipfire
564 if [ 'i386' = $MACHINE ]; then
565 # These are here because they have i386 only binary libraries
566 # included in the package.
577 ipcopmake promise-sata-300-tx
599 ipcopmake capi4k-utils
604 ipcopmake ez-ipupdate
610 ipcopmake initscripts
617 ipcopmake l7-protocols
618 ipcopmake isapnptools
619 ipcopmake isdn4k-utils
630 ipcopmake HTML-Tagset
631 ipcopmake HTML-Parser
632 ipcopmake Compress-Zlib
634 ipcopmake Digest-SHA1
635 ipcopmake Digest-HMAC
636 ipcopmake libwww-perl
638 ipcopmake Net-IPv4Addr
641 ipcopmake Unix-Syslog
645 ipcopmake Convert-TNEF
646 ipcopmake Convert-UUlib
647 ipcopmake Archive-Tar
648 ipcopmake Archive-Zip
649 ipcopmake Text-Tabs
+Wrap
650 ipcopmake Locale-Country
654 ipcopmake BerkeleyDB
## The Perl module
655 ipcopmake noip_updater
666 ipcopmake saslauthd PASS
=1
669 ipcopmake squid-graph
677 # echo -ne "`date -u '+%b %e %T'`: Building ### IPFire modules ### \n" | tee -a $LOGFILE
679 ipcopmake startscripts
680 ## Zuerst die Libs und dann die Programme. Ordnung muss sein!
697 ipcopmake saslauthd PASS
=2
699 ipcopmake ghostscript
701 # ipcopmake lpd ## Im Moment aus, da CUPS vorhanden ist.
709 ipcopmake bridge-utils
712 ipcopmake smartmontools
715 echo -ne "`date -u '+%b %e %T'`: Building ### Mailserver ### \n" |
tee -a $LOGFILE
724 ipcopmake spamassassin
726 echo -ne "`date -u '+%b %e %T'`: Building ### VoIP-Server ### \n" |
tee -a $LOGFILE
733 echo -ne "`date -u '+%b %e %T'`: Building ### MP3-Server ### \n" |
tee -a $LOGFILE
736 echo -ne "`date -u '+%b %e %T'`: Building ### P2P-Clients ### \n" |
tee -a $LOGFILE
740 # ipcopmake edonkeyclc
742 echo -ne "`date -u '+%b %e %T'`: Building ### Net-Tools ### \n" |
tee -a $LOGFILE
755 # ipcopmake stunnel # Ausgeschaltet, weil wir es doch nicht nutzen
759 # Run installer scripts one by one
760 LOGFILE
="$BASEDIR/log/_build.installer.log"
762 echo -ne "`date -u '+%b %e %T'`: Stage4 installer build \n" |
tee -a $LOGFILE
763 if [ 'i386' = $MACHINE ]; then
771 installmake e2fsprogs
772 installmake misc-progs
774 installmake util-linux
777 installmake pcmcia-cs
779 installmake installer
781 installmake driver.img
787 LOGFILE
="$BASEDIR/log/_build.packages.log"
789 echo "... see detailed log in _build.*.log files" >> $LOGFILE
790 echo -ne "`date -u '+%b %e %T'`: Stage5 packages build \n" |
tee -a $LOGFILE
792 echo "`date -u '+%b %e %T'`: Stripping files" |
tee -a $LOGFILE
793 find $LFS/lib
$LFS/usr
/lib
$LFS/usr
/share
/rrdtool-
* $LFS/install ! -type l \
( -name '*.so' -o -name '*.so[\.0-9]*' \
) \
794 ! -name 'libc.so' ! -name 'libpthread.so' ! -name 'libcrypto.so.0.9.7.sha1' \
795 -exec $LFS/tools
/bin
/strip
--strip-all {} \
; >> $LOGFILE 2>&1
796 # add -ls before -exec if you want to verify what files are stripped
798 find $LFS/{,s
}bin
$LFS/usr
/{,s
}bin
$LFS/usr
/local
/{,s
}bin
! -type l \
799 -exec file {} \
; |
grep " ELF " | cut
-f1 -d ':' |
xargs $LFS/tools
/bin
/strip
--strip-all >> $LOGFILE 2>&1
800 # there add -v to strip to verify
802 if [ 'i386' = $MACHINE ]; then
803 # Create fcdsl packages
804 echo "`date -u '+%b %e %T'`: Building fcdsl tgz" |
tee -a $LOGFILE
805 cp $LFS/install
/images
/fcdsl
/license.txt
$LFS >> $LOGFILE 2>&1
806 touch $LFS/var
/run
/{need-depmod-
$KVER,need-depmod-
$KVER-smp}
807 cd $LFS && tar cvfz
$LFS/install
/images
/$SNAME-fcdsl-$VERSION.
$MACHINE.tgz \
808 lib
/modules
/$KVER/misc
/fcdsl
*.o.gz \
809 lib
/modules
/$KVER-smp/misc
/fcdsl
*.o.gz \
810 usr
/lib
/isdn
/{fds?base.bin
,fd?ubase.frm
} \
811 etc
/fcdsl
/fcdsl
*.conf \
812 etc
/drdsl
/{drdsl
,drdsl.ini
} \
814 var
/run
/{need-depmod-
$KVER,need-depmod-
$KVER-smp} >> $LOGFILE 2>&1
815 rm -f $LFS/license.txt
>> $LOGFILE 2>&1
819 # Generating list of packages used
820 echo "`date -u '+%b %e %T'`: Generating packages list from logs" |
tee -a $LOGFILE
821 rm -f $BASEDIR/doc
/packages-list
822 for i
in `ls -1tr $BASEDIR/log/[^_]*`; do
823 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
824 echo " * `basename $i`" >>$BASEDIR/doc
/packages-list
827 echo "====== List of softwares used to build $NAME Version: $VERSION ======" > $BASEDIR/doc
/packages-list.txt
828 grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|ipcop$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$' \
829 $BASEDIR/doc
/packages-list |
sort >> $BASEDIR/doc
/packages-list.txt
830 rm -f $BASEDIR/doc
/packages-list
831 # packages-list.txt is ready to be displayed for wiki page
833 # Create ISO for CDRom and USB-superfloppy
835 rm -f $LFS/install
/images
/*usb
*
836 cp $LFS/install
/images
/{*.iso
,*.tgz
} $BASEDIR >> $LOGFILE 2>&1
842 rm -rf $BASEDIR/build
/tmp
/*
844 # Generating total list of files
845 echo "`date -u '+%b %e %T'`: Generating files list from logs" |
tee -a $LOGFILE
846 rm -f $BASEDIR/log
/FILES
847 for i
in `ls -1tr $BASEDIR/log/[^_]*`; do
848 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
849 echo "##" >>$BASEDIR/log
/FILES
850 echo "## `basename $i`" >>$BASEDIR/log
/FILES
851 echo "##" >>$BASEDIR/log
/FILES
852 cat $i |
sed "s%^\./%#%" |
sort >> $BASEDIR/log
/FILES
861 if [ -d "$BASEDIR/packages" ]; then
862 for i
in `ls $BASEDIR/packages`; do
863 touch $BASEDIR/build
/install
/packages
/$i.empty
867 ipfiredist applejuice
868 # ipfiredist asterisk
886 ipfiredist spamassassin
887 ipfiredist web-cyradm
890 test -d $BASEDIR/packages || mkdir
$BASEDIR/packages
891 mv -f $LFS/install
/packages
/*.
{tar.gz
,md5
} $BASEDIR/packages
>> $LOGFILE 2>&1
892 rm -rf $BASEDIR/build
/install
/packages
/*
895 # See what we're supposed to do
898 BUILDMACHINE
=`uname -m`
899 PACKAGE
=`ls -v -r $BASEDIR/cache/$SNAME-1.4-toolchain-$BUILDMACHINE.tar.gz 2> /dev/null | head -n 1`
900 #only restore on a clean disk
901 if [ ! -f log
/perl-
*-tools ]; then
902 if [ ! -n "$PACKAGE" ]; then
903 echo "`date -u '+%b %e %T'`: Full toolchain compilation" |
tee -a $LOGFILE
907 PACKAGENAME
=${PACKAGE%.tar.gz}
908 echo "`date -u '+%b %e %T'`: Restore from $PACKAGE" |
tee -a $LOGFILE
909 if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then
913 exiterror
"$PACKAGENAME md5 did not match, check downloaded package"
917 echo "`date -u '+%b %e %T'`: Using installed toolchain" |
tee -a $LOGFILE
924 # Setzen des IPFire Builds
925 if [ "$FIREBUILD" ]; then
926 echo "$FIREBUILD" > $BASEDIR/build
/var
/ipfire
/firebuild
928 echo "_(OvO)_" > $BASEDIR/build
/var
/ipfire
/firebuild
935 # enter a shell inside LFS chroot
936 # may be used to changed kernel settings
941 echo -n "Loading new Changelog from SVN: "
942 svn log http
://svn.ipfire.eu
/svn
/ipfire
> doc
/ChangeLog
946 echo "Checking sources files availability on the web"
947 if [ ! -d $DIR_CHK ]; then
952 for c
in `seq $MAX_RETRIES`; do
953 if (( FINISHED
==1 )); then
959 if [ -f "$i" -a "$i" != "Config" ]; then
960 make -s -f $i MACHINE
=$MACHINE LFS_BASEDIR
=$BASEDIR ROOT
=$BASEDIR/build \
961 MESSAGE
="$i\t ($c/$MAX_RETRIES)" check
962 if [ $?
-ne 0 ]; then
963 echo "Check : wget error in lfs/$i"
972 echo "Erasing sources files availability tags"
976 for i
in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do
977 $LOSETUP -d $i 2>/dev
/null
979 for i
in `mount | grep $BASEDIR | cut -d " " -f 1`; do
983 for i
in `seq 0 7`; do
984 if ( losetup
/dev
/loop
${i} 2>/dev
/null |
grep -q "/install/images" ); then
985 umount
/dev
/loop
${i} 2>/dev
/null
;
986 losetup
-d /dev
/loop
${i} 2>/dev
/null
;
989 rm -rf $BASEDIR/build
990 rm -rf $BASEDIR/cdrom
991 rm -rf $BASEDIR/packages
993 if [ -h /tools
]; then
998 echo -ne "Updating & building source package from SVN: "
1000 svn
export http
://svn.ipfire.eu
/svn
/ipfire ipfire-source
/ --force > /dev
/null
1001 tar cfz ipfire-source-
`date +'%Y-%m-%d'`-r`svn info | grep Revision | cut -c 11-`.
tar.gz ipfire-source
1002 rm ipfire-source
/ -r
1006 # create structure for a new package
1007 echo -e "Name of the new package: $2"
1008 if [ ! -f "lfs/$2" ]; then
1009 echo "`date -u '+%b %e %T'`: Creating directory src/paks/$2"
1010 mkdir
-p src
/paks
/$2
1012 echo "`date -u '+%b %e %T'`: Creating files"
1013 cp $BASEDIR/lfs
/postfix
$BASEDIR/lfs
/$2
1016 touch {,un
}install.sh
1018 echo '#!/bin/bash' > install.sh
1019 echo '#' >> install.sh
1020 echo '#################################################################' >> install.sh
1021 echo '# #' >> install.sh
1022 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> install.sh
1023 echo '# #' >> install.sh
1024 echo '#################################################################' >> install.sh
1025 echo '#' >> install.sh
1026 echo '# Extract the files' >> install.sh
1027 echo 'tar xfz files.tgz -C /' >> install.sh
1028 echo 'cp -f ROOTFILES /opt/pakfire/installed/ROOTFILES.$2' >> install.sh
1030 echo '#!/bin/bash' > uninstall.sh
1031 echo '#################################################################' >> uninstall.sh
1032 echo '# #' >> uninstall.sh
1033 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> uninstall.sh
1034 echo '# #' >> uninstall.sh
1035 echo '#################################################################' >> uninstall.sh
1036 echo '#' >> uninstall.sh
1037 echo '# Delete the files' >> uninstall.sh
1038 echo '## Befehl fehlt noch' >> uninstall.sh
1039 echo 'rm -f /opt/pakfire/installed/ROOTFILES.$2' >> uninstall.sh
1040 echo "`date -u '+%b %e %T'`: Adding files to SVN"
1041 cd - && svn add lfs
/$2 && svn add src
/paks
/$2
1043 echo -n "Do you want to remove the folders? [y/n]"
1045 if [ "$REM" == "y" ]; then
1046 echo "Removing the folders..."
1047 svn del src
/paks
/$2 --force
1049 echo "Folders are kept."
1052 echo "$2 already exists"
1057 if [ ! -d $BASEDIR/cache
]; then
1058 mkdir
$BASEDIR/cache
1060 mkdir
-p $BASEDIR/log
1061 echo "`date -u '+%b %e %T'`:Preload all source files" |
tee -a $LOGFILE
1064 for c
in `seq $MAX_RETRIES`; do
1065 if (( FINISHED
==1 )); then
1071 if [ -f "$i" -a "$i" != "Config" ]; then
1072 make -s -f $i LFS_BASEDIR
=$BASEDIR MESSAGE
="$i\t ($c/$MAX_RETRIES)" download
>> $LOGFILE 2>&1
1073 if [ $?
-ne 0 ]; then
1074 echo "Prefetch : wget error in lfs/$i"
1077 if [ $c -eq 1 ]; then
1078 echo "Prefetch : lfs/$i files loaded"
1084 echo "Prefetch : verifying md5sum"
1087 if [ -f "$i" -a "$i" != "Config" ]; then
1088 make -s -f $i LFS_BASEDIR
=$BASEDIR MESSAGE
="$i\t " md5
>> $LOGFILE 2>&1
1089 if [ $?
-ne 0 ]; then
1090 echo "md5 difference in lfs/$i"
1095 if [ $ERROR -eq 0 ]; then
1096 echo "Prefetch : all files md5sum match"
1103 BUILDMACHINE
=`uname -m`
1104 echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for $BUILDMACHINE" |
tee -a $LOGFILE
1105 cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache
/$SNAME-$VERSION-toolchain-$BUILDMACHINE.
tar.gz \
1106 build
/{bin
,etc
,usr
/bin
,usr
/local} \
1107 build
/tools
/{bin
,etc
,*-linux-gnu,include
,lib
,libexec
,sbin
,share
,var
} \
1109 md5sum cache
/$SNAME-$VERSION-toolchain-$BUILDMACHINE.
tar.gz \
1110 > cache
/$SNAME-$VERSION-toolchain-$BUILDMACHINE.md5
1114 BUILDMACHINE
=`uname -m`
1115 # arbitrary name to be updated in case of new toolchain package upload
1116 PACKAGE
=$SNAME-1.4
-toolchain-$BUILDMACHINE
1117 URL_IPFIRE
=`grep URL_IPFIRE lfs/Config | awk '{ print $3 }'`
1118 echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for $BUILDMACHINE" |
tee -a $LOGFILE
1120 wget
$URL_IPFIRE/toolchains
/$PACKAGE.
tar.gz
$URL_IPFIRE/toolchains
/$PACKAGE.md5
>& /dev
/null
1121 if [ $?
-ne 0 ]; then
1122 echo "`date -u '+%b %e %T'`: error downloading toolchain for $BUILDMACHINE machine" |
tee -a $LOGFILE
1124 if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then
1125 echo "`date -u '+%b %e %T'`: toolchain md5 ok" |
tee -a $LOGFILE
1127 exiterror
"$PACKAGE.md5 did not match, check downloaded package"
1137 echo "Load the latest source-files:"
1141 echo "Upload the changed files:"
1148 echo "Do a complete compile:"
1149 .
/make.sh prefetch
&& .
/make.sh gettoolchain
&& .
/make.sh build
1152 echo -ne "Make a local diff to last SVN revision: "
1153 svn
diff > ipfire-diff-
`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.
diff
1155 echo "Diff was successfully saved to ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff"
1158 echo -e "Syncing Cache to FTP:"
1159 if [ -f .pass
]; then
1162 echo -ne "Password for mirror.ipfire.org: "; read PASS
1164 rm -f doc
/packages-to-remove-from-ftp
1165 ncftpls
-u web3
-p $PASS ftp://mirror.ipfire.org
/html
/source-packages
/source
/ > ftplist
1166 for i
in `ls -w1 cache/`; do
1168 if [ "$?" -ne "0" ]; then
1169 ncftpput
-u web3
-p $PASS mirror.ipfire.org
/html
/source-packages
/source cache
/$i
1170 if [ "$?" -eq "0" ]; then
1171 echo -e "$i was successfully uploaded to the ftp server."
1173 echo -e "There was an error while uploading $i to the ftp server."
1177 for i
in `cat ftplist`; do
1178 ls -w1 cache
/ |
grep $i
1179 if [ "$?" -eq "1" ]; then
1180 echo $i |
grep -v toolchain
>> doc
/packages-to-remove-from-ftp
1186 echo -e "Upload the ISO to the beta-mirror!"
1187 if [ -f .pass
]; then
1190 echo -ne "Password for mirror.ipfire.org: "; read PASS
1192 ncftpls
-u web3
-p $PASS ftp://mirror.ipfire.org
/html
/source-packages
/beta
/ |
grep `svn info | grep Revision | cut -c 11-`
1193 if [ "$?" -eq "1" ]; then
1194 cp $BASEDIR/ipfire-install-1.4.i386.iso
$BASEDIR/ipfire-install-1.4.i386-r
`svn info | grep Revision | cut -c 11-`.iso
1195 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
1196 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
1197 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
1198 if [ "$?" -eq "0" ]; then
1199 echo -e "The ISO of Revision `svn info | grep Revision | cut -c 11-` was successfully uploaded to the ftp server."
1201 echo -e "There was an error while uploading the ISO to the ftp server."
1204 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!"
1206 rm -f ipfire-install-1.4.i386-r
`svn info | grep Revision | cut -c 11-`.iso
{,.md5
}
1209 echo -e "Upload the packages to the beta-mirror!"
1210 if [ -f .pass
]; then
1213 echo -ne "Password for mirror.ipfire.org: "; read PASS
1215 ncftpput
-z -u web3
-p $PASS mirror.ipfire.org
/html
/source-packages
/packages
/ packages
/*
1216 if [ "$?" -eq "0" ]; then
1217 echo -e "The packages were successfully uploaded to the ftp server."
1219 echo -e "There was an error while uploading the packages to the ftp server."
1223 rm -f $BASEDIR/log
/$2*
1224 BUILDMACHINE
=`uname -m`
1231 #echo "Usage: $0 {build|changelog|check|checkclean|clean|commit|diff|dist|gettoolchain|make|newpak|prefetch|pub-iso|pub-paks|shell|sync|toolchain|update}"
1232 #cat doc/make.sh-usage
1233 select name
in "End" "Build IPFire (silent)" "Watch IPFire Build" "Prefetch" "Create Diff" "Get Toolchain" "Update SVN Version" "Sync To Server" "Show Last Log Lines" "Make Clean"
1236 "Update SVN Version")
1237 echo "### SVN UPDATE ###"
1241 echo "### MAKE.SH PREFETCH ###"
1245 echo "### MAKE.SH DIFF ###"
1248 "Build IPFire (silent)")
1249 echo "### MAKE.SH BUILD ###"
1250 screen
-dmS ipfire
$0 build
1251 echo "You can see the status with 'screen -x ipfire'."
1254 echo "### MAKE.SH GETTOOLCHAIN ###"
1261 "Show last log lines")
1264 "Watch IPFire Build")
1265 echo "### MAKE.SH BUILD ###"
1266 echo "Exit with Ctrl+A, Ctrl+D."
1271 echo "### MAKE.SH CLEAN ###"