GeƤndert:
[ipfire-2.x.git] / make.sh
CommitLineData
df5e82b3
MT
1#!/bin/bash
2#
3############################################################################
4# #
f8e5510c 5# This file is part of the IPFire Firewall. #
df5e82b3 6# #
f8e5510c 7# IPFire is free software; you can redistribute it and/or modify #
df5e82b3
MT
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. #
11# #
f8e5510c 12# IPFire is distributed in the hope that it will be useful, #
df5e82b3
MT
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. #
16# #
17# You should have received a copy of the GNU General Public License #
f8e5510c 18# along with IPFire; if not, write to the Free Software #
df5e82b3
MT
19# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
20# #
f8e5510c 21# Copyright (C) 2006 IPFire-Team <entwickler@ipfire.org>. #
df5e82b3
MT
22# #
23############################################################################
df5e82b3
MT
24#
25
f8e5510c 26 NAME="IPFire" # Software name
3ea75603 27 SNAME="ipfire" # Short name
e3a8510a 28 VERSION="2.0" # Version number
0deae25a 29 SLOGAN="www.ipfire.org" # Software slogan
3ea75603 30 CONFIG_ROOT=/var/ipfire # Configuration rootdir
df5e82b3 31 NICE=10
0eab8e84 32 MAX_RETRIES=3 # prefetch/check loop
df5e82b3
MT
33 KVER=`grep --max-count=1 VER lfs/linux | awk '{ print $3 }'`
34 MACHINE=`uname -m`
35
7476f476
HS
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)"
40 fi
41
df5e82b3
MT
42 # Debian specific settings
43 if [ ! -e /etc/debian_version ]; then
44 FULLPATH=`which $0`
45 else
46 if [ -x /usr/bin/realpath ]; then
47 FULLPATH=`/usr/bin/realpath $0`
48 else
49 echo "ERROR: Need to do apt-get install realpath"
50 exit 1
51 fi
52 fi
53
df5e82b3
MT
54 PWD=`pwd`
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
61
62 if [ 'x86_64' = $MACHINE -o 'i686' = $MACHINE -o 'i586' = $MACHINE -o 'i486' = $MACHINE -o 'i386' = $MACHINE ]; then
c6cb9d25 63 echo "`date -u '+%b %e %T'`: Machine is ix86 (or equivalent)" >> $LOGFILE
df5e82b3
MT
64 MACHINE=i386
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
c6cb9d25 69 echo "`date -u '+%b %e %T'`: Machine is Alpha AXP" >> $LOGFILE
df5e82b3
MT
70 BUILDTARGET=alpha-unknown-linux-gnu
71 CFLAGS="-O2 -mcpu=ev4 -mieee -pipe"
72 CXXFLAGS="-O2 -mcpu=ev4 -mieee -pipe"
73 else
c6cb9d25 74 echo "`date -u '+%b %e %T'`: Can't determine your architecture - $MACHINE" >> $LOGFILE
df5e82b3
MT
75 exit 1
76 fi
77
78# Define immediately
79stdumount() {
80 umount $BASEDIR/build/dev/pts 2>/dev/null;
94025eea
MT
81 umount $BASEDIR/build/proc 2>/dev/null;
82 umount $BASEDIR/build/install/mnt 2>/dev/null;
df5e82b3
MT
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;
94025eea
MT
86 umount $BASEDIR/build/usr/src/doc 2>/dev/null;
87 umount $BASEDIR/build/usr/src/html 2>/dev/null;
df5e82b3 88 umount $BASEDIR/build/usr/src/langs 2>/dev/null;
94025eea
MT
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;
df5e82b3
MT
92}
93
94exiterror() {
95 stdumount
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
99 fi;
100 done
101 echo "ERROR: $*"
102 echo " Check $LOGFILE for errors if applicable"
103 exit 1
104}
105
106entershell() {
107 if [ ! -e $BASEDIR/build/usr/src/lfs/ ]; then
108 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/"
109 fi
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 \
117 CCACHE_HASHDIR=1 \
118 KVER=$KVER \
119 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
120 KGCC="ccache /usr/bin/gcc" \
121 /tools/bin/bash
122 if [ $? -ne 0 ]; then
123 exiterror "chroot error"
124 else
125 stdumount
126 fi
127}
128
129prepareenv() {
130 ############################################################################
131 # #
132 # Are we running the right shell? #
133 # #
134 ############################################################################
135 if [ ! "$BASH" ]; then
136 exiterror "BASH environment variable is not set. You're probably running the wrong shell."
137 fi
138
139 if [ -z "${BASH_VERSION}" ]; then
140 exiterror "Not running BASH shell."
141 fi
142
143
144 ############################################################################
145 # #
146 # Trap on emergency exit #
147 # #
148 ############################################################################
149 trap "exiterror 'Build process interrupted'" SIGINT SIGTERM SIGKILL SIGSTOP SIGQUIT
150
151
152 ############################################################################
153 # #
154 # Resetting our nice level #
155 # #
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"
161 fi
162
163 ############################################################################
164 # #
165 # Checking if running as root user #
166 # #
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"
171 fi
172
173
174 ############################################################################
175 # #
176 # Checking for necessary temporary space #
177 # #
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"
186 fi
187 fi
188
189 ############################################################################
190 # #
191 # Building Linux From Scratch system #
192 # #
193 ############################################################################
194 echo "`date -u '+%b %e %T'`: Building Linux From Scratch system" | tee -a $LOGFILE
195
196 # Set umask
197 umask 022
198
199 # Set LFS Directory
200 LFS=$BASEDIR/build
201
202 # Check /tools symlink
203 if [ -h /tools ]; then
204 rm -f /tools
205 fi
206 if [ ! -a /tools ]; then
207 ln -s $BASEDIR/build/tools /
208 fi
209 if [ ! -h /tools ]; then
210 exiterror "Could not create /tools symbolic link."
211 fi
212
213 # Setup environment
214 set +h
215 LC_ALL=POSIX
216 export LFS LC_ALL CFLAGS CXXFLAGS
217 unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
218
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}
223
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
236
237 # Run LFS static binary creation scripts one by one
238 export CCACHE_DIR=$BASEDIR/ccache
239 export CCACHE_HASHDIR=1
240
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
243}
244
245
246############################################################################
247# #
248# Necessary shell functions #
249# #
250############################################################################
251lfsmake1() {
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"
257 fi
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"
261 fi
262 cd $BASEDIR/lfs && make -f $* BUILDTARGET=$BUILDTARGET \
263 MACHINE=$MACHINE \
264 LFS_BASEDIR=$BASEDIR \
265 ROOT=$LFS \
266 KVER=$KVER \
267 install >> $LOGFILE 2>&1
268 if [ $? -ne 0 ]; then
269 exiterror "Building $*";
270 fi
271 else
272 exiterror "No such file or directory: $BASEDIR/$1"
273 fi
274 return 0
275}
276
277lfsmake2() {
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"
283 fi
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"
287 fi
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 \
291 VERSION=$VERSION \
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 \
296 KVER=$KVER \
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 $*"
302 fi
303 else
304 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
305 fi
306 return 0
307}
308
309ipcopmake() {
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"
315 fi
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"
319 fi
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 \
323 VERSION=$VERSION \
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 \
328 KVER=$KVER \
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 $*"
334 fi
335 else
336 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
337 fi
338 return 0
339}
340
e7164bb4
MT
341ipfiredist() {
342 if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then
a68fedca 343# if [ ! `ls -w1 $BASEDIR/packages/*.tar.gz | grep $1` ]; then
e7164bb4 344 echo "`date -u '+%b %e %T'`: Packaging $1" | tee -a $LOGFILE
e7164bb4
MT
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 \
348 VERSION=$VERSION \
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 \
353 KVER=$KVER \
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"
359 fi
a68fedca
MT
360# else
361# echo "`date -u '+%b %e %T'`: Packaging: The package $1 already exists"
362# fi
e7164bb4
MT
363 else
364 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
365 fi
e7164bb4
MT
366 return 0
367}
368
df5e82b3
MT
369
370installmake() {
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"
376 fi
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"
380 fi
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 \
384 VERSION=$VERSION \
385 CONFIG_ROOT=$CONFIG_ROOT \
386 LFS_PASS="install" \
387 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
388 CFLAGS="-Os" CXXFLAGS="-Os" \
389 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
390 KVER=$KVER \
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 $*"
396 fi
397 else
398 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
399 fi
400 return 0
401}
402
403buildtoolchain() {
404 LOGFILE="$BASEDIR/log/_build.toolchain.log"
405 export LOGFILE
406 echo -ne "`date -u '+%b %e %T'`: Stage1 toolchain build \n" | tee -a $LOGFILE
407 # Build sed now, as we use some extensions
408 ORG_PATH=$PATH
409 NATIVEGCC=`gcc --version | grep GCC | awk {'print $3'}`
410 export NATIVEGCC GCCmajor=${NATIVEGCC:0:1} GCCminor=${NATIVEGCC:2:1} GCCrelease=${NATIVEGCC:4:1}
411 lfsmake1 ccache
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
419
420 lfsmake1 linux
421 lfsmake1 tcl
422 lfsmake1 expect
423 lfsmake1 glibc
424 lfsmake1 dejagnu
425 lfsmake1 gcc LFS_PASS=2
426 lfsmake1 binutils LFS_PASS=2
427 lfsmake1 gawk
428 lfsmake1 coreutils
429 lfsmake1 bzip2
430 lfsmake1 gzip
431 lfsmake1 diffutils
432 lfsmake1 findutils
433 lfsmake1 make
434 lfsmake1 grep
435 lfsmake1 sed LFS_PASS=2
436 lfsmake1 m4 LFS_PASS=2
437 lfsmake1 bison LFS_PASS=2
438 lfsmake1 flex LFS_PASS=2
439 lfsmake1 gettext
440 lfsmake1 ncurses
441 lfsmake1 patch
442 lfsmake1 tar
443 lfsmake1 texinfo
444 lfsmake1 bash
445 lfsmake1 util-linux
446 lfsmake1 perl
447 export PATH=$ORG_PATH
448}
449
450buildbase() {
451 LOGFILE="$BASEDIR/log/_build.base.log"
452 export LOGFILE
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
455 lfsmake2 stage2
456 lfsmake2 makedev
457 lfsmake2 linux
458 lfsmake2 man-pages
459 lfsmake2 glibc
460 lfsmake2 binutils
461 lfsmake2 gcc
462 lfsmake2 coreutils
463 lfsmake2 zlib
464 lfsmake2 mktemp
465 lfsmake2 iana-etc
466 lfsmake2 findutils
467 lfsmake2 gawk
468 lfsmake2 ncurses
469 lfsmake2 vim
470 lfsmake2 m4
471 lfsmake2 bison
472 lfsmake2 less
473 lfsmake2 groff
474 lfsmake2 sed
475 lfsmake2 flex
476 lfsmake2 gettext
477 lfsmake2 net-tools
478 lfsmake2 inetutils
479 lfsmake2 perl
480 lfsmake2 texinfo
481 lfsmake2 autoconf
482 lfsmake2 automake
483 lfsmake2 bash
484 lfsmake2 file
485 lfsmake2 libtool
486 lfsmake2 bzip2
487 lfsmake2 diffutils
488 lfsmake2 ed
489 lfsmake2 kbd
490 lfsmake2 e2fsprogs
491 lfsmake2 grep
492 if [ 'i386' = $MACHINE ]; then
493 lfsmake2 grub
494 elif [ 'alpha' = $MACHINE ]; then
495 lfsmake2 aboot
496 fi
497 lfsmake2 gzip
498 lfsmake2 man
499 lfsmake2 make
500 lfsmake2 modutils
501 lfsmake2 patch
502 lfsmake2 procinfo
503 lfsmake2 procps
504 lfsmake2 psmisc
505 lfsmake2 shadow
506 lfsmake2 sysklogd
507 lfsmake2 sysvinit
508 lfsmake2 tar
509 lfsmake2 util-linux
510}
511
512buildipcop() {
907cd036
MT
513 # Run IPFire make scripts one by one
514 LOGFILE="$BASEDIR/log/_build.ipfire.log"
df5e82b3
MT
515 export LOGFILE
516 echo -ne "`date -u '+%b %e %T'`: Stage3 $NAME build \n" | tee -a $LOGFILE
517
518 # Build these first as some of the kernel packages below rely on
519 # these for some of their client program functionality
520 ipcopmake configroot
521 ipcopmake dhcp
522 ipcopmake dhcpcd
523 ipcopmake libusb
524 ipcopmake libpcap
525 ipcopmake linux-atm
526 ipcopmake ppp
527 ipcopmake rp-pppoe
528 ipcopmake unzip
529 # Do SMP now
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.....
3e45cc09
MT
533 ipcopmake linux LFS_PASS=ipfire SMP=installer
534 ipcopmake linux LFS_PASS=ipfire SMP=1
df5e82b3
MT
535 ipcopmake 3cp4218 SMP=1
536 ipcopmake amedyn SMP=1
537 ipcopmake cxacru SMP=1
538 ipcopmake eagle SMP=1
539
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
6ca65b88 548 ipcopmake fcpci SMP=1
ff7df9d4 549 ipcopmake fcclassic SMP=1
df5e82b3
MT
550 ipcopmake pulsar SMP=1
551 ipcopmake unicorn SMP=1
1fde937c 552 ipcopmake promise-sata-300-tx SMP=1
df5e82b3
MT
553 fi
554
3e45cc09 555 ipcopmake linux LFS_PASS=ipfire
df5e82b3
MT
556 ipcopmake 3cp4218
557 ipcopmake amedyn
558 ipcopmake cxacru
559 ipcopmake eciadsl
560 ipcopmake eagle
561 ipcopmake speedtouch
562 if [ 'i386' = $MACHINE ]; then
563 # These are here because they have i386 only binary libraries
564 # included in the package.
565 ipcopmake cnx_pci
566 ipcopmake fcdsl
567 ipcopmake fcdsl2
568 ipcopmake fcdslsl
569 ipcopmake fcdslusb
6ca65b88 570 ipcopmake fcdslslusb
ff7df9d4
MT
571 ipcopmake fcpci
572 ipcopmake fcclassic
1fde937c
MT
573 ipcopmake pulsar
574 ipcopmake unicorn
575 ipcopmake promise-sata-300-tx
df5e82b3
MT
576 fi
577
578 ipcopmake pcmcia-cs
579 ipcopmake expat
580 ipcopmake gdbm
581 ipcopmake gmp
582 ipcopmake openssl
583 ipcopmake python
584 ipcopmake libnet
585 ipcopmake libpng
586 ipcopmake gd
587 ipcopmake popt
588 ipcopmake slang
589 ipcopmake newt
590 ipcopmake libcap
591 ipcopmake pciutils
592 ipcopmake pcre
593 ipcopmake apache
594 ipcopmake arping
595 ipcopmake beep
596 ipcopmake bind
597 ipcopmake capi4k-utils
598 ipcopmake cdrtools
599 ipcopmake dnsmasq
600 ipcopmake dosfstools
601 ipcopmake ethtool
602 ipcopmake ez-ipupdate
603 ipcopmake fcron
604 ipcopmake perl-GD
605 ipcopmake gnupg
606 ipcopmake hdparm
607 ipcopmake ibod
608 ipcopmake initscripts
609 ipcopmake iptables
610 ipcopmake ipac-ng
611 ipcopmake ipaddr
612 ipcopmake iproute2
613 ipcopmake iptstate
614 ipcopmake iputils
78331e30 615 ipcopmake l7-protocols
df5e82b3
MT
616 ipcopmake isapnptools
617 ipcopmake isdn4k-utils
618 ipcopmake kudzu
619 ipcopmake logrotate
620 ipcopmake logwatch
621 ipcopmake mingetty
622 ipcopmake misc-progs
623 ipcopmake mtools
624 ipcopmake nano
625 ipcopmake nash
626 ipcopmake nasm
627 ipcopmake URI
628 ipcopmake HTML-Tagset
629 ipcopmake HTML-Parser
630 ipcopmake Compress-Zlib
631 ipcopmake Digest
632 ipcopmake Digest-SHA1
633 ipcopmake Digest-HMAC
634 ipcopmake libwww-perl
635 ipcopmake Net-DNS
636 ipcopmake Net-IPv4Addr
637 ipcopmake Net_SSLeay
4f8b6695
MT
638 ipcopmake IO-Stringy
639 ipcopmake Unix-Syslog
640 ipcopmake Mail-Tools
641 ipcopmake MIME-Tools
642 ipcopmake Net-Server
643 ipcopmake Convert-TNEF
644 ipcopmake Convert-UUlib
645 ipcopmake Archive-Tar
646 ipcopmake Archive-Zip
f28d0ddc 647 ipcopmake Text-Tabs+Wrap
90350ff3 648 ipcopmake Locale-Country
dace10b5 649 ipcopmake GeoIP
df8c7810 650 ipcopmake fwhits
6d4147d2
MT
651 ipcopmake berkeley
652 ipcopmake BerkeleyDB ## The Perl module
df5e82b3
MT
653 ipcopmake noip_updater
654 ipcopmake ntp
655 ipcopmake oinkmaster
656 ipcopmake openssh
657 ipcopmake openswan
658 ipcopmake pptpclient
659 ipcopmake rrdtool
660 ipcopmake setserial
661 ipcopmake setup
662 ipcopmake snort
663 #ipcopmake speedycgi
6d4147d2
MT
664 ipcopmake saslauthd PASS=1
665 ipcopmake openldap
df5e82b3
MT
666 ipcopmake squid
667 ipcopmake squid-graph
60cbd6e7 668 ipcopmake squidguard
df5e82b3
MT
669 ipcopmake tcpdump
670 ipcopmake traceroute
671 ipcopmake vlan
5fcb6d5a 672 #ipcopmake wireless
df5e82b3
MT
673 ipcopmake libsafe
674 ipcopmake 3c5x9setup
894c6feb 675# echo -ne "`date -u '+%b %e %T'`: Building ### IPFire modules ### \n" | tee -a $LOGFILE
b34fd95d 676 ipcopmake pakfire
6ef0bff8 677 ipcopmake startscripts
5e69ef1a 678## Zuerst die Libs und dann die Programme. Ordnung muss sein!
6ef0bff8 679 ipcopmake java
5e69ef1a 680 ipcopmake libtiff
c3defe9b 681 ipcopmake libjpeg
a7b1824c
MT
682 ipcopmake lcms
683 ipcopmake libmng
684 ipcopmake freetype
685 ipcopmake bootsplash
5e69ef1a
MT
686 ipcopmake libxml2
687 ipcopmake spandsp
688 ipcopmake lzo
6ef0bff8 689 ipcopmake openvpn
f8e5510c
MT
690 ipcopmake pkg-config
691 ipcopmake glib
180cd3be 692 ipcopmake xampp
5e69ef1a
MT
693 ipcopmake pam
694 ipcopmake pammysql
371d9df0 695 ipcopmake saslauthd PASS=2
a31b2bc4 696 ipcopmake xinetd
316160b0
MT
697 ipcopmake ghostscript
698 ipcopmake cups
b34fd95d 699# ipcopmake lpd ## Im Moment aus, da CUPS vorhanden ist.
98d413ac 700 ipcopmake samba
5e69ef1a
MT
701 ipcopmake sudo
702 ipcopmake mc
40a4ea4c
MT
703# ipcopmake pwlib
704# ipcopmake openh323
1fe6c87b 705 ipcopmake wget
60cbd6e7 706 ipcopmake wput
1fe6c87b 707 ipcopmake bridge-utils
3e45cc09
MT
708 ipcopmake screen
709 ipcopmake hddtemp
1fde937c 710 ipcopmake smartmontools
3e45cc09
MT
711 ipcopmake htop
712 ipcopmake lynx
b34fd95d 713 echo -ne "`date -u '+%b %e %T'`: Building ### Mailserver ### \n" | tee -a $LOGFILE
94025eea 714 ipcopmake postfix
6c666a3b 715 ipcopmake procmail
93dc5548
MT
716 ipcopmake fetchmail
717 ipcopmake cyrusimap
f28d0ddc 718 ipcopmake web-cyradm
33a31f1a 719 ipcopmake mailx
f9315063
MT
720 ipcopmake clamav
721 ipcopmake razor
4f8b6695 722 ipcopmake spamassassin
f28d0ddc 723# ipcopmake amavisd
b34fd95d 724 echo -ne "`date -u '+%b %e %T'`: Building ### VoIP-Server ### \n" | tee -a $LOGFILE
94025eea 725 ipcopmake stund
b684b13b
MT
726 ipcopmake zaptel
727 ipcopmake libpri
728 ipcopmake bristuff
40a4ea4c 729 ipcopmake asterisk
894c6feb 730 ipcopmake mpg123
b34fd95d 731 echo -ne "`date -u '+%b %e %T'`: Building ### MP3-Server ### \n" | tee -a $LOGFILE
316160b0
MT
732 ipcopmake lame
733 ipcopmake gnump3d
6ef0bff8
MT
734 echo -ne "`date -u '+%b %e %T'`: Building ### P2P-Clients ### \n" | tee -a $LOGFILE
735 ipcopmake applejuice
02dc0a76
MT
736 ipcopmake ocaml
737 ipcopmake mldonkey
738# ipcopmake edonkeyclc
894c6feb 739# ipcopmake sane
3e45cc09
MT
740 echo -ne "`date -u '+%b %e %T'`: Building ### Net-Tools ### \n" | tee -a $LOGFILE
741 ipcopmake ntop
894c6feb 742# ipcopmake rsync
3b9f6349 743 ipcopmake tcpwrapper
769a61c5 744 ipcopmake portmap
894c6feb 745 ipcopmake nfs
907cd036 746 ipcopmake nmap
52345790 747 ipcopmake mbmon
3e45cc09 748 ipcopmake iftop
ef05c8bb 749 ipcopmake ncftp
ca35618d 750 ipcopmake cftp
60cbd6e7 751 ipcopmake etherwake
33a31f1a 752 ipcopmake ethereal
0eab8e84 753# ipcopmake stunnel # Ausgeschaltet, weil wir es doch nicht nutzen
df5e82b3
MT
754}
755
756buildinstaller() {
757 # Run installer scripts one by one
758 LOGFILE="$BASEDIR/log/_build.installer.log"
759 export LOGFILE
760 echo -ne "`date -u '+%b %e %T'`: Stage4 installer build \n" | tee -a $LOGFILE
761 if [ 'i386' = $MACHINE ]; then
762 ipcopmake syslinux
763 ipcopmake as86
764 ipcopmake mbr
765 ipcopmake uClibc
766 fi
767 installmake busybox
768 installmake sysvinit
769 installmake e2fsprogs
770 installmake misc-progs
771 installmake slang
772 installmake util-linux
773 installmake newt
774 installmake pciutils
775 installmake pcmcia-cs
776 installmake kbd
777 installmake installer
778 installmake scsi.img
779 installmake driver.img
780 installmake initrd
781 installmake boot.img
782}
783
784buildpackages() {
785 LOGFILE="$BASEDIR/log/_build.packages.log"
786 export LOGFILE
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
789 # Strip files
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' \
90350ff3 793 -exec $LFS/tools/bin/strip --strip-all {} \; >> $LOGFILE 2>&1
df5e82b3
MT
794 # add -ls before -exec if you want to verify what files are stripped
795
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
799
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} \
811 license.txt \
812 var/run/{need-depmod-$KVER,need-depmod-$KVER-smp} >> $LOGFILE 2>&1
813 rm -f $LFS/license.txt >> $LOGFILE 2>&1
814 cd $BASEDIR
815 fi
df5e82b3
MT
816
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
3ea75603 822 echo " * `basename $i`" >>$BASEDIR/doc/packages-list
df5e82b3
MT
823 fi
824 done
3ea75603 825 echo "====== List of softwares used to build $NAME Version: $VERSION ======" > $BASEDIR/doc/packages-list.txt
e67a57fe 826 grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|ipcop$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$' \
df5e82b3
MT
827 $BASEDIR/doc/packages-list | sort >> $BASEDIR/doc/packages-list.txt
828 rm -f $BASEDIR/doc/packages-list
c9673262 829 # packages-list.txt is ready to be displayed for wiki page
df5e82b3
MT
830
831 # Create ISO for CDRom and USB-superfloppy
c3defe9b 832 ipcopmake cdrom
e67a57fe 833 rm -f $LFS/install/images/*usb*
c3defe9b 834 cp $LFS/install/images/{*.iso,*.tgz} $BASEDIR >> $LOGFILE 2>&1
c9673262 835
e67a57fe
MT
836 ipfirepackages
837
838 # Cleanup
839 stdumount
840 rm -rf $BASEDIR/build/tmp/*
841
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
851 fi
852 done
853
854 cd $PWD
855
856}
857
858ipfirepackages() {
013a23e2
MT
859 if [ -d "$BASEDIR/packages" ]; then
860 for i in `ls $BASEDIR/packages`; do
861 touch $BASEDIR/build/install/packages/$i.empty
862 done
863 fi
f0ca8c34 864 ipfiredist amavisd
78331e30 865 ipfiredist applejuice
b684b13b 866 # ipfiredist asterisk
c7acba4a 867 ipfiredist clamav
483f59cd 868 ipfiredist cups
78331e30
MT
869 ipfiredist cyrusimap
870 ipfiredist fetchmail
871 ipfiredist gnump3d
0d0521b6 872 ipfiredist java
78331e30
MT
873 ipfiredist lame
874 ipfiredist libtiff
875 ipfiredist libxml2
f0ca8c34 876 ipfiredist mailx
3ab910dd 877 ipfiredist mldonkey
f0ca8c34
MT
878 ipfiredist nfs
879 ipfiredist nmap
3e45cc09 880 ipfiredist ntop
78331e30 881 ipfiredist postfix
371d9df0 882 ipfiredist procmail
90350ff3 883 ipfiredist samba
f0ca8c34 884 ipfiredist spamassassin
f28d0ddc 885 ipfiredist web-cyradm
483f59cd 886 ipfiredist xampp
78331e30
MT
887 ipfiredist xinetd
888 test -d $BASEDIR/packages || mkdir $BASEDIR/packages
a8b159e7 889 mv -f $LFS/install/packages/*.{tar.gz,md5} $BASEDIR/packages >> $LOGFILE 2>&1
483f59cd 890 rm -rf $BASEDIR/build/install/packages/*
df5e82b3
MT
891}
892
893# See what we're supposed to do
894case "$1" in
895build)
896 BUILDMACHINE=`uname -m`
c6cb9d25 897 PACKAGE=`ls -v -r $BASEDIR/cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz 2> /dev/null | head -n 1`
df5e82b3
MT
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
902 prepareenv
903 buildtoolchain
904 else
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
908 tar zxf $PACKAGE
909 prepareenv
910 else
911 exiterror "$PACKAGENAME md5 did not match, check downloaded package"
912 fi
913 fi
914 else
915 echo "`date -u '+%b %e %T'`: Using installed toolchain" | tee -a $LOGFILE
916 prepareenv
917 fi
5cfe86e6 918
df5e82b3
MT
919 buildbase
920 buildipcop
5cfe86e6
HS
921
922 # Setzen des IPFire Builds
8af06406 923 if [ "$FIREBUILD" ]; then
e57bc1fd 924 echo "$FIREBUILD" > $BASEDIR/build/var/ipfire/firebuild
5cfe86e6 925 else
e57bc1fd 926 echo "_(OvO)_" > $BASEDIR/build/var/ipfire/firebuild
5cfe86e6
HS
927 fi
928
df5e82b3
MT
929 buildinstaller
930 buildpackages
931 ;;
932shell)
933 # enter a shell inside LFS chroot
934 # may be used to changed kernel settings
935 prepareenv
936 entershell
937 ;;
938changelog)
d1dd6669 939 echo -n "Loading new Changelog from SVN: "
f9315063 940 svn log http://svn.ipfire.eu/svn/ipfire > doc/ChangeLog
d1dd6669 941 echo "Finished!"
df5e82b3
MT
942 ;;
943check)
944 echo "Checking sources files availability on the web"
945 if [ ! -d $DIR_CHK ]; then
946 mkdir -p $DIR_CHK
947 fi
948 FINISHED=0
949 cd $BASEDIR/lfs
950 for c in `seq $MAX_RETRIES`; do
951 if (( FINISHED==1 )); then
952 break
953 fi
954 FINISHED=1
955 cd $BASEDIR/lfs
956 for i in *; do
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"
962 FINISHED=0
963 fi
964 fi
965 done
966 done
967 cd -
968 ;;
969checkclean)
970 echo "Erasing sources files availability tags"
971 rm -rf $DIR_CHK/*
972 ;;
973clean)
974 for i in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do
975 $LOSETUP -d $i 2>/dev/null
976 done
977 for i in `mount | grep $BASEDIR | cut -d " " -f 1`; do
978 umount $i
979 done
980 stdumount
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;
985 fi;
986 done
987 rm -rf $BASEDIR/build
988 rm -rf $BASEDIR/cdrom
f9315063 989 rm -rf $BASEDIR/packages
df5e82b3 990 rm -rf $BASEDIR/log
df5e82b3
MT
991 if [ -h /tools ]; then
992 rm -f /tools
993 fi
994 ;;
f8e5510c 995newpak)
a9b17001
MT
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
1001 cd src/paks/$2
f8e5510c 1002 echo "`date -u '+%b %e %T'`: Creating files"
a9b17001
MT
1003 cp $BASEDIR/lfs/postfix $BASEDIR/lfs/$2
1004
f8e5510c 1005 touch ROOTFILES
f8e5510c 1006 touch {,un}install.sh
a9b17001 1007 ## install.sh
f8e5510c
MT
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
a9b17001
MT
1018 echo 'cp -f ROOTFILES /opt/pakfire/installed/ROOTFILES.$2' >> install.sh
1019 ## uninstall.sh
f8e5510c
MT
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
a9b17001 1029 echo 'rm -f /opt/pakfire/installed/ROOTFILES.$2' >> uninstall.sh
f8e5510c 1030 echo "`date -u '+%b %e %T'`: Adding files to SVN"
a9b17001
MT
1031 cd - && svn add lfs/$2 && svn add src/paks/$2
1032
1033 echo -n "Do you want to remove the folders? [y/n]"
1034 read REM
1035 if [ "$REM" == "y" ]; then
1036 echo "Removing the folders..."
1037 svn del src/paks/$2 --force
1038 else
1039 echo "Folders are kept."
1040 fi
df5e82b3 1041 else
a9b17001 1042 echo "$2 already exists"
df5e82b3 1043 fi
df5e82b3
MT
1044 exit 0
1045 ;;
1046prefetch)
1047 if [ ! -d $BASEDIR/cache ]; then
1048 mkdir $BASEDIR/cache
1049 fi
1050 mkdir -p $BASEDIR/log
1051 echo "`date -u '+%b %e %T'`:Preload all source files" | tee -a $LOGFILE
1052 FINISHED=0
1053 cd $BASEDIR/lfs
1054 for c in `seq $MAX_RETRIES`; do
1055 if (( FINISHED==1 )); then
1056 break
1057 fi
1058 FINISHED=1
1059 cd $BASEDIR/lfs
1060 for i in *; do
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"
1065 FINISHED=0
1066 else
1067 if [ $c -eq 1 ]; then
1068 echo "Prefetch : lfs/$i files loaded"
1069 fi
1070 fi
1071 fi
1072 done
1073 done
1074 echo "Prefetch : verifying md5sum"
1075 ERROR=0
1076 for i in *; do
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"
1081 ERROR=1
1082 fi
1083 fi
1084 done
1085 if [ $ERROR -eq 0 ]; then
1086 echo "Prefetch : all files md5sum match"
1087 fi
1088 cd -
1089 ;;
df5e82b3
MT
1090toolchain)
1091 prepareenv
1092 buildtoolchain
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} \
1098 log >> $LOGFILE
1099 md5sum cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \
1100 > cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.md5
1101 stdumount
1102 ;;
1103gettoolchain)
1104 BUILDMACHINE=`uname -m`
1105 # arbitrary name to be updated in case of new toolchain package upload
c6cb9d25 1106 PACKAGE=$SNAME-$VERSION-toolchain-$BUILDMACHINE
e29556d8 1107 URL_IPFIRE=`grep URL_IPFIRE lfs/Config | awk '{ print $3 }'`
df5e82b3
MT
1108 echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for $BUILDMACHINE" | tee -a $LOGFILE
1109 cd $BASEDIR/cache
21757737 1110 wget $URL_IPFIRE/toolchains/$PACKAGE.tar.gz $URL_IPFIRE/toolchains/$PACKAGE.md5 >& /dev/null
df5e82b3
MT
1111 if [ $? -ne 0 ]; then
1112 echo "`date -u '+%b %e %T'`: error downloading toolchain for $BUILDMACHINE machine" | tee -a $LOGFILE
40a4ea4c
MT
1113 else
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
1116 else
1117 exiterror "$PACKAGE.md5 did not match, check downloaded package"
1118 fi
df5e82b3
MT
1119 fi
1120 ;;
c6cb9d25
MT
1121svn)
1122 case "$2" in
1123 update|up)
1124 clear
1125 echo -n "Load the latest source files..."
1126 svn update >> $PWD/log/_build.svn.update.log
1127 if [ $? -eq 0 ]; then
1128 echo ".Done!"
1129 else
1130 echo ".Fail!"
1131 exit 1
1132 fi
1133 echo -n "Write the svn info to a file..."
1134 svn info > $PWD/svn_status
1135 if [ "$?" -eq "0" ]; then
1136 echo ".Done!"
1137 else
1138 echo ".Fail!"
1139 exit 1
1140 fi
1141 ;;
1142 commit|ci)
1143 clear
1144 echo "Upload the changed files..."
1145 sleep 1
1146 svn commit
1147 $0 svn up
1148 ;;
1149 dist)
1150 $0 svn up
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
1154 echo ".Done!"
1155 else
1156 echo ".Fail!"
1157 exit 1
1158 fi
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
1162 echo ".Done!"
1163 else
1164 echo ".Fail!"
1165 exit 1
1166 fi
1167 echo -n "Cleanup..."
1168 rm ipfire-source/ -r
1169 if [ "$?" -eq "0" ]; then
1170 echo ".Done!"
1171 else
1172 echo ".Fail!"
1173 exit 1
1174 fi
1175 ;;
1176 diff)
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
1180 echo ".Done!"
1181 else
1182 echo ".Fail!"
1183 exit 1
1184 fi
1185 echo "Diff was successfully saved to ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff"
1186 ;;
1187 esac
f9315063 1188 ;;
0eab8e84
MT
1189sync)
1190 echo -e "Syncing Cache to FTP:"
a68fedca
MT
1191 if [ -f .pass ]; then
1192 PASS="`cat .pass`"
1193 else
1194 echo -ne "Password for mirror.ipfire.org: "; read PASS
1195 fi
ef05c8bb 1196 rm -f doc/packages-to-remove-from-ftp
0eab8e84
MT
1197 ncftpls -u web3 -p $PASS ftp://mirror.ipfire.org/html/source-packages/source/ > ftplist
1198 for i in `ls -w1 cache/`; do
1199 grep $i ftplist
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."
1204 else
1205 echo -e "There was an error while uploading $i to the ftp server."
1206 fi
1207 fi
1208 done
ef05c8bb
MT
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
1213 fi
1214 done
0eab8e84
MT
1215 rm -f ftplist
1216 ;;
0d0521b6 1217pub-iso)
e67a57fe 1218 echo -e "Upload the ISO to the beta-mirror!"
a68fedca
MT
1219 if [ -f .pass ]; then
1220 PASS="`cat .pass`"
1221 else
1222 echo -ne "Password for mirror.ipfire.org: "; read PASS
1223 fi
e67a57fe
MT
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."
1232 else
1233 echo -e "There was an error while uploading the ISO to the ftp server."
1234 fi
1235 else
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!"
1237 fi
1238 rm -f ipfire-install-1.4.i386-r`svn info | grep Revision | cut -c 11-`.iso{,.md5}
1239 ;;
0d0521b6
MT
1240pub-paks)
1241 echo -e "Upload the packages to the beta-mirror!"
a68fedca
MT
1242 if [ -f .pass ]; then
1243 PASS="`cat .pass`"
1244 else
1245 echo -ne "Password for mirror.ipfire.org: "; read PASS
1246 fi
0d0521b6
MT
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."
1250 else
1251 echo -e "There was an error while uploading the packages to the ftp server."
1252 fi
1253 ;;
52345790
MT
1254build-only)
1255 rm -f $BASEDIR/log/$2*
1256 BUILDMACHINE=`uname -m`
1257 prepareenv
1258 ipcopmake $2
1259 ;;
c6cb9d25
MT
1260build-silent)
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'."
1264 ;;
df5e82b3 1265*)
24a4a744
MT
1266 clear
1267 svn info
c6cb9d25 1268 select name in "Exit" "IPFIRE: Prefetch" "IPFIRE: Build (silent)" "IPFIRE: Watch Build" "IPFIRE: Clean" "SVN: Commit" "SVN: Update" "SVN: Status" "SVN: Diff" "Help"
24a4a744
MT
1269 do
1270 case $name in
c6cb9d25
MT
1271 "IPFIRE: Prefetch")
1272 $0 prefetch
1273 ;;
1274 "IPFIRE: Build (silent)")
1275 $0 build-silent
1276 ;;
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 "."
1282 done
1283 echo ".Ready!"
1284 sleep 0.5
1285 screen -x ipfire
1286 ;;
1287 "IPFIRE: Clean")
1288 $0 clean
1289 ;;
1290 "SVN: Commit")
1291 $0 svn commit
1292 ;;
1293 "SVN: Update")
1294 $0 svn update
1295 ;;
1296 "SVN: Status")
1297 svn status # | grep -v ^?
1298 ;;
1299 "SVN: Diff")
1300 $0 svn diff
1301 ;;
1302 "Help")
1303 echo "Usage: $0 {build|changelog|check|checkclean|clean|gettoolchain|newpak|prefetch|shell|sync|toolchain}"
1304 cat doc/make.sh-usage
1305 ;;
1306 "Exit")
1307 break
1308 ;;
24a4a744
MT
1309 esac
1310 done
df5e82b3 1311 ;;
3ea75603 1312esac