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
="1.4" # Version number
29 SLOGAN
="We secure your network" # 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 # Debian specific settings
37 if [ ! -e /etc
/debian_version
]; then
40 if [ -x /usr
/bin
/realpath
]; then
41 FULLPATH
=`/usr/bin/realpath $0`
43 echo "ERROR: Need to do apt-get install realpath"
50 BASENAME
=`basename $0`
51 BASEDIR
=`echo $FULLPATH | sed "s/\/$BASENAME//g"`
52 LOGFILE
=$BASEDIR/log
/_build.preparation.log
53 export BASEDIR LOGFILE
54 DIR_CHK
=$BASEDIR/cache
/check
55 mkdir
$BASEDIR/log
/ 2>/dev
/null
57 if [ 'x86_64' = $MACHINE -o 'i686' = $MACHINE -o 'i586' = $MACHINE -o 'i486' = $MACHINE -o 'i386' = $MACHINE ]; then
59 echo "`date -u '+%b %e %T'`: Machine is ix86 (or equivalent)" |
tee -a $LOGFILE
61 BUILDTARGET
=i386-pc-linux-gnu
62 CFLAGS
="-O2 -mcpu=i386 -march=i386 -pipe -fomit-frame-pointer"
63 CXXFLAGS
="-O2 -mcpu=i386 -march=i386 -pipe -fomit-frame-pointer"
64 elif [ 'alpha' = $MACHINE ]; then
65 echo "`date -u '+%b %e %T'`: Machine is Alpha AXP" |
tee -a $LOGFILE
66 BUILDTARGET
=alpha-unknown-linux-gnu
67 CFLAGS
="-O2 -mcpu=ev4 -mieee -pipe"
68 CXXFLAGS
="-O2 -mcpu=ev4 -mieee -pipe"
70 echo "`date -u '+%b %e %T'`: Can't determine your architecture - $MACHINE" |
tee -a $LOGFILE
76 umount
$BASEDIR/build
/dev
/pts
2>/dev
/null
;
77 umount
$BASEDIR/build
/proc
2>/dev
/null
;
78 umount
$BASEDIR/build
/install
/mnt
2>/dev
/null
;
79 umount
$BASEDIR/build
/usr
/src
/cache
2>/dev
/null
;
80 umount
$BASEDIR/build
/usr
/src
/ccache
2>/dev
/null
;
81 umount
$BASEDIR/build
/usr
/src
/config
2>/dev
/null
;
82 umount
$BASEDIR/build
/usr
/src
/doc
2>/dev
/null
;
83 umount
$BASEDIR/build
/usr
/src
/html
2>/dev
/null
;
84 umount
$BASEDIR/build
/usr
/src
/langs
2>/dev
/null
;
85 umount
$BASEDIR/build
/usr
/src
/lfs
2>/dev
/null
;
86 umount
$BASEDIR/build
/usr
/src
/log
2>/dev
/null
;
87 umount
$BASEDIR/build
/usr
/src
/src
2>/dev
/null
;
92 for i
in `seq 0 7`; do
93 if ( losetup
/dev
/loop
${i} 2>/dev
/null |
grep -q "/install/images" ); then
94 losetup
-d /dev
/loop
${i} 2>/dev
/null
98 echo " Check $LOGFILE for errors if applicable"
103 if [ ! -e $BASEDIR/build
/usr
/src
/lfs
/ ]; then
104 exiterror
"No such file or directory: $BASEDIR/build/usr/src/lfs/"
106 echo "Entering to a shell inside LFS chroot, go out with exit"
107 chroot
$LFS /tools
/bin
/env
-i HOME
=/root TERM
=$TERM PS1
='\u:\w\$ ' \
108 PATH
=/usr
/local
/bin
:/bin
:/usr
/bin
:/sbin
:/usr
/sbin
:/tools
/bin \
109 VERSION
=$VERSION CONFIG_ROOT
=$CONFIG_ROOT \
110 NAME
="$NAME" SNAME
="$SNAME" SLOGAN
="$SLOGAN" \
111 CFLAGS
="$CFLAGS" CXXFLAGS
="$CXXFLAGS" \
112 CCACHE_DIR
=/usr
/src
/ccache \
115 BUILDTARGET
="$BUILDTARGET" MACHINE
="$MACHINE" \
116 KGCC
="ccache /usr/bin/gcc" \
118 if [ $?
-ne 0 ]; then
119 exiterror
"chroot error"
126 ############################################################################
128 # Are we running the right shell? #
130 ############################################################################
131 if [ ! "$BASH" ]; then
132 exiterror
"BASH environment variable is not set. You're probably running the wrong shell."
135 if [ -z "${BASH_VERSION}" ]; then
136 exiterror
"Not running BASH shell."
140 ############################################################################
142 # Trap on emergency exit #
144 ############################################################################
145 trap "exiterror 'Build process interrupted'" SIGINT SIGTERM SIGKILL SIGSTOP SIGQUIT
148 ############################################################################
150 # Resetting our nice level #
152 ############################################################################
153 echo "`date -u '+%b %e %T'`: Resetting our nice level to $NICE" |
tee -a $LOGFILE
154 renice
$NICE $$
> /dev
/null
155 if [ `nice` != "$NICE" ]; then
156 exiterror
"Failed to set correct nice level"
159 ############################################################################
161 # Checking if running as root user #
163 ############################################################################
164 echo "`date -u '+%b %e %T'`: Checking if we're running as root user" |
tee -a $LOGFILE
165 if [ `id -u` != 0 ]; then
166 exiterror
"Not building as root"
170 ############################################################################
172 # Checking for necessary temporary space #
174 ############################################################################
175 echo "`date -u '+%b %e %T'`: Checking for necessary space on disk $BASE_DEV" |
tee -a $LOGFILE
176 BASE_DEV
=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $1 }'`
177 BASE_ASPACE
=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $4 }'`
178 if (( 2202000 > $BASE_ASPACE )); then
179 BASE_USPACE
=`du -skx $BASEDIR | awk '{print $1}'`
180 if (( 2202000 - $BASE_USPACE > $BASE_ASPACE )); then
181 exiterror
"Not enough temporary space available, need at least 2.1GB on $BASE_DEV"
185 ############################################################################
187 # Building Linux From Scratch system #
189 ############################################################################
190 echo "`date -u '+%b %e %T'`: Building Linux From Scratch system" |
tee -a $LOGFILE
198 # Check /tools symlink
199 if [ -h /tools
]; then
202 if [ ! -a /tools
]; then
203 ln -s $BASEDIR/build
/tools
/
205 if [ ! -h /tools
]; then
206 exiterror
"Could not create /tools symbolic link."
212 export LFS LC_ALL CFLAGS CXXFLAGS
213 unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
215 # Make some extra directories
216 mkdir
-p $BASEDIR/build
/{tools
,etc
,usr
/src
} 2>/dev
/null
217 mkdir
-p $BASEDIR/{cache
,ccache
} 2>/dev
/null
218 mkdir
-p $BASEDIR/build
/dev
/pts
$BASEDIR/build
/proc
$BASEDIR/build
/usr
/src
/{cache
,config
,doc
,html
,langs
,lfs
,log
,src
,ccache
}
220 # Make all sources and proc available under lfs build
221 mount
--bind /dev
/pts
$BASEDIR/build
/dev
/pts
222 mount
--bind /proc
$BASEDIR/build
/proc
223 mount
--bind $BASEDIR/cache
$BASEDIR/build
/usr
/src
/cache
224 mount
--bind $BASEDIR/ccache
$BASEDIR/build
/usr
/src
/ccache
225 mount
--bind $BASEDIR/config
$BASEDIR/build
/usr
/src
/config
226 mount
--bind $BASEDIR/doc
$BASEDIR/build
/usr
/src
/doc
227 mount
--bind $BASEDIR/html
$BASEDIR/build
/usr
/src
/html
228 mount
--bind $BASEDIR/langs
$BASEDIR/build
/usr
/src
/langs
229 mount
--bind $BASEDIR/lfs
$BASEDIR/build
/usr
/src
/lfs
230 mount
--bind $BASEDIR/log
$BASEDIR/build
/usr
/src
/log
231 mount
--bind $BASEDIR/src
$BASEDIR/build
/usr
/src
/src
233 # Run LFS static binary creation scripts one by one
234 export CCACHE_DIR
=$BASEDIR/ccache
235 export CCACHE_HASHDIR
=1
237 # Remove pre-install list of installed files in case user erase some files before rebuild
238 rm -f $BASEDIR/build
/usr
/src
/lsalr
2>/dev
/null
242 ############################################################################
244 # Necessary shell functions #
246 ############################################################################
248 if [ -f $BASEDIR/lfs
/$1 ]; then
249 echo "`date -u '+%b %e %T'`: Building $*" |
tee -a $LOGFILE
250 cd $BASEDIR/lfs
&& make -s -f $
* LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t " download
>> $LOGFILE 2>&1
251 if [ $?
-ne 0 ]; then
252 exiterror
"Download error in $1"
254 cd $BASEDIR/lfs
&& make -s -f $
* LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t md5sum" md5
>> $LOGFILE 2>&1
255 if [ $?
-ne 0 ]; then
256 exiterror
"md5sum error in $1, check file in cache or signature"
258 cd $BASEDIR/lfs
&& make -f $
* BUILDTARGET
=$BUILDTARGET \
260 LFS_BASEDIR
=$BASEDIR \
263 install >> $LOGFILE 2>&1
264 if [ $?
-ne 0 ]; then
265 exiterror
"Building $*";
268 exiterror
"No such file or directory: $BASEDIR/$1"
274 if [ -f $BASEDIR/build
/usr
/src
/lfs
/$1 ]; then
275 echo "`date -u '+%b %e %T'`: Building $*" |
tee -a $LOGFILE
276 cd $BASEDIR/lfs
&& make -s -f $
* LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t " download
>> $LOGFILE 2>&1
277 if [ $?
-ne 0 ]; then
278 exiterror
"Download error in $1"
280 cd $BASEDIR/lfs
&& make -s -f $
* LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t md5sum" md5
>> $LOGFILE 2>&1
281 if [ $?
-ne 0 ]; then
282 exiterror
"md5sum error in $1, check file in cache or signature"
284 chroot
$LFS /tools
/bin
/env
-i HOME
=/root \
285 TERM
=$TERM PS1
='\u:\w\$ ' \
286 PATH
=/usr
/local
/bin
:/bin
:/usr
/bin
:/sbin
:/usr
/sbin
:/tools
/bin \
288 CONFIG_ROOT
=$CONFIG_ROOT \
289 NAME
="$NAME" SNAME
="$SNAME" SLOGAN
="$SLOGAN" \
290 CFLAGS
="$CFLAGS" CXXFLAGS
="$CXXFLAGS" \
291 CCACHE_DIR
=/usr
/src
/ccache CCACHE_HASHDIR
=1 \
293 BUILDTARGET
="$BUILDTARGET" MACHINE
="$MACHINE" \
294 /tools
/bin
/bash
-x -c "cd /usr/src/lfs && \
295 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
296 if [ $?
-ne 0 ]; then
297 exiterror
"Building $*"
300 exiterror
"No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
306 if [ -f $BASEDIR/build
/usr
/src
/lfs
/$1 ]; then
307 echo "`date -u '+%b %e %T'`: Building $*" |
tee -a $LOGFILE
308 cd $BASEDIR/lfs
&& make -s -f $
* LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t " download
>> $LOGFILE 2>&1
309 if [ $?
-ne 0 ]; then
310 exiterror
"Download error in $1"
312 cd $BASEDIR/lfs
&& make -s -f $
* LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t md5sum" md5
>> $LOGFILE 2>&1
313 if [ $?
-ne 0 ]; then
314 exiterror
"md5sum error in $1, check file in cache or signature"
316 chroot
$LFS /tools
/bin
/env
-i HOME
=/root \
317 TERM
=$TERM PS1
='\u:\w\$ ' \
318 PATH
=/usr
/local
/bin
:/bin
:/usr
/bin
:/sbin
:/usr
/sbin \
320 CONFIG_ROOT
=$CONFIG_ROOT \
321 NAME
="$NAME" SNAME
="$SNAME" SLOGAN
="$SLOGAN" \
322 CFLAGS
="$CFLAGS" CXXFLAGS
="$CXXFLAGS" \
323 CCACHE_DIR
=/usr
/src
/ccache CCACHE_HASHDIR
=1 \
325 BUILDTARGET
="$BUILDTARGET" MACHINE
="$MACHINE" \
326 /bin
/bash
-x -c "cd /usr/src/lfs && \
327 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
328 if [ $?
-ne 0 ]; then
329 exiterror
"Building $*"
332 exiterror
"No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
338 if [ -f $BASEDIR/build
/usr
/src
/lfs
/$1 ]; then
339 # if [ ! `ls -w1 $BASEDIR/packages/*.tar.gz | grep $1` ]; then
340 echo "`date -u '+%b %e %T'`: Packaging $1" |
tee -a $LOGFILE
341 chroot
$LFS /tools
/bin
/env
-i HOME
=/root \
342 TERM
=$TERM PS1
='\u:\w\$ ' \
343 PATH
=/usr
/local
/bin
:/bin
:/usr
/bin
:/sbin
:/usr
/sbin \
345 CONFIG_ROOT
=$CONFIG_ROOT \
346 NAME
="$NAME" SNAME
="$SNAME" SLOGAN
="$SLOGAN" \
347 CFLAGS
="$CFLAGS" CXXFLAGS
="$CXXFLAGS" \
348 CCACHE_DIR
=/usr
/src
/ccache CCACHE_HASHDIR
=1 \
350 BUILDTARGET
="$BUILDTARGET" MACHINE
="$MACHINE" \
351 /bin
/bash
-x -c "cd /usr/src/lfs && \
352 make -f $1 LFS_BASEDIR=/usr/src dist" >>$LOGFILE 2>&1
353 if [ $?
-ne 0 ]; then
354 exiterror
"Packaging $1"
357 # echo "`date -u '+%b %e %T'`: Packaging: The package $1 already exists"
360 exiterror
"No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
367 if [ -f $BASEDIR/build
/usr
/src
/lfs
/$1 ]; then
368 echo "`date -u '+%b %e %T'`: Building $*" |
tee -a $LOGFILE
369 cd $BASEDIR/lfs
&& make -s -f $
* LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t " download
>> $LOGFILE 2>&1
370 if [ $?
-ne 0 ]; then
371 exiterror
"Download error in $1"
373 cd $BASEDIR/lfs
&& make -s -f $
* LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t md5sum" md5
>> $LOGFILE 2>&1
374 if [ $?
-ne 0 ]; then
375 exiterror
"md5sum error in $1, check file in cache or signature"
377 chroot
$LFS /tools
/bin
/env
-i HOME
=/root \
378 TERM
=$TERM PS1
='\u:\w\$ ' \
379 PATH
=/usr
/local
/bin
:/opt
/$MACHINE-uClibc/usr
/bin
:/bin
:/usr
/bin
:/sbin
:/usr
/sbin \
381 CONFIG_ROOT
=$CONFIG_ROOT \
383 NAME
="$NAME" SNAME
="$SNAME" SLOGAN
="$SLOGAN" \
384 CFLAGS
="-Os" CXXFLAGS
="-Os" \
385 CCACHE_DIR
=/usr
/src
/ccache CCACHE_HASHDIR
=1 \
387 BUILDTARGET
="$BUILDTARGET" MACHINE
="$MACHINE" \
388 /bin
/bash
-x -c "cd /usr/src/lfs && \
389 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
390 if [ $?
-ne 0 ]; then
391 exiterror
"Building $*"
394 exiterror
"No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
400 LOGFILE
="$BASEDIR/log/_build.toolchain.log"
402 echo -ne "`date -u '+%b %e %T'`: Stage1 toolchain build \n" |
tee -a $LOGFILE
403 # Build sed now, as we use some extensions
405 NATIVEGCC
=`gcc --version | grep GCC | awk {'print $3'}`
406 export NATIVEGCC GCCmajor
=${NATIVEGCC:0:1} GCCminor=${NATIVEGCC:2:1} GCCrelease=${NATIVEGCC:4:1}
408 lfsmake1
sed LFS_PASS
=1
409 lfsmake1
m4 LFS_PASS
=1
410 lfsmake1 bison LFS_PASS
=1
411 lfsmake1 flex LFS_PASS
=1
412 lfsmake1 binutils LFS_PASS
=1
413 lfsmake1 gcc LFS_PASS
=1
414 export PATH
=$BASEDIR/build
/usr
/local
/bin
:$BASEDIR/build
/tools
/bin
:$PATH
421 lfsmake1 gcc LFS_PASS
=2
422 lfsmake1 binutils LFS_PASS
=2
431 lfsmake1
sed LFS_PASS
=2
432 lfsmake1
m4 LFS_PASS
=2
433 lfsmake1 bison LFS_PASS
=2
434 lfsmake1 flex LFS_PASS
=2
443 export PATH
=$ORG_PATH
447 LOGFILE
="$BASEDIR/log/_build.base.log"
449 echo -ne "`date -u '+%b %e %T'`: Stage2 linux base build \n" |
tee -a $LOGFILE
450 # Run LFS dynamic binary creation scripts one by one
488 if [ 'i386' = $MACHINE ]; then
490 elif [ 'alpha' = $MACHINE ]; then
509 # Run IPFire make scripts one by one
510 LOGFILE
="$BASEDIR/log/_build.ipfire.log"
512 echo -ne "`date -u '+%b %e %T'`: Stage3 $NAME build \n" |
tee -a $LOGFILE
514 # Build these first as some of the kernel packages below rely on
515 # these for some of their client program functionality
526 if [ 'i386' = $MACHINE ]; then
527 # abuse the SMP flag, and make an minimal installer kernel first
528 # so that the boot floppy always works.....
529 ipcopmake linux LFS_PASS
=ipfire SMP
=installer
530 ipcopmake linux LFS_PASS
=ipfire SMP
=1
531 ipcopmake
3cp4218 SMP
=1
532 ipcopmake amedyn SMP
=1
533 ipcopmake cxacru SMP
=1
534 ipcopmake eagle SMP
=1
536 # These are here because they have i386 only binary libraries
537 # included in the package.
538 ipcopmake cnx_pci SMP
=1
539 ipcopmake fcdsl SMP
=1
540 ipcopmake fcdsl2 SMP
=1
541 ipcopmake fcdslsl SMP
=1
542 ipcopmake fcdslusb SMP
=1
543 ipcopmake fcdslslusb SMP
=1
544 ipcopmake fcpci SMP
=1
545 ipcopmake fcclassic SMP
=1
546 ipcopmake pulsar SMP
=1
547 ipcopmake unicorn SMP
=1
550 ipcopmake linux LFS_PASS
=ipfire
557 if [ 'i386' = $MACHINE ]; then
558 # These are here because they have i386 only binary libraries
559 # included in the package.
591 ipcopmake capi4k-utils
596 ipcopmake ez-ipupdate
602 ipcopmake initscripts
609 ipcopmake l7-protocols
610 ipcopmake isapnptools
611 ipcopmake isdn4k-utils
622 ipcopmake HTML-Tagset
623 ipcopmake HTML-Parser
624 ipcopmake Compress-Zlib
626 ipcopmake Digest-SHA1
627 ipcopmake Digest-HMAC
628 ipcopmake libwww-perl
630 ipcopmake Net-IPv4Addr
633 ipcopmake Unix-Syslog
637 ipcopmake Convert-TNEF
638 ipcopmake Convert-UUlib
639 ipcopmake Archive-Tar
640 ipcopmake Archive-Zip
641 ipcopmake Text-Tabs
+Wrap
642 ipcopmake Locale-Country
646 ipcopmake BerkeleyDB
## The Perl module
647 ipcopmake noip_updater
658 ipcopmake saslauthd PASS
=1
661 ipcopmake squid-graph
669 # echo -ne "`date -u '+%b %e %T'`: Building ### IPFire modules ### \n" | tee -a $LOGFILE
671 ipcopmake startscripts
672 ## Zuerst die Libs und dann die Programme. Ordnung muss sein!
685 ipcopmake saslauthd PASS
=2
687 ipcopmake ghostscript
689 # ipcopmake lpd ## Im Moment aus, da CUPS vorhanden ist.
697 ipcopmake bridge-utils
702 echo -ne "`date -u '+%b %e %T'`: Building ### Mailserver ### \n" |
tee -a $LOGFILE
711 ipcopmake spamassassin
713 echo -ne "`date -u '+%b %e %T'`: Building ### VoIP-Server ### \n" |
tee -a $LOGFILE
717 echo -ne "`date -u '+%b %e %T'`: Building ### MP3-Server ### \n" |
tee -a $LOGFILE
720 echo -ne "`date -u '+%b %e %T'`: Building ### P2P-Clients ### \n" |
tee -a $LOGFILE
724 echo -ne "`date -u '+%b %e %T'`: Building ### Net-Tools ### \n" |
tee -a $LOGFILE
736 # ipcopmake stunnel # Ausgeschaltet, weil wir es doch nicht nutzen
740 # Run installer scripts one by one
741 LOGFILE
="$BASEDIR/log/_build.installer.log"
743 echo -ne "`date -u '+%b %e %T'`: Stage4 installer build \n" |
tee -a $LOGFILE
744 if [ 'i386' = $MACHINE ]; then
752 installmake e2fsprogs
753 installmake misc-progs
755 installmake util-linux
758 installmake pcmcia-cs
760 installmake installer
762 installmake driver.img
768 LOGFILE
="$BASEDIR/log/_build.packages.log"
770 echo "... see detailed log in _build.*.log files" >> $LOGFILE
771 echo -ne "`date -u '+%b %e %T'`: Stage5 packages build \n" |
tee -a $LOGFILE
773 echo "`date -u '+%b %e %T'`: Stripping files" |
tee -a $LOGFILE
774 find $LFS/lib
$LFS/usr
/lib
$LFS/usr
/share
/rrdtool-
* $LFS/install ! -type l \
( -name '*.so' -o -name '*.so[\.0-9]*' \
) \
775 ! -name 'libc.so' ! -name 'libpthread.so' ! -name 'libcrypto.so.0.9.7.sha1' \
776 -exec $LFS/tools
/bin
/strip
--strip-all {} \
; >> $LOGFILE 2>&1
777 # add -ls before -exec if you want to verify what files are stripped
779 find $LFS/{,s
}bin
$LFS/usr
/{,s
}bin
$LFS/usr
/local
/{,s
}bin
! -type l \
780 -exec file {} \
; |
grep " ELF " | cut
-f1 -d ':' |
xargs $LFS/tools
/bin
/strip
--strip-all >> $LOGFILE 2>&1
781 # there add -v to strip to verify
783 if [ 'i386' = $MACHINE ]; then
784 # Create fcdsl packages
785 echo "`date -u '+%b %e %T'`: Building fcdsl tgz" |
tee -a $LOGFILE
786 cp $LFS/install
/images
/fcdsl
/license.txt
$LFS >> $LOGFILE 2>&1
787 touch $LFS/var
/run
/{need-depmod-
$KVER,need-depmod-
$KVER-smp}
788 cd $LFS && tar cvfz
$LFS/install
/images
/$SNAME-fcdsl-$VERSION.
$MACHINE.tgz \
789 lib
/modules
/$KVER/misc
/fcdsl
*.o.gz \
790 lib
/modules
/$KVER-smp/misc
/fcdsl
*.o.gz \
791 usr
/lib
/isdn
/{fds?base.bin
,fd?ubase.frm
} \
792 etc
/fcdsl
/fcdsl
*.conf \
793 etc
/drdsl
/{drdsl
,drdsl.ini
} \
795 var
/run
/{need-depmod-
$KVER,need-depmod-
$KVER-smp} >> $LOGFILE 2>&1
796 rm -f $LFS/license.txt
>> $LOGFILE 2>&1
800 # Generating list of packages used
801 echo "`date -u '+%b %e %T'`: Generating packages list from logs" |
tee -a $LOGFILE
802 rm -f $BASEDIR/doc
/packages-list
803 for i
in `ls -1tr $BASEDIR/log/[^_]*`; do
804 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
805 echo " * `basename $i`" >>$BASEDIR/doc
/packages-list
808 echo "====== List of softwares used to build $NAME Version: $VERSION ======" > $BASEDIR/doc
/packages-list.txt
809 grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|ipcop$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$' \
810 $BASEDIR/doc
/packages-list |
sort >> $BASEDIR/doc
/packages-list.txt
811 rm -f $BASEDIR/doc
/packages-list
812 # packages-list.txt is ready to be displayed for wiki page
814 # Create ISO for CDRom and USB-superfloppy
816 rm -f $LFS/install
/images
/*usb
*
817 cp $LFS/install
/images
/{*.iso
,*.tgz
} $BASEDIR >> $LOGFILE 2>&1
823 rm -rf $BASEDIR/build
/tmp
/*
825 # Generating total list of files
826 echo "`date -u '+%b %e %T'`: Generating files list from logs" |
tee -a $LOGFILE
827 rm -f $BASEDIR/log
/FILES
828 for i
in `ls -1tr $BASEDIR/log/[^_]*`; do
829 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
830 echo "##" >>$BASEDIR/log
/FILES
831 echo "## `basename $i`" >>$BASEDIR/log
/FILES
832 echo "##" >>$BASEDIR/log
/FILES
833 cat $i |
sed "s%^\./%#%" |
sort >> $BASEDIR/log
/FILES
842 for i
in `ls $BASEDIR/packages`; do
843 touch $BASEDIR/build
/install
/packages
/$i.empty
846 ipfiredist applejuice
864 ipfiredist spamassassin
865 ipfiredist web-cyradm
868 test -d $BASEDIR/packages || mkdir
$BASEDIR/packages
869 mv -f $LFS/install
/packages
/*.
{tar.gz
,md5
} $BASEDIR/packages
>> $LOGFILE 2>&1
870 rm -rf $BASEDIR/build
/install
/packages
/*
873 # See what we're supposed to do
876 BUILDMACHINE
=`uname -m`
877 PACKAGE
=`ls -v -r $BASEDIR/cache/$SNAME-1.4-toolchain-$BUILDMACHINE.tar.gz 2> /dev/null | head -n 1`
878 #only restore on a clean disk
879 if [ ! -f log
/perl-
*-tools ]; then
880 if [ ! -n "$PACKAGE" ]; then
881 echo "`date -u '+%b %e %T'`: Full toolchain compilation" |
tee -a $LOGFILE
885 PACKAGENAME
=${PACKAGE%.tar.gz}
886 echo "`date -u '+%b %e %T'`: Restore from $PACKAGE" |
tee -a $LOGFILE
887 if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then
891 exiterror
"$PACKAGENAME md5 did not match, check downloaded package"
895 echo "`date -u '+%b %e %T'`: Using installed toolchain" |
tee -a $LOGFILE
902 # Setzen des IPFire Builds
903 if [ -e .
/.svn
]; then
904 cat .svn
/entries |
sed -n 's/^[ \t]*revision=\"// p' |
sed -n 's/\".*$// p' > $LFS/home
/httpd
/html
/firebuild
906 echo "_(OvO)_" > $LFS/home
/httpd
/html
/firebuild
913 # enter a shell inside LFS chroot
914 # may be used to changed kernel settings
919 echo -n "Loading new Changelog from SVN: "
920 svn log http
://svn.ipfire.eu
/svn
/ipfire
> doc
/ChangeLog
924 echo "Checking sources files availability on the web"
925 if [ ! -d $DIR_CHK ]; then
930 for c
in `seq $MAX_RETRIES`; do
931 if (( FINISHED
==1 )); then
937 if [ -f "$i" -a "$i" != "Config" ]; then
938 make -s -f $i MACHINE
=$MACHINE LFS_BASEDIR
=$BASEDIR ROOT
=$BASEDIR/build \
939 MESSAGE
="$i\t ($c/$MAX_RETRIES)" check
940 if [ $?
-ne 0 ]; then
941 echo "Check : wget error in lfs/$i"
950 echo "Erasing sources files availability tags"
954 for i
in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do
955 $LOSETUP -d $i 2>/dev
/null
957 for i
in `mount | grep $BASEDIR | cut -d " " -f 1`; do
961 for i
in `seq 0 7`; do
962 if ( losetup
/dev
/loop
${i} 2>/dev
/null |
grep -q "/install/images" ); then
963 umount
/dev
/loop
${i} 2>/dev
/null
;
964 losetup
-d /dev
/loop
${i} 2>/dev
/null
;
967 rm -rf $BASEDIR/build
968 rm -rf $BASEDIR/cdrom
969 rm -rf $BASEDIR/packages
971 if [ -h /tools
]; then
976 echo -ne "Updating & building source package from SVN: "
978 svn
export http
://svn.ipfire.eu
/svn
/ipfire ipfire-source
/ --force > /dev
/null
979 tar cfz ipfire-source-
`date +'%Y-%m-%d'`-r`svn info | grep Revision | cut -c 11-`.
tar.gz ipfire-source
984 # create structure for a new package
985 echo -e "Name of the new package: $2"
986 if [ ! -f "lfs/$2" ]; then
987 echo "`date -u '+%b %e %T'`: Creating directory src/paks/$2"
990 echo "`date -u '+%b %e %T'`: Creating files"
991 cp $BASEDIR/lfs
/postfix
$BASEDIR/lfs
/$2
994 touch {,un
}install.sh
996 echo '#!/bin/bash' > install.sh
997 echo '#' >> install.sh
998 echo '#################################################################' >> install.sh
999 echo '# #' >> install.sh
1000 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> install.sh
1001 echo '# #' >> install.sh
1002 echo '#################################################################' >> install.sh
1003 echo '#' >> install.sh
1004 echo '# Extract the files' >> install.sh
1005 echo 'tar xfz files.tgz -C /' >> install.sh
1006 echo 'cp -f ROOTFILES /opt/pakfire/installed/ROOTFILES.$2' >> install.sh
1008 echo '#!/bin/bash' > uninstall.sh
1009 echo '#################################################################' >> uninstall.sh
1010 echo '# #' >> uninstall.sh
1011 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> uninstall.sh
1012 echo '# #' >> uninstall.sh
1013 echo '#################################################################' >> uninstall.sh
1014 echo '#' >> uninstall.sh
1015 echo '# Delete the files' >> uninstall.sh
1016 echo '## Befehl fehlt noch' >> uninstall.sh
1017 echo 'rm -f /opt/pakfire/installed/ROOTFILES.$2' >> uninstall.sh
1018 echo "`date -u '+%b %e %T'`: Adding files to SVN"
1019 cd - && svn add lfs
/$2 && svn add src
/paks
/$2
1021 echo -n "Do you want to remove the folders? [y/n]"
1023 if [ "$REM" == "y" ]; then
1024 echo "Removing the folders..."
1025 svn del src
/paks
/$2 --force
1027 echo "Folders are kept."
1030 echo "$2 already exists"
1035 if [ ! -d $BASEDIR/cache
]; then
1036 mkdir
$BASEDIR/cache
1038 mkdir
-p $BASEDIR/log
1039 echo "`date -u '+%b %e %T'`:Preload all source files" |
tee -a $LOGFILE
1042 for c
in `seq $MAX_RETRIES`; do
1043 if (( FINISHED
==1 )); then
1049 if [ -f "$i" -a "$i" != "Config" ]; then
1050 make -s -f $i LFS_BASEDIR
=$BASEDIR MESSAGE
="$i\t ($c/$MAX_RETRIES)" download
>> $LOGFILE 2>&1
1051 if [ $?
-ne 0 ]; then
1052 echo "Prefetch : wget error in lfs/$i"
1055 if [ $c -eq 1 ]; then
1056 echo "Prefetch : lfs/$i files loaded"
1062 echo "Prefetch : verifying md5sum"
1065 if [ -f "$i" -a "$i" != "Config" ]; then
1066 make -s -f $i LFS_BASEDIR
=$BASEDIR MESSAGE
="$i\t " md5
>> $LOGFILE 2>&1
1067 if [ $?
-ne 0 ]; then
1068 echo "md5 difference in lfs/$i"
1073 if [ $ERROR -eq 0 ]; then
1074 echo "Prefetch : all files md5sum match"
1081 BUILDMACHINE
=`uname -m`
1082 echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for $BUILDMACHINE" |
tee -a $LOGFILE
1083 cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache
/$SNAME-$VERSION-toolchain-$BUILDMACHINE.
tar.gz \
1084 build
/{bin
,etc
,usr
/bin
,usr
/local} \
1085 build
/tools
/{bin
,etc
,*-linux-gnu,include
,lib
,libexec
,sbin
,share
,var
} \
1087 md5sum cache
/$SNAME-$VERSION-toolchain-$BUILDMACHINE.
tar.gz \
1088 > cache
/$SNAME-$VERSION-toolchain-$BUILDMACHINE.md5
1092 BUILDMACHINE
=`uname -m`
1093 # arbitrary name to be updated in case of new toolchain package upload
1094 PACKAGE
=$SNAME-1.4
-toolchain-$BUILDMACHINE
1095 URL_IPFIRE
=`grep URL_IPFIRE lfs/Config | awk '{ print $3 }'`
1096 echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for $BUILDMACHINE" |
tee -a $LOGFILE
1098 wget
$URL_IPFIRE/toolchains
/$PACKAGE.
tar.gz
$URL_IPFIRE/toolchains
/$PACKAGE.md5
>& /dev
/null
1099 if [ $?
-ne 0 ]; then
1100 echo "`date -u '+%b %e %T'`: error downloading toolchain for $BUILDMACHINE machine" |
tee -a $LOGFILE
1102 # if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then
1103 # echo "`date -u '+%b %e %T'`: toolchain md5 ok" | tee -a $LOGFILE
1104 # echo "`date -u '+%b %e %T'`: Uncompressing toolchain" | tee -a $LOGFILE
1105 # cd $BASEDIR && tar xfz cache/$PACKAGE.tar.gz -C .
1106 # rm -f $BASEDIR/cache/$PACKAGE.{tar.gz,md5}
1108 # exiterror "$PACKAGE.md5 did not match, check downloaded package"
1118 echo "Load the latest source-files:"
1122 echo "Upload the changed files:"
1128 echo "Do a complete compile:"
1129 .
/make.sh prefetch
&& .
/make.sh gettoolchain
&& .
/make.sh build
1132 echo -ne "Make a local diff to last SVN revision: "
1133 svn
diff > ipfire-diff-
`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.
diff
1135 echo "Diff was successfully saved to ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff"
1138 echo -e "Syncing Cache to FTP:"
1139 if [ -f .pass
]; then
1142 echo -ne "Password for mirror.ipfire.org: "; read PASS
1144 rm -f doc
/packages-to-remove-from-ftp
1145 ncftpls
-u web3
-p $PASS ftp://mirror.ipfire.org
/html
/source-packages
/source
/ > ftplist
1146 for i
in `ls -w1 cache/`; do
1148 if [ "$?" -ne "0" ]; then
1149 ncftpput
-u web3
-p $PASS mirror.ipfire.org
/html
/source-packages
/source cache
/$i
1150 if [ "$?" -eq "0" ]; then
1151 echo -e "$i was successfully uploaded to the ftp server."
1153 echo -e "There was an error while uploading $i to the ftp server."
1157 for i
in `cat ftplist`; do
1158 ls -w1 cache
/ |
grep $i
1159 if [ "$?" -eq "1" ]; then
1160 echo $i |
grep -v toolchain
>> doc
/packages-to-remove-from-ftp
1166 echo -e "Upload the ISO to the beta-mirror!"
1167 if [ -f .pass
]; then
1170 echo -ne "Password for mirror.ipfire.org: "; read PASS
1172 ncftpls
-u web3
-p $PASS ftp://mirror.ipfire.org
/html
/source-packages
/beta
/ |
grep `svn info | grep Revision | cut -c 11-`
1173 if [ "$?" -eq "1" ]; then
1174 cp $BASEDIR/ipfire-install-1.4.i386.iso
$BASEDIR/ipfire-install-1.4.i386-r
`svn info | grep Revision | cut -c 11-`.iso
1175 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
1176 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
1177 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
1178 if [ "$?" -eq "0" ]; then
1179 echo -e "The ISO of Revision `svn info | grep Revision | cut -c 11-` was successfully uploaded to the ftp server."
1181 echo -e "There was an error while uploading the ISO to the ftp server."
1184 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!"
1186 rm -f ipfire-install-1.4.i386-r
`svn info | grep Revision | cut -c 11-`.iso
{,.md5
}
1189 echo -e "Upload the packages to the beta-mirror!"
1190 if [ -f .pass
]; then
1193 echo -ne "Password for mirror.ipfire.org: "; read PASS
1195 ncftpput
-z -u web3
-p $PASS mirror.ipfire.org
/html
/source-packages
/packages
/ packages
/*
1196 if [ "$?" -eq "0" ]; then
1197 echo -e "The packages were successfully uploaded to the ftp server."
1199 echo -e "There was an error while uploading the packages to the ftp server."
1203 echo "Usage: $0 {build|changelog|check|checkclean|clean|commit|diff|dist|gettoolchain|make|newpak|prefetch|pub-iso|pub-paks|shell|sync|toolchain|update}"
1204 cat doc
/make.sh-usage