HinzugefĆ¼gt:
[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
3ea75603
MT
29 SLOGAN="We secure your network" # Software slogan
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
54
55 PWD=`pwd`
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
62
63 if [ 'x86_64' = $MACHINE -o 'i686' = $MACHINE -o 'i586' = $MACHINE -o 'i486' = $MACHINE -o 'i386' = $MACHINE ]; then
5cfe86e6 64
df5e82b3
MT
65 echo "`date -u '+%b %e %T'`: Machine is ix86 (or equivalent)" | tee -a $LOGFILE
66 MACHINE=i386
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"
75 else
76 echo "`date -u '+%b %e %T'`: Can't determine your architecture - $MACHINE" | tee -a $LOGFILE
77 exit 1
78 fi
79
80# Define immediately
81stdumount() {
82 umount $BASEDIR/build/dev/pts 2>/dev/null;
94025eea
MT
83 umount $BASEDIR/build/proc 2>/dev/null;
84 umount $BASEDIR/build/install/mnt 2>/dev/null;
df5e82b3
MT
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;
94025eea
MT
88 umount $BASEDIR/build/usr/src/doc 2>/dev/null;
89 umount $BASEDIR/build/usr/src/html 2>/dev/null;
df5e82b3 90 umount $BASEDIR/build/usr/src/langs 2>/dev/null;
94025eea
MT
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;
df5e82b3
MT
94}
95
96exiterror() {
97 stdumount
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
101 fi;
102 done
103 echo "ERROR: $*"
104 echo " Check $LOGFILE for errors if applicable"
105 exit 1
106}
107
108entershell() {
109 if [ ! -e $BASEDIR/build/usr/src/lfs/ ]; then
110 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/"
111 fi
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 \
119 CCACHE_HASHDIR=1 \
120 KVER=$KVER \
121 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
122 KGCC="ccache /usr/bin/gcc" \
123 /tools/bin/bash
124 if [ $? -ne 0 ]; then
125 exiterror "chroot error"
126 else
127 stdumount
128 fi
129}
130
131prepareenv() {
132 ############################################################################
133 # #
134 # Are we running the right shell? #
135 # #
136 ############################################################################
137 if [ ! "$BASH" ]; then
138 exiterror "BASH environment variable is not set. You're probably running the wrong shell."
139 fi
140
141 if [ -z "${BASH_VERSION}" ]; then
142 exiterror "Not running BASH shell."
143 fi
144
145
146 ############################################################################
147 # #
148 # Trap on emergency exit #
149 # #
150 ############################################################################
151 trap "exiterror 'Build process interrupted'" SIGINT SIGTERM SIGKILL SIGSTOP SIGQUIT
152
153
154 ############################################################################
155 # #
156 # Resetting our nice level #
157 # #
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"
163 fi
164
165 ############################################################################
166 # #
167 # Checking if running as root user #
168 # #
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"
173 fi
174
175
176 ############################################################################
177 # #
178 # Checking for necessary temporary space #
179 # #
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"
188 fi
189 fi
190
191 ############################################################################
192 # #
193 # Building Linux From Scratch system #
194 # #
195 ############################################################################
196 echo "`date -u '+%b %e %T'`: Building Linux From Scratch system" | tee -a $LOGFILE
197
198 # Set umask
199 umask 022
200
201 # Set LFS Directory
202 LFS=$BASEDIR/build
203
204 # Check /tools symlink
205 if [ -h /tools ]; then
206 rm -f /tools
207 fi
208 if [ ! -a /tools ]; then
209 ln -s $BASEDIR/build/tools /
210 fi
211 if [ ! -h /tools ]; then
212 exiterror "Could not create /tools symbolic link."
213 fi
214
215 # Setup environment
216 set +h
217 LC_ALL=POSIX
218 export LFS LC_ALL CFLAGS CXXFLAGS
219 unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
220
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}
225
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
238
239 # Run LFS static binary creation scripts one by one
240 export CCACHE_DIR=$BASEDIR/ccache
241 export CCACHE_HASHDIR=1
242
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
245}
246
247
248############################################################################
249# #
250# Necessary shell functions #
251# #
252############################################################################
253lfsmake1() {
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"
259 fi
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"
263 fi
264 cd $BASEDIR/lfs && make -f $* BUILDTARGET=$BUILDTARGET \
265 MACHINE=$MACHINE \
266 LFS_BASEDIR=$BASEDIR \
267 ROOT=$LFS \
268 KVER=$KVER \
269 install >> $LOGFILE 2>&1
270 if [ $? -ne 0 ]; then
271 exiterror "Building $*";
272 fi
273 else
274 exiterror "No such file or directory: $BASEDIR/$1"
275 fi
276 return 0
277}
278
279lfsmake2() {
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"
285 fi
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"
289 fi
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 \
293 VERSION=$VERSION \
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 \
298 KVER=$KVER \
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 $*"
304 fi
305 else
306 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
307 fi
308 return 0
309}
310
311ipcopmake() {
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"
317 fi
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"
321 fi
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 \
325 VERSION=$VERSION \
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 \
330 KVER=$KVER \
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 $*"
336 fi
337 else
338 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
339 fi
340 return 0
341}
342
e7164bb4
MT
343ipfiredist() {
344 if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then
a68fedca 345# if [ ! `ls -w1 $BASEDIR/packages/*.tar.gz | grep $1` ]; then
e7164bb4 346 echo "`date -u '+%b %e %T'`: Packaging $1" | tee -a $LOGFILE
e7164bb4
MT
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 \
350 VERSION=$VERSION \
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 \
355 KVER=$KVER \
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"
361 fi
a68fedca
MT
362# else
363# echo "`date -u '+%b %e %T'`: Packaging: The package $1 already exists"
364# fi
e7164bb4
MT
365 else
366 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
367 fi
e7164bb4
MT
368 return 0
369}
370
df5e82b3
MT
371
372installmake() {
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"
378 fi
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"
382 fi
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 \
386 VERSION=$VERSION \
387 CONFIG_ROOT=$CONFIG_ROOT \
388 LFS_PASS="install" \
389 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
390 CFLAGS="-Os" CXXFLAGS="-Os" \
391 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
392 KVER=$KVER \
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 $*"
398 fi
399 else
400 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
401 fi
402 return 0
403}
404
405buildtoolchain() {
406 LOGFILE="$BASEDIR/log/_build.toolchain.log"
407 export LOGFILE
408 echo -ne "`date -u '+%b %e %T'`: Stage1 toolchain build \n" | tee -a $LOGFILE
409 # Build sed now, as we use some extensions
410 ORG_PATH=$PATH
411 NATIVEGCC=`gcc --version | grep GCC | awk {'print $3'}`
412 export NATIVEGCC GCCmajor=${NATIVEGCC:0:1} GCCminor=${NATIVEGCC:2:1} GCCrelease=${NATIVEGCC:4:1}
413 lfsmake1 ccache
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
421
422 lfsmake1 linux
423 lfsmake1 tcl
424 lfsmake1 expect
425 lfsmake1 glibc
426 lfsmake1 dejagnu
427 lfsmake1 gcc LFS_PASS=2
428 lfsmake1 binutils LFS_PASS=2
429 lfsmake1 gawk
430 lfsmake1 coreutils
431 lfsmake1 bzip2
432 lfsmake1 gzip
433 lfsmake1 diffutils
434 lfsmake1 findutils
435 lfsmake1 make
436 lfsmake1 grep
437 lfsmake1 sed LFS_PASS=2
438 lfsmake1 m4 LFS_PASS=2
439 lfsmake1 bison LFS_PASS=2
440 lfsmake1 flex LFS_PASS=2
441 lfsmake1 gettext
442 lfsmake1 ncurses
443 lfsmake1 patch
444 lfsmake1 tar
445 lfsmake1 texinfo
446 lfsmake1 bash
447 lfsmake1 util-linux
448 lfsmake1 perl
449 export PATH=$ORG_PATH
450}
451
452buildbase() {
453 LOGFILE="$BASEDIR/log/_build.base.log"
454 export LOGFILE
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
457 lfsmake2 stage2
458 lfsmake2 makedev
459 lfsmake2 linux
460 lfsmake2 man-pages
461 lfsmake2 glibc
462 lfsmake2 binutils
463 lfsmake2 gcc
464 lfsmake2 coreutils
465 lfsmake2 zlib
466 lfsmake2 mktemp
467 lfsmake2 iana-etc
468 lfsmake2 findutils
469 lfsmake2 gawk
470 lfsmake2 ncurses
471 lfsmake2 vim
472 lfsmake2 m4
473 lfsmake2 bison
474 lfsmake2 less
475 lfsmake2 groff
476 lfsmake2 sed
477 lfsmake2 flex
478 lfsmake2 gettext
479 lfsmake2 net-tools
480 lfsmake2 inetutils
481 lfsmake2 perl
482 lfsmake2 texinfo
483 lfsmake2 autoconf
484 lfsmake2 automake
485 lfsmake2 bash
486 lfsmake2 file
487 lfsmake2 libtool
488 lfsmake2 bzip2
489 lfsmake2 diffutils
490 lfsmake2 ed
491 lfsmake2 kbd
492 lfsmake2 e2fsprogs
493 lfsmake2 grep
494 if [ 'i386' = $MACHINE ]; then
495 lfsmake2 grub
496 elif [ 'alpha' = $MACHINE ]; then
497 lfsmake2 aboot
498 fi
499 lfsmake2 gzip
500 lfsmake2 man
501 lfsmake2 make
502 lfsmake2 modutils
503 lfsmake2 patch
504 lfsmake2 procinfo
505 lfsmake2 procps
506 lfsmake2 psmisc
507 lfsmake2 shadow
508 lfsmake2 sysklogd
509 lfsmake2 sysvinit
510 lfsmake2 tar
511 lfsmake2 util-linux
512}
513
514buildipcop() {
907cd036
MT
515 # Run IPFire make scripts one by one
516 LOGFILE="$BASEDIR/log/_build.ipfire.log"
df5e82b3
MT
517 export LOGFILE
518 echo -ne "`date -u '+%b %e %T'`: Stage3 $NAME build \n" | tee -a $LOGFILE
519
520 # Build these first as some of the kernel packages below rely on
521 # these for some of their client program functionality
522 ipcopmake configroot
523 ipcopmake dhcp
524 ipcopmake dhcpcd
525 ipcopmake libusb
526 ipcopmake libpcap
527 ipcopmake linux-atm
528 ipcopmake ppp
529 ipcopmake rp-pppoe
530 ipcopmake unzip
531 # Do SMP now
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.....
3e45cc09
MT
535 ipcopmake linux LFS_PASS=ipfire SMP=installer
536 ipcopmake linux LFS_PASS=ipfire SMP=1
df5e82b3
MT
537 ipcopmake 3cp4218 SMP=1
538 ipcopmake amedyn SMP=1
539 ipcopmake cxacru SMP=1
540 ipcopmake eagle SMP=1
541
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
6ca65b88 550 ipcopmake fcpci SMP=1
ff7df9d4 551 ipcopmake fcclassic SMP=1
df5e82b3
MT
552 ipcopmake pulsar SMP=1
553 ipcopmake unicorn SMP=1
1fde937c 554 ipcopmake promise-sata-300-tx SMP=1
df5e82b3
MT
555 fi
556
3e45cc09 557 ipcopmake linux LFS_PASS=ipfire
df5e82b3
MT
558 ipcopmake 3cp4218
559 ipcopmake amedyn
560 ipcopmake cxacru
561 ipcopmake eciadsl
562 ipcopmake eagle
563 ipcopmake speedtouch
564 if [ 'i386' = $MACHINE ]; then
565 # These are here because they have i386 only binary libraries
566 # included in the package.
567 ipcopmake cnx_pci
568 ipcopmake fcdsl
569 ipcopmake fcdsl2
570 ipcopmake fcdslsl
571 ipcopmake fcdslusb
6ca65b88 572 ipcopmake fcdslslusb
ff7df9d4
MT
573 ipcopmake fcpci
574 ipcopmake fcclassic
1fde937c
MT
575 ipcopmake pulsar
576 ipcopmake unicorn
577 ipcopmake promise-sata-300-tx
df5e82b3
MT
578 fi
579
580 ipcopmake pcmcia-cs
581 ipcopmake expat
582 ipcopmake gdbm
583 ipcopmake gmp
584 ipcopmake openssl
585 ipcopmake python
586 ipcopmake libnet
587 ipcopmake libpng
588 ipcopmake gd
589 ipcopmake popt
590 ipcopmake slang
591 ipcopmake newt
592 ipcopmake libcap
593 ipcopmake pciutils
594 ipcopmake pcre
595 ipcopmake apache
596 ipcopmake arping
597 ipcopmake beep
598 ipcopmake bind
599 ipcopmake capi4k-utils
600 ipcopmake cdrtools
601 ipcopmake dnsmasq
602 ipcopmake dosfstools
603 ipcopmake ethtool
604 ipcopmake ez-ipupdate
605 ipcopmake fcron
606 ipcopmake perl-GD
607 ipcopmake gnupg
608 ipcopmake hdparm
609 ipcopmake ibod
610 ipcopmake initscripts
611 ipcopmake iptables
612 ipcopmake ipac-ng
613 ipcopmake ipaddr
614 ipcopmake iproute2
615 ipcopmake iptstate
616 ipcopmake iputils
78331e30 617 ipcopmake l7-protocols
df5e82b3
MT
618 ipcopmake isapnptools
619 ipcopmake isdn4k-utils
620 ipcopmake kudzu
621 ipcopmake logrotate
622 ipcopmake logwatch
623 ipcopmake mingetty
624 ipcopmake misc-progs
625 ipcopmake mtools
626 ipcopmake nano
627 ipcopmake nash
628 ipcopmake nasm
629 ipcopmake URI
630 ipcopmake HTML-Tagset
631 ipcopmake HTML-Parser
632 ipcopmake Compress-Zlib
633 ipcopmake Digest
634 ipcopmake Digest-SHA1
635 ipcopmake Digest-HMAC
636 ipcopmake libwww-perl
637 ipcopmake Net-DNS
638 ipcopmake Net-IPv4Addr
639 ipcopmake Net_SSLeay
4f8b6695
MT
640 ipcopmake IO-Stringy
641 ipcopmake Unix-Syslog
642 ipcopmake Mail-Tools
643 ipcopmake MIME-Tools
644 ipcopmake Net-Server
645 ipcopmake Convert-TNEF
646 ipcopmake Convert-UUlib
647 ipcopmake Archive-Tar
648 ipcopmake Archive-Zip
f28d0ddc 649 ipcopmake Text-Tabs+Wrap
90350ff3 650 ipcopmake Locale-Country
dace10b5 651 ipcopmake GeoIP
df8c7810 652 ipcopmake fwhits
6d4147d2
MT
653 ipcopmake berkeley
654 ipcopmake BerkeleyDB ## The Perl module
df5e82b3
MT
655 ipcopmake noip_updater
656 ipcopmake ntp
657 ipcopmake oinkmaster
658 ipcopmake openssh
659 ipcopmake openswan
660 ipcopmake pptpclient
661 ipcopmake rrdtool
662 ipcopmake setserial
663 ipcopmake setup
664 ipcopmake snort
665 #ipcopmake speedycgi
6d4147d2
MT
666 ipcopmake saslauthd PASS=1
667 ipcopmake openldap
df5e82b3
MT
668 ipcopmake squid
669 ipcopmake squid-graph
60cbd6e7 670 ipcopmake squidguard
df5e82b3
MT
671 ipcopmake tcpdump
672 ipcopmake traceroute
673 ipcopmake vlan
5fcb6d5a 674 #ipcopmake wireless
df5e82b3
MT
675 ipcopmake libsafe
676 ipcopmake 3c5x9setup
894c6feb 677# echo -ne "`date -u '+%b %e %T'`: Building ### IPFire modules ### \n" | tee -a $LOGFILE
b34fd95d 678 ipcopmake pakfire
6ef0bff8 679 ipcopmake startscripts
5e69ef1a 680## Zuerst die Libs und dann die Programme. Ordnung muss sein!
6ef0bff8 681 ipcopmake java
5e69ef1a 682 ipcopmake libtiff
c3defe9b 683 ipcopmake libjpeg
a7b1824c
MT
684 ipcopmake lcms
685 ipcopmake libmng
686 ipcopmake freetype
687 ipcopmake bootsplash
5e69ef1a
MT
688 ipcopmake libxml2
689 ipcopmake spandsp
690 ipcopmake lzo
6ef0bff8 691 ipcopmake openvpn
f8e5510c
MT
692 ipcopmake pkg-config
693 ipcopmake glib
180cd3be 694 ipcopmake xampp
5e69ef1a
MT
695 ipcopmake pam
696 ipcopmake pammysql
371d9df0 697 ipcopmake saslauthd PASS=2
a31b2bc4 698 ipcopmake xinetd
316160b0
MT
699 ipcopmake ghostscript
700 ipcopmake cups
b34fd95d 701# ipcopmake lpd ## Im Moment aus, da CUPS vorhanden ist.
98d413ac 702 ipcopmake samba
5e69ef1a
MT
703 ipcopmake sudo
704 ipcopmake mc
40a4ea4c
MT
705# ipcopmake pwlib
706# ipcopmake openh323
1fe6c87b 707 ipcopmake wget
60cbd6e7 708 ipcopmake wput
1fe6c87b 709 ipcopmake bridge-utils
3e45cc09
MT
710 ipcopmake screen
711 ipcopmake hddtemp
1fde937c 712 ipcopmake smartmontools
3e45cc09
MT
713 ipcopmake htop
714 ipcopmake lynx
b34fd95d 715 echo -ne "`date -u '+%b %e %T'`: Building ### Mailserver ### \n" | tee -a $LOGFILE
94025eea 716 ipcopmake postfix
6c666a3b 717 ipcopmake procmail
93dc5548
MT
718 ipcopmake fetchmail
719 ipcopmake cyrusimap
f28d0ddc 720 ipcopmake web-cyradm
33a31f1a 721 ipcopmake mailx
f9315063
MT
722 ipcopmake clamav
723 ipcopmake razor
4f8b6695 724 ipcopmake spamassassin
f28d0ddc 725# ipcopmake amavisd
b34fd95d 726 echo -ne "`date -u '+%b %e %T'`: Building ### VoIP-Server ### \n" | tee -a $LOGFILE
94025eea 727 ipcopmake stund
b684b13b
MT
728 ipcopmake zaptel
729 ipcopmake libpri
730 ipcopmake bristuff
40a4ea4c 731 ipcopmake asterisk
894c6feb 732 ipcopmake mpg123
b34fd95d 733 echo -ne "`date -u '+%b %e %T'`: Building ### MP3-Server ### \n" | tee -a $LOGFILE
316160b0
MT
734 ipcopmake lame
735 ipcopmake gnump3d
6ef0bff8
MT
736 echo -ne "`date -u '+%b %e %T'`: Building ### P2P-Clients ### \n" | tee -a $LOGFILE
737 ipcopmake applejuice
02dc0a76
MT
738 ipcopmake ocaml
739 ipcopmake mldonkey
740# ipcopmake edonkeyclc
894c6feb 741# ipcopmake sane
3e45cc09
MT
742 echo -ne "`date -u '+%b %e %T'`: Building ### Net-Tools ### \n" | tee -a $LOGFILE
743 ipcopmake ntop
894c6feb 744# ipcopmake rsync
3b9f6349 745 ipcopmake tcpwrapper
769a61c5 746 ipcopmake portmap
894c6feb 747 ipcopmake nfs
907cd036 748 ipcopmake nmap
52345790 749 ipcopmake mbmon
3e45cc09 750 ipcopmake iftop
ef05c8bb 751 ipcopmake ncftp
ca35618d 752 ipcopmake cftp
60cbd6e7 753 ipcopmake etherwake
33a31f1a 754 ipcopmake ethereal
0eab8e84 755# ipcopmake stunnel # Ausgeschaltet, weil wir es doch nicht nutzen
df5e82b3
MT
756}
757
758buildinstaller() {
759 # Run installer scripts one by one
760 LOGFILE="$BASEDIR/log/_build.installer.log"
761 export LOGFILE
762 echo -ne "`date -u '+%b %e %T'`: Stage4 installer build \n" | tee -a $LOGFILE
763 if [ 'i386' = $MACHINE ]; then
764 ipcopmake syslinux
765 ipcopmake as86
766 ipcopmake mbr
767 ipcopmake uClibc
768 fi
769 installmake busybox
770 installmake sysvinit
771 installmake e2fsprogs
772 installmake misc-progs
773 installmake slang
774 installmake util-linux
775 installmake newt
776 installmake pciutils
777 installmake pcmcia-cs
778 installmake kbd
779 installmake installer
780 installmake scsi.img
781 installmake driver.img
782 installmake initrd
783 installmake boot.img
784}
785
786buildpackages() {
787 LOGFILE="$BASEDIR/log/_build.packages.log"
788 export LOGFILE
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
791 # Strip files
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' \
90350ff3 795 -exec $LFS/tools/bin/strip --strip-all {} \; >> $LOGFILE 2>&1
df5e82b3
MT
796 # add -ls before -exec if you want to verify what files are stripped
797
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
801
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} \
813 license.txt \
814 var/run/{need-depmod-$KVER,need-depmod-$KVER-smp} >> $LOGFILE 2>&1
815 rm -f $LFS/license.txt >> $LOGFILE 2>&1
816 cd $BASEDIR
817 fi
df5e82b3
MT
818
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
3ea75603 824 echo " * `basename $i`" >>$BASEDIR/doc/packages-list
df5e82b3
MT
825 fi
826 done
3ea75603 827 echo "====== List of softwares used to build $NAME Version: $VERSION ======" > $BASEDIR/doc/packages-list.txt
e67a57fe 828 grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|ipcop$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$' \
df5e82b3
MT
829 $BASEDIR/doc/packages-list | sort >> $BASEDIR/doc/packages-list.txt
830 rm -f $BASEDIR/doc/packages-list
c9673262 831 # packages-list.txt is ready to be displayed for wiki page
df5e82b3
MT
832
833 # Create ISO for CDRom and USB-superfloppy
c3defe9b 834 ipcopmake cdrom
e67a57fe 835 rm -f $LFS/install/images/*usb*
c3defe9b 836 cp $LFS/install/images/{*.iso,*.tgz} $BASEDIR >> $LOGFILE 2>&1
c9673262 837
e67a57fe
MT
838 ipfirepackages
839
840 # Cleanup
841 stdumount
842 rm -rf $BASEDIR/build/tmp/*
843
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
853 fi
854 done
855
856 cd $PWD
857
858}
859
860ipfirepackages() {
013a23e2
MT
861 if [ -d "$BASEDIR/packages" ]; then
862 for i in `ls $BASEDIR/packages`; do
863 touch $BASEDIR/build/install/packages/$i.empty
864 done
865 fi
f0ca8c34 866 ipfiredist amavisd
78331e30 867 ipfiredist applejuice
b684b13b 868 # ipfiredist asterisk
c7acba4a 869 ipfiredist clamav
483f59cd 870 ipfiredist cups
78331e30
MT
871 ipfiredist cyrusimap
872 ipfiredist fetchmail
873 ipfiredist gnump3d
0d0521b6 874 ipfiredist java
78331e30
MT
875 ipfiredist lame
876 ipfiredist libtiff
877 ipfiredist libxml2
f0ca8c34
MT
878 ipfiredist mailx
879 ipfiredist nfs
880 ipfiredist nmap
3e45cc09 881 ipfiredist ntop
78331e30 882 ipfiredist postfix
371d9df0 883 ipfiredist procmail
90350ff3 884 ipfiredist samba
f0ca8c34 885 ipfiredist spamassassin
f28d0ddc 886 ipfiredist web-cyradm
483f59cd 887 ipfiredist xampp
78331e30
MT
888 ipfiredist xinetd
889 test -d $BASEDIR/packages || mkdir $BASEDIR/packages
a8b159e7 890 mv -f $LFS/install/packages/*.{tar.gz,md5} $BASEDIR/packages >> $LOGFILE 2>&1
483f59cd 891 rm -rf $BASEDIR/build/install/packages/*
df5e82b3
MT
892}
893
894# See what we're supposed to do
895case "$1" in
896build)
897 BUILDMACHINE=`uname -m`
21757737 898 PACKAGE=`ls -v -r $BASEDIR/cache/$SNAME-1.4-toolchain-$BUILDMACHINE.tar.gz 2> /dev/null | head -n 1`
df5e82b3
MT
899 #only restore on a clean disk
900 if [ ! -f log/perl-*-tools ]; then
901 if [ ! -n "$PACKAGE" ]; then
902 echo "`date -u '+%b %e %T'`: Full toolchain compilation" | tee -a $LOGFILE
903 prepareenv
904 buildtoolchain
905 else
906 PACKAGENAME=${PACKAGE%.tar.gz}
907 echo "`date -u '+%b %e %T'`: Restore from $PACKAGE" | tee -a $LOGFILE
908 if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then
909 tar zxf $PACKAGE
910 prepareenv
911 else
912 exiterror "$PACKAGENAME md5 did not match, check downloaded package"
913 fi
914 fi
915 else
916 echo "`date -u '+%b %e %T'`: Using installed toolchain" | tee -a $LOGFILE
917 prepareenv
918 fi
5cfe86e6 919
df5e82b3
MT
920 buildbase
921 buildipcop
5cfe86e6
HS
922
923 # Setzen des IPFire Builds
8af06406 924 if [ "$FIREBUILD" ]; then
e57bc1fd 925 echo "$FIREBUILD" > $BASEDIR/build/var/ipfire/firebuild
5cfe86e6 926 else
e57bc1fd 927 echo "_(OvO)_" > $BASEDIR/build/var/ipfire/firebuild
5cfe86e6
HS
928 fi
929
df5e82b3
MT
930 buildinstaller
931 buildpackages
932 ;;
933shell)
934 # enter a shell inside LFS chroot
935 # may be used to changed kernel settings
936 prepareenv
937 entershell
938 ;;
939changelog)
d1dd6669 940 echo -n "Loading new Changelog from SVN: "
f9315063 941 svn log http://svn.ipfire.eu/svn/ipfire > doc/ChangeLog
d1dd6669 942 echo "Finished!"
df5e82b3
MT
943 ;;
944check)
945 echo "Checking sources files availability on the web"
946 if [ ! -d $DIR_CHK ]; then
947 mkdir -p $DIR_CHK
948 fi
949 FINISHED=0
950 cd $BASEDIR/lfs
951 for c in `seq $MAX_RETRIES`; do
952 if (( FINISHED==1 )); then
953 break
954 fi
955 FINISHED=1
956 cd $BASEDIR/lfs
957 for i in *; do
958 if [ -f "$i" -a "$i" != "Config" ]; then
959 make -s -f $i MACHINE=$MACHINE LFS_BASEDIR=$BASEDIR ROOT=$BASEDIR/build \
960 MESSAGE="$i\t ($c/$MAX_RETRIES)" check
961 if [ $? -ne 0 ]; then
962 echo "Check : wget error in lfs/$i"
963 FINISHED=0
964 fi
965 fi
966 done
967 done
968 cd -
969 ;;
970checkclean)
971 echo "Erasing sources files availability tags"
972 rm -rf $DIR_CHK/*
973 ;;
974clean)
975 for i in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do
976 $LOSETUP -d $i 2>/dev/null
977 done
978 for i in `mount | grep $BASEDIR | cut -d " " -f 1`; do
979 umount $i
980 done
981 stdumount
982 for i in `seq 0 7`; do
983 if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
984 umount /dev/loop${i} 2>/dev/null;
985 losetup -d /dev/loop${i} 2>/dev/null;
986 fi;
987 done
988 rm -rf $BASEDIR/build
989 rm -rf $BASEDIR/cdrom
f9315063 990 rm -rf $BASEDIR/packages
df5e82b3 991 rm -rf $BASEDIR/log
df5e82b3
MT
992 if [ -h /tools ]; then
993 rm -f /tools
994 fi
995 ;;
996dist)
4f8b6695 997 echo -ne "Updating & building source package from SVN: "
a414d696
MT
998 svn up > /dev/null
999 svn export http://svn.ipfire.eu/svn/ipfire ipfire-source/ --force > /dev/null
ecc898f7
MT
1000 tar cfz ipfire-source-`date +'%Y-%m-%d'`-r`svn info | grep Revision | cut -c 11-`.tar.gz ipfire-source
1001 rm ipfire-source/ -r
4f8b6695 1002 echo "Finished!"
df5e82b3 1003 ;;
f8e5510c 1004newpak)
a9b17001
MT
1005 # create structure for a new package
1006 echo -e "Name of the new package: $2"
1007 if [ ! -f "lfs/$2" ]; then
1008 echo "`date -u '+%b %e %T'`: Creating directory src/paks/$2"
1009 mkdir -p src/paks/$2
1010 cd src/paks/$2
f8e5510c 1011 echo "`date -u '+%b %e %T'`: Creating files"
a9b17001
MT
1012 cp $BASEDIR/lfs/postfix $BASEDIR/lfs/$2
1013
f8e5510c 1014 touch ROOTFILES
f8e5510c 1015 touch {,un}install.sh
a9b17001 1016 ## install.sh
f8e5510c
MT
1017 echo '#!/bin/bash' > install.sh
1018 echo '#' >> install.sh
1019 echo '#################################################################' >> install.sh
1020 echo '# #' >> install.sh
1021 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> install.sh
1022 echo '# #' >> install.sh
1023 echo '#################################################################' >> install.sh
1024 echo '#' >> install.sh
1025 echo '# Extract the files' >> install.sh
1026 echo 'tar xfz files.tgz -C /' >> install.sh
a9b17001
MT
1027 echo 'cp -f ROOTFILES /opt/pakfire/installed/ROOTFILES.$2' >> install.sh
1028 ## uninstall.sh
f8e5510c
MT
1029 echo '#!/bin/bash' > uninstall.sh
1030 echo '#################################################################' >> uninstall.sh
1031 echo '# #' >> uninstall.sh
1032 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> uninstall.sh
1033 echo '# #' >> uninstall.sh
1034 echo '#################################################################' >> uninstall.sh
1035 echo '#' >> uninstall.sh
1036 echo '# Delete the files' >> uninstall.sh
1037 echo '## Befehl fehlt noch' >> uninstall.sh
a9b17001 1038 echo 'rm -f /opt/pakfire/installed/ROOTFILES.$2' >> uninstall.sh
f8e5510c 1039 echo "`date -u '+%b %e %T'`: Adding files to SVN"
a9b17001
MT
1040 cd - && svn add lfs/$2 && svn add src/paks/$2
1041
1042 echo -n "Do you want to remove the folders? [y/n]"
1043 read REM
1044 if [ "$REM" == "y" ]; then
1045 echo "Removing the folders..."
1046 svn del src/paks/$2 --force
1047 else
1048 echo "Folders are kept."
1049 fi
df5e82b3 1050 else
a9b17001 1051 echo "$2 already exists"
df5e82b3 1052 fi
df5e82b3
MT
1053 exit 0
1054 ;;
1055prefetch)
1056 if [ ! -d $BASEDIR/cache ]; then
1057 mkdir $BASEDIR/cache
1058 fi
1059 mkdir -p $BASEDIR/log
1060 echo "`date -u '+%b %e %T'`:Preload all source files" | tee -a $LOGFILE
1061 FINISHED=0
1062 cd $BASEDIR/lfs
1063 for c in `seq $MAX_RETRIES`; do
1064 if (( FINISHED==1 )); then
1065 break
1066 fi
1067 FINISHED=1
1068 cd $BASEDIR/lfs
1069 for i in *; do
1070 if [ -f "$i" -a "$i" != "Config" ]; then
1071 make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t ($c/$MAX_RETRIES)" download >> $LOGFILE 2>&1
1072 if [ $? -ne 0 ]; then
1073 echo "Prefetch : wget error in lfs/$i"
1074 FINISHED=0
1075 else
1076 if [ $c -eq 1 ]; then
1077 echo "Prefetch : lfs/$i files loaded"
1078 fi
1079 fi
1080 fi
1081 done
1082 done
1083 echo "Prefetch : verifying md5sum"
1084 ERROR=0
1085 for i in *; do
1086 if [ -f "$i" -a "$i" != "Config" ]; then
1087 make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t " md5 >> $LOGFILE 2>&1
1088 if [ $? -ne 0 ]; then
1089 echo "md5 difference in lfs/$i"
1090 ERROR=1
1091 fi
1092 fi
1093 done
1094 if [ $ERROR -eq 0 ]; then
1095 echo "Prefetch : all files md5sum match"
1096 fi
1097 cd -
1098 ;;
df5e82b3
MT
1099toolchain)
1100 prepareenv
1101 buildtoolchain
1102 BUILDMACHINE=`uname -m`
1103 echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for $BUILDMACHINE" | tee -a $LOGFILE
1104 cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \
1105 build/{bin,etc,usr/bin,usr/local} \
1106 build/tools/{bin,etc,*-linux-gnu,include,lib,libexec,sbin,share,var} \
1107 log >> $LOGFILE
1108 md5sum cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \
1109 > cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.md5
1110 stdumount
1111 ;;
1112gettoolchain)
1113 BUILDMACHINE=`uname -m`
1114 # arbitrary name to be updated in case of new toolchain package upload
e29556d8
MT
1115 PACKAGE=$SNAME-1.4-toolchain-$BUILDMACHINE
1116 URL_IPFIRE=`grep URL_IPFIRE lfs/Config | awk '{ print $3 }'`
df5e82b3
MT
1117 echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for $BUILDMACHINE" | tee -a $LOGFILE
1118 cd $BASEDIR/cache
21757737 1119 wget $URL_IPFIRE/toolchains/$PACKAGE.tar.gz $URL_IPFIRE/toolchains/$PACKAGE.md5 >& /dev/null
df5e82b3
MT
1120 if [ $? -ne 0 ]; then
1121 echo "`date -u '+%b %e %T'`: error downloading toolchain for $BUILDMACHINE machine" | tee -a $LOGFILE
40a4ea4c
MT
1122 else
1123 if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then
1124 echo "`date -u '+%b %e %T'`: toolchain md5 ok" | tee -a $LOGFILE
1125 else
1126 exiterror "$PACKAGE.md5 did not match, check downloaded package"
1127 fi
df5e82b3
MT
1128 fi
1129 ;;
78331e30
MT
1130paks)
1131 prepareenv
c7acba4a
MT
1132 # buildpackages
1133 ipfirepackages
78331e30 1134 ;;
a9b17001
MT
1135update)
1136 echo "Load the latest source-files:"
1137 svn update
1138 ;;
3b9f6349
MT
1139commit)
1140 echo "Upload the changed files:"
3b9f6349 1141 svn commit
ff7df9d4 1142 ./make.sh sync
4e565351 1143 clear
40a4ea4c 1144 svn up
3b9f6349 1145 ;;
f9315063
MT
1146make)
1147 echo "Do a complete compile:"
78331e30 1148 ./make.sh prefetch && ./make.sh gettoolchain && ./make.sh build
4f8b6695
MT
1149 ;;
1150diff)
1151 echo -ne "Make a local diff to last SVN revision: "
1152 svn diff > ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff
1153 echo "Finished!"
1154 echo "Diff was successfully saved to ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff"
f9315063 1155 ;;
0eab8e84
MT
1156sync)
1157 echo -e "Syncing Cache to FTP:"
a68fedca
MT
1158 if [ -f .pass ]; then
1159 PASS="`cat .pass`"
1160 else
1161 echo -ne "Password for mirror.ipfire.org: "; read PASS
1162 fi
ef05c8bb 1163 rm -f doc/packages-to-remove-from-ftp
0eab8e84
MT
1164 ncftpls -u web3 -p $PASS ftp://mirror.ipfire.org/html/source-packages/source/ > ftplist
1165 for i in `ls -w1 cache/`; do
1166 grep $i ftplist
1167 if [ "$?" -ne "0" ]; then
1168 ncftpput -u web3 -p $PASS mirror.ipfire.org /html/source-packages/source cache/$i
1169 if [ "$?" -eq "0" ]; then
1170 echo -e "$i was successfully uploaded to the ftp server."
1171 else
1172 echo -e "There was an error while uploading $i to the ftp server."
1173 fi
1174 fi
1175 done
ef05c8bb
MT
1176 for i in `cat ftplist`; do
1177 ls -w1 cache/ | grep $i
1178 if [ "$?" -eq "1" ]; then
1179 echo $i | grep -v toolchain >> doc/packages-to-remove-from-ftp
1180 fi
1181 done
0eab8e84
MT
1182 rm -f ftplist
1183 ;;
0d0521b6 1184pub-iso)
e67a57fe 1185 echo -e "Upload the ISO to the beta-mirror!"
a68fedca
MT
1186 if [ -f .pass ]; then
1187 PASS="`cat .pass`"
1188 else
1189 echo -ne "Password for mirror.ipfire.org: "; read PASS
1190 fi
e67a57fe
MT
1191 ncftpls -u web3 -p $PASS ftp://mirror.ipfire.org/html/source-packages/beta/ | grep `svn info | grep Revision | cut -c 11-`
1192 if [ "$?" -eq "1" ]; then
1193 cp $BASEDIR/ipfire-install-1.4.i386.iso $BASEDIR/ipfire-install-1.4.i386-r`svn info | grep Revision | cut -c 11-`.iso
1194 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
1195 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
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.md5
1197 if [ "$?" -eq "0" ]; then
1198 echo -e "The ISO of Revision `svn info | grep Revision | cut -c 11-` was successfully uploaded to the ftp server."
1199 else
1200 echo -e "There was an error while uploading the ISO to the ftp server."
1201 fi
1202 else
1203 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!"
1204 fi
1205 rm -f ipfire-install-1.4.i386-r`svn info | grep Revision | cut -c 11-`.iso{,.md5}
1206 ;;
0d0521b6
MT
1207pub-paks)
1208 echo -e "Upload the packages to the beta-mirror!"
a68fedca
MT
1209 if [ -f .pass ]; then
1210 PASS="`cat .pass`"
1211 else
1212 echo -ne "Password for mirror.ipfire.org: "; read PASS
1213 fi
0d0521b6
MT
1214 ncftpput -z -u web3 -p $PASS mirror.ipfire.org /html/source-packages/packages/ packages/*
1215 if [ "$?" -eq "0" ]; then
1216 echo -e "The packages were successfully uploaded to the ftp server."
1217 else
1218 echo -e "There was an error while uploading the packages to the ftp server."
1219 fi
1220 ;;
52345790
MT
1221build-only)
1222 rm -f $BASEDIR/log/$2*
1223 BUILDMACHINE=`uname -m`
1224 prepareenv
1225 ipcopmake $2
1226 ;;
df5e82b3 1227*)
24a4a744
MT
1228 clear
1229 svn info
1230 #echo "Usage: $0 {build|changelog|check|checkclean|clean|commit|diff|dist|gettoolchain|make|newpak|prefetch|pub-iso|pub-paks|shell|sync|toolchain|update}"
1231 #cat doc/make.sh-usage
02dc0a76 1232 select name in "End" "Build IPFire" "Prefetch" "Create Diff" "Get Toolchain" "Update SVN Version" "Sync to Server"
24a4a744
MT
1233 do
1234 case $name in
1235 "Update SVN Version")
1236 echo "### SVN UPDATE ###"
1237 svn update
1238 ;;
1239 "Prefetch")
1240 echo "### MAKE.SH PREFETCH ###"
1241 $0 prefetch
1242 ;;
1243 "Create Diff")
1244 echo "### MAKE.SH DIFF ###"
1245 $0 diff
1246 ;;
1247 "Build IPFire")
1248 echo "### MAKE.SH BUILD ###"
1249 $0 build
1250 ;;
1251 "Get Toolchain")
1252 echo "### MAKE.SH GETTOOLCHAIN ###"
1253 $0 gettoolchain
1254 ;;
02dc0a76 1255 "Sync to Server")
fce1a47c
RZ
1256 echo "svn commit"
1257 svn commit
2c2d4928 1258 ;;
24a4a744
MT
1259 "End")
1260 break
1261 ;;
1262 esac
1263 done
df5e82b3 1264 ;;
3ea75603 1265esac