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
f8e5510c 28 VERSION="1.4" # Version number
3ea75603
MT
29# PREVIOUSTAG=IPCOP_v1_4_10_FINAL
30 SLOGAN="We secure your network" # Software slogan
31 CONFIG_ROOT=/var/ipfire # Configuration rootdir
df5e82b3 32 NICE=10
94025eea 33 MAX_RETRIES=3 # prefetch/check loop
df5e82b3
MT
34 KVER=`grep --max-count=1 VER lfs/linux | awk '{ print $3 }'`
35 MACHINE=`uname -m`
36
37 # Debian specific settings
38 if [ ! -e /etc/debian_version ]; then
39 FULLPATH=`which $0`
40 else
41 if [ -x /usr/bin/realpath ]; then
42 FULLPATH=`/usr/bin/realpath $0`
43 else
44 echo "ERROR: Need to do apt-get install realpath"
45 exit 1
46 fi
47 fi
48
49
50 PWD=`pwd`
51 BASENAME=`basename $0`
52 BASEDIR=`echo $FULLPATH | sed "s/\/$BASENAME//g"`
53 LOGFILE=$BASEDIR/log/_build.preparation.log
54 export BASEDIR LOGFILE
55 DIR_CHK=$BASEDIR/cache/check
56 mkdir $BASEDIR/log/ 2>/dev/null
57
58 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
60 MACHINE=i386
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"
69 else
70 echo "`date -u '+%b %e %T'`: Can't determine your architecture - $MACHINE" | tee -a $LOGFILE
71 exit 1
72 fi
73
74# Define immediately
75stdumount() {
76 umount $BASEDIR/build/dev/pts 2>/dev/null;
94025eea
MT
77 umount $BASEDIR/build/proc 2>/dev/null;
78 umount $BASEDIR/build/install/mnt 2>/dev/null;
df5e82b3
MT
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;
94025eea
MT
82 umount $BASEDIR/build/usr/src/doc 2>/dev/null;
83 umount $BASEDIR/build/usr/src/html 2>/dev/null;
df5e82b3 84 umount $BASEDIR/build/usr/src/langs 2>/dev/null;
94025eea
MT
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;
df5e82b3
MT
88}
89
90exiterror() {
91 stdumount
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
95 fi;
96 done
97 echo "ERROR: $*"
98 echo " Check $LOGFILE for errors if applicable"
99 exit 1
100}
101
102entershell() {
103 if [ ! -e $BASEDIR/build/usr/src/lfs/ ]; then
104 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/"
105 fi
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 \
113 CCACHE_HASHDIR=1 \
114 KVER=$KVER \
115 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
116 KGCC="ccache /usr/bin/gcc" \
117 /tools/bin/bash
118 if [ $? -ne 0 ]; then
119 exiterror "chroot error"
120 else
121 stdumount
122 fi
123}
124
125prepareenv() {
126 ############################################################################
127 # #
128 # Are we running the right shell? #
129 # #
130 ############################################################################
131 if [ ! "$BASH" ]; then
132 exiterror "BASH environment variable is not set. You're probably running the wrong shell."
133 fi
134
135 if [ -z "${BASH_VERSION}" ]; then
136 exiterror "Not running BASH shell."
137 fi
138
139
140 ############################################################################
141 # #
142 # Trap on emergency exit #
143 # #
144 ############################################################################
145 trap "exiterror 'Build process interrupted'" SIGINT SIGTERM SIGKILL SIGSTOP SIGQUIT
146
147
148 ############################################################################
149 # #
150 # Resetting our nice level #
151 # #
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"
157 fi
158
159 ############################################################################
160 # #
161 # Checking if running as root user #
162 # #
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"
167 fi
168
169
170 ############################################################################
171 # #
172 # Checking for necessary temporary space #
173 # #
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"
182 fi
183 fi
184
185 ############################################################################
186 # #
187 # Building Linux From Scratch system #
188 # #
189 ############################################################################
190 echo "`date -u '+%b %e %T'`: Building Linux From Scratch system" | tee -a $LOGFILE
191
192 # Set umask
193 umask 022
194
195 # Set LFS Directory
196 LFS=$BASEDIR/build
197
198 # Check /tools symlink
199 if [ -h /tools ]; then
200 rm -f /tools
201 fi
202 if [ ! -a /tools ]; then
203 ln -s $BASEDIR/build/tools /
204 fi
205 if [ ! -h /tools ]; then
206 exiterror "Could not create /tools symbolic link."
207 fi
208
209 # Setup environment
210 set +h
211 LC_ALL=POSIX
212 export LFS LC_ALL CFLAGS CXXFLAGS
213 unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
214
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}
219
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
232
233 # Run LFS static binary creation scripts one by one
234 export CCACHE_DIR=$BASEDIR/ccache
235 export CCACHE_HASHDIR=1
236
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
239}
240
241
242############################################################################
243# #
244# Necessary shell functions #
245# #
246############################################################################
247lfsmake1() {
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"
253 fi
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"
257 fi
258 cd $BASEDIR/lfs && make -f $* BUILDTARGET=$BUILDTARGET \
259 MACHINE=$MACHINE \
260 LFS_BASEDIR=$BASEDIR \
261 ROOT=$LFS \
262 KVER=$KVER \
263 install >> $LOGFILE 2>&1
264 if [ $? -ne 0 ]; then
265 exiterror "Building $*";
266 fi
267 else
268 exiterror "No such file or directory: $BASEDIR/$1"
269 fi
270 return 0
271}
272
273lfsmake2() {
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"
279 fi
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"
283 fi
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 \
287 VERSION=$VERSION \
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 \
292 KVER=$KVER \
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 $*"
298 fi
299 else
300 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
301 fi
302 return 0
303}
304
305ipcopmake() {
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"
311 fi
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"
315 fi
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 \
319 VERSION=$VERSION \
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 \
324 KVER=$KVER \
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 $*"
330 fi
331 else
332 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
333 fi
334 return 0
335}
336
e7164bb4
MT
337ipfiredist() {
338 if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then
339 echo "`date -u '+%b %e %T'`: Packaging $1" | tee -a $LOGFILE
340 cp -f $BASEDIR/src/scripts/make-packages.sh $BASEDIR/build/usr/sbin/
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 \
344 VERSION=$VERSION \
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 \
349 KVER=$KVER \
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"
355 fi
356 else
357 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
358 fi
359 if [ -e $BASEDIR/packages ]; then
360 mv -f $BASEDIR/build/paks/* $BASEDIR/packages/
361 else
362 mkdir -p $BASEDIR/packages
363 mv -f $BASEDIR/build/paks/* $BASEDIR/packages/
364 fi
365 return 0
366}
367
df5e82b3
MT
368
369installmake() {
370 if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then
371 echo "`date -u '+%b %e %T'`: Building $*" | tee -a $LOGFILE
372 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t " download >> $LOGFILE 2>&1
373 if [ $? -ne 0 ]; then
374 exiterror "Download error in $1"
375 fi
376 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1
377 if [ $? -ne 0 ]; then
378 exiterror "md5sum error in $1, check file in cache or signature"
379 fi
380 chroot $LFS /tools/bin/env -i HOME=/root \
381 TERM=$TERM PS1='\u:\w\$ ' \
382 PATH=/usr/local/bin:/opt/$MACHINE-uClibc/usr/bin:/bin:/usr/bin:/sbin:/usr/sbin \
383 VERSION=$VERSION \
384 CONFIG_ROOT=$CONFIG_ROOT \
385 LFS_PASS="install" \
386 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
387 CFLAGS="-Os" CXXFLAGS="-Os" \
388 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
389 KVER=$KVER \
390 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
391 /bin/bash -x -c "cd /usr/src/lfs && \
392 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
393 if [ $? -ne 0 ]; then
394 exiterror "Building $*"
395 fi
396 else
397 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
398 fi
399 return 0
400}
401
402buildtoolchain() {
403 LOGFILE="$BASEDIR/log/_build.toolchain.log"
404 export LOGFILE
405 echo -ne "`date -u '+%b %e %T'`: Stage1 toolchain build \n" | tee -a $LOGFILE
406 # Build sed now, as we use some extensions
407 ORG_PATH=$PATH
408 NATIVEGCC=`gcc --version | grep GCC | awk {'print $3'}`
409 export NATIVEGCC GCCmajor=${NATIVEGCC:0:1} GCCminor=${NATIVEGCC:2:1} GCCrelease=${NATIVEGCC:4:1}
410 lfsmake1 ccache
411 lfsmake1 sed LFS_PASS=1
412 lfsmake1 m4 LFS_PASS=1
413 lfsmake1 bison LFS_PASS=1
414 lfsmake1 flex LFS_PASS=1
415 lfsmake1 binutils LFS_PASS=1
416 lfsmake1 gcc LFS_PASS=1
417 export PATH=$BASEDIR/build/usr/local/bin:$BASEDIR/build/tools/bin:$PATH
418
419 lfsmake1 linux
420 lfsmake1 tcl
421 lfsmake1 expect
422 lfsmake1 glibc
423 lfsmake1 dejagnu
424 lfsmake1 gcc LFS_PASS=2
425 lfsmake1 binutils LFS_PASS=2
426 lfsmake1 gawk
427 lfsmake1 coreutils
428 lfsmake1 bzip2
429 lfsmake1 gzip
430 lfsmake1 diffutils
431 lfsmake1 findutils
432 lfsmake1 make
433 lfsmake1 grep
434 lfsmake1 sed LFS_PASS=2
435 lfsmake1 m4 LFS_PASS=2
436 lfsmake1 bison LFS_PASS=2
437 lfsmake1 flex LFS_PASS=2
438 lfsmake1 gettext
439 lfsmake1 ncurses
440 lfsmake1 patch
441 lfsmake1 tar
442 lfsmake1 texinfo
443 lfsmake1 bash
444 lfsmake1 util-linux
445 lfsmake1 perl
446 export PATH=$ORG_PATH
447}
448
449buildbase() {
450 LOGFILE="$BASEDIR/log/_build.base.log"
451 export LOGFILE
452 echo -ne "`date -u '+%b %e %T'`: Stage2 linux base build \n" | tee -a $LOGFILE
453 # Run LFS dynamic binary creation scripts one by one
454 lfsmake2 stage2
455 lfsmake2 makedev
456 lfsmake2 linux
457 lfsmake2 man-pages
458 lfsmake2 glibc
459 lfsmake2 binutils
460 lfsmake2 gcc
461 lfsmake2 coreutils
462 lfsmake2 zlib
463 lfsmake2 mktemp
464 lfsmake2 iana-etc
465 lfsmake2 findutils
466 lfsmake2 gawk
467 lfsmake2 ncurses
468 lfsmake2 vim
469 lfsmake2 m4
470 lfsmake2 bison
471 lfsmake2 less
472 lfsmake2 groff
473 lfsmake2 sed
474 lfsmake2 flex
475 lfsmake2 gettext
476 lfsmake2 net-tools
477 lfsmake2 inetutils
478 lfsmake2 perl
479 lfsmake2 texinfo
480 lfsmake2 autoconf
481 lfsmake2 automake
482 lfsmake2 bash
483 lfsmake2 file
484 lfsmake2 libtool
485 lfsmake2 bzip2
486 lfsmake2 diffutils
487 lfsmake2 ed
488 lfsmake2 kbd
489 lfsmake2 e2fsprogs
490 lfsmake2 grep
491 if [ 'i386' = $MACHINE ]; then
492 lfsmake2 grub
493 elif [ 'alpha' = $MACHINE ]; then
494 lfsmake2 aboot
495 fi
496 lfsmake2 gzip
497 lfsmake2 man
498 lfsmake2 make
499 lfsmake2 modutils
500 lfsmake2 patch
501 lfsmake2 procinfo
502 lfsmake2 procps
503 lfsmake2 psmisc
504 lfsmake2 shadow
505 lfsmake2 sysklogd
506 lfsmake2 sysvinit
507 lfsmake2 tar
508 lfsmake2 util-linux
509}
510
511buildipcop() {
512 # Run IPCop make scripts one by one
513 LOGFILE="$BASEDIR/log/_build.ipcop.log"
514 export LOGFILE
515 echo -ne "`date -u '+%b %e %T'`: Stage3 $NAME build \n" | tee -a $LOGFILE
516
517 # Build these first as some of the kernel packages below rely on
518 # these for some of their client program functionality
519 ipcopmake configroot
520 ipcopmake dhcp
521 ipcopmake dhcpcd
522 ipcopmake libusb
523 ipcopmake libpcap
524 ipcopmake linux-atm
525 ipcopmake ppp
526 ipcopmake rp-pppoe
527 ipcopmake unzip
528 # Do SMP now
529 if [ 'i386' = $MACHINE ]; then
530 # abuse the SMP flag, and make an minimal installer kernel first
531 # so that the boot floppy always works.....
532 ipcopmake linux LFS_PASS=ipcop SMP=installer
533 ipcopmake linux LFS_PASS=ipcop SMP=1
534 ipcopmake 3cp4218 SMP=1
535 ipcopmake amedyn SMP=1
536 ipcopmake cxacru SMP=1
537 ipcopmake eagle SMP=1
538
539 # These are here because they have i386 only binary libraries
540 # included in the package.
541 ipcopmake cnx_pci SMP=1
542 ipcopmake fcdsl SMP=1
543 ipcopmake fcdsl2 SMP=1
544 ipcopmake fcdslsl SMP=1
545 ipcopmake fcdslusb SMP=1
546 ipcopmake fcdslslusb SMP=1
547 ipcopmake pulsar SMP=1
548 ipcopmake unicorn SMP=1
549 fi
550
551 ipcopmake linux LFS_PASS=ipcop
552 ipcopmake 3cp4218
553 ipcopmake amedyn
554 ipcopmake cxacru
555 ipcopmake eciadsl
556 ipcopmake eagle
557 ipcopmake speedtouch
558 if [ 'i386' = $MACHINE ]; then
559 # These are here because they have i386 only binary libraries
560 # included in the package.
561 ipcopmake cnx_pci
562 ipcopmake fcdsl
563 ipcopmake fcdsl2
564 ipcopmake fcdslsl
565 ipcopmake fcdslusb
566 ipcopmake fcdslslusb
567 ipcopmake pulsar
568 ipcopmake unicorn
569 fi
570
571 ipcopmake pcmcia-cs
572 ipcopmake expat
573 ipcopmake gdbm
574 ipcopmake gmp
575 ipcopmake openssl
576 ipcopmake python
577 ipcopmake libnet
578 ipcopmake libpng
579 ipcopmake gd
580 ipcopmake popt
581 ipcopmake slang
582 ipcopmake newt
583 ipcopmake libcap
584 ipcopmake pciutils
585 ipcopmake pcre
586 ipcopmake apache
587 ipcopmake arping
588 ipcopmake beep
589 ipcopmake bind
590 ipcopmake capi4k-utils
591 ipcopmake cdrtools
592 ipcopmake dnsmasq
593 ipcopmake dosfstools
594 ipcopmake ethtool
595 ipcopmake ez-ipupdate
596 ipcopmake fcron
597 ipcopmake perl-GD
598 ipcopmake gnupg
599 ipcopmake hdparm
600 ipcopmake ibod
601 ipcopmake initscripts
602 ipcopmake iptables
603 ipcopmake ipac-ng
604 ipcopmake ipaddr
605 ipcopmake iproute2
606 ipcopmake iptstate
607 ipcopmake iputils
608 ipcopmake isapnptools
609 ipcopmake isdn4k-utils
610 ipcopmake kudzu
611 ipcopmake logrotate
612 ipcopmake logwatch
613 ipcopmake mingetty
614 ipcopmake misc-progs
615 ipcopmake mtools
616 ipcopmake nano
617 ipcopmake nash
618 ipcopmake nasm
619 ipcopmake URI
620 ipcopmake HTML-Tagset
621 ipcopmake HTML-Parser
622 ipcopmake Compress-Zlib
623 ipcopmake Digest
624 ipcopmake Digest-SHA1
625 ipcopmake Digest-HMAC
626 ipcopmake libwww-perl
627 ipcopmake Net-DNS
628 ipcopmake Net-IPv4Addr
629 ipcopmake Net_SSLeay
630 ipcopmake noip_updater
631 ipcopmake ntp
632 ipcopmake oinkmaster
633 ipcopmake openssh
634 ipcopmake openswan
635 ipcopmake pptpclient
636 ipcopmake rrdtool
637 ipcopmake setserial
638 ipcopmake setup
639 ipcopmake snort
640 #ipcopmake speedycgi
641 ipcopmake squid
642 ipcopmake squid-graph
643 ipcopmake tcpdump
644 ipcopmake traceroute
645 ipcopmake vlan
646 ipcopmake wireless
647 ipcopmake libsafe
648 ipcopmake 3c5x9setup
56daf5bb 649 echo -ne "`date -u '+%b %e %T'`: Building IPFire modules \n" | tee -a $LOGFILE
f8e5510c
MT
650 ipcopmake pkg-config
651 ipcopmake glib
1fe6c87b 652 ipcopmake wget
56daf5bb 653 ipcopmake berkeley-DB
df5e82b3 654 ipcopmake xampp
1fe6c87b 655 ipcopmake bridge-utils
df5e82b3 656 ipcopmake pam
56daf5bb 657 ipcopmake pammysql
052ad1cd
MT
658 ipcopmake saslauthd PASS=1
659 ipcopmake openldap
660 ipcopmake saslauthd PASS=2
f8e5510c
MT
661# ipcopmake samba
662 ipcopmake mc
94025eea
MT
663 ipcopmake postfix
664 ipcopmake stund
665 ipcopmake lpd
6233f08f
MT
666 ipcopmake pwlib
667 ipcopmake openh323
052ad1cd 668# wget http://www.guzu.net/linux/hddtemp.db && mv hddtemp.db $BASEDIR/build/etc/hddtemp.db
f8e5510c 669# ipcopmake hddtemp
94025eea 670
df5e82b3
MT
671}
672
673buildinstaller() {
674 # Run installer scripts one by one
675 LOGFILE="$BASEDIR/log/_build.installer.log"
676 export LOGFILE
677 echo -ne "`date -u '+%b %e %T'`: Stage4 installer build \n" | tee -a $LOGFILE
678 if [ 'i386' = $MACHINE ]; then
679 ipcopmake syslinux
680 ipcopmake as86
681 ipcopmake mbr
682 ipcopmake uClibc
683 fi
684 installmake busybox
685 installmake sysvinit
686 installmake e2fsprogs
687 installmake misc-progs
688 installmake slang
689 installmake util-linux
690 installmake newt
691 installmake pciutils
692 installmake pcmcia-cs
693 installmake kbd
694 installmake installer
695 installmake scsi.img
696 installmake driver.img
697 installmake initrd
698 installmake boot.img
699}
700
701buildpackages() {
702 LOGFILE="$BASEDIR/log/_build.packages.log"
703 export LOGFILE
704 echo "... see detailed log in _build.*.log files" >> $LOGFILE
705 echo -ne "`date -u '+%b %e %T'`: Stage5 packages build \n" | tee -a $LOGFILE
706 # Strip files
707 echo "`date -u '+%b %e %T'`: Stripping files" | tee -a $LOGFILE
708 find $LFS/lib $LFS/usr/lib $LFS/usr/share/rrdtool-* $LFS/install ! -type l \( -name '*.so' -o -name '*.so[\.0-9]*' \) \
709 ! -name 'libc.so' ! -name 'libpthread.so' ! -name 'libcrypto.so.0.9.7.sha1' \
94025eea 710 -ls -exec $LFS/tools/bin/strip --strip-all {} \; >> $LOGFILE 2>&1
df5e82b3
MT
711 # add -ls before -exec if you want to verify what files are stripped
712
713 find $LFS/{,s}bin $LFS/usr/{,s}bin $LFS/usr/local/{,s}bin ! -type l \
714 -exec file {} \; | grep " ELF " | cut -f1 -d ':' | xargs $LFS/tools/bin/strip --strip-all >> $LOGFILE 2>&1
715 # there add -v to strip to verify
716
717 if [ 'i386' = $MACHINE ]; then
718 # Create fcdsl packages
719 echo "`date -u '+%b %e %T'`: Building fcdsl tgz" | tee -a $LOGFILE
720 cp $LFS/install/images/fcdsl/license.txt $LFS >> $LOGFILE 2>&1
721 touch $LFS/var/run/{need-depmod-$KVER,need-depmod-$KVER-smp}
722 cd $LFS && tar cvfz $LFS/install/images/$SNAME-fcdsl-$VERSION.$MACHINE.tgz \
723 lib/modules/$KVER/misc/fcdsl*.o.gz \
724 lib/modules/$KVER-smp/misc/fcdsl*.o.gz \
725 usr/lib/isdn/{fds?base.bin,fd?ubase.frm} \
726 etc/fcdsl/fcdsl*.conf \
727 etc/drdsl/{drdsl,drdsl.ini} \
728 license.txt \
729 var/run/{need-depmod-$KVER,need-depmod-$KVER-smp} >> $LOGFILE 2>&1
730 rm -f $LFS/license.txt >> $LOGFILE 2>&1
731 cd $BASEDIR
732 fi
733
c2b15814 734# Create update for this version
df5e82b3
MT
735# echo "`date -u '+%b %e %T'`: Building update $VERSION tgz" | tee -a $LOGFILE
736# tar -cz -C $BASEDIR/build --files-from=$BASEDIR/updates/$VERSION/ROOTFILES.$MACHINE-$VERSION -f $BASEDIR/updates/$VERSION/patch.tar.gz --exclude='#*';
737# chmod 755 $BASEDIR/updates/$VERSION/setup
738# tar -cz -C $BASEDIR/updates/$VERSION -f $LFS/install/images/$SNAME-update-$VERSION.$MACHINE.tgz patch.tar.gz setup information
739# rm -f $LFS/var/run/{need-depmod-$KVER,need-depmod-$KVER-smp}
740
741 # Generating list of packages used
742 echo "`date -u '+%b %e %T'`: Generating packages list from logs" | tee -a $LOGFILE
743 rm -f $BASEDIR/doc/packages-list
744 for i in `ls -1tr $BASEDIR/log/[^_]*`; do
745 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
3ea75603 746 echo " * `basename $i`" >>$BASEDIR/doc/packages-list
df5e82b3
MT
747 fi
748 done
3ea75603 749 echo "====== List of softwares used to build $NAME Version: $VERSION ======" > $BASEDIR/doc/packages-list.txt
df5e82b3
MT
750 grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|ipcop$\|setup$\|stage2$\|smp$\|tools$\|tools1$\|tools2$' \
751 $BASEDIR/doc/packages-list | sort >> $BASEDIR/doc/packages-list.txt
752 rm -f $BASEDIR/doc/packages-list
753 # packages-list.txt is ready to be displayed for wiki page IPCopSoftwares
754
755 # Create ISO for CDRom and USB-superfloppy
756 ipcopmake cdrom
757 cp $LFS/install/images/{*.iso,*.tgz} $BASEDIR >> $LOGFILE 2>&1
e7164bb4
MT
758
759 # Build IPFire packages
760 ipfiredist postfix
f8e5510c 761 ipfiredist mc
df5e82b3
MT
762 # Cleanup
763 stdumount
764 rm -rf $BASEDIR/build/tmp/*
765
766 # Generating total list of files
767 echo "`date -u '+%b %e %T'`: Generating files list from logs" | tee -a $LOGFILE
768 rm -f $BASEDIR/log/FILES
769 for i in `ls -1tr $BASEDIR/log/[^_]*`; do
770 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
771 echo "##" >>$BASEDIR/log/FILES
772 echo "## `basename $i`" >>$BASEDIR/log/FILES
773 echo "##" >>$BASEDIR/log/FILES
774 cat $i | sed "s%^\./%#%" | sort >> $BASEDIR/log/FILES
775 fi
776 done
777
778 cd $PWD
779
780}
781
782# See what we're supposed to do
783case "$1" in
784build)
785 BUILDMACHINE=`uname -m`
786 PACKAGE=`ls -v -r $BASEDIR/cache/$SNAME-1.4.*-toolchain-$BUILDMACHINE.tar.gz 2> /dev/null | head -n 1`
787 #only restore on a clean disk
788 if [ ! -f log/perl-*-tools ]; then
789 if [ ! -n "$PACKAGE" ]; then
790 echo "`date -u '+%b %e %T'`: Full toolchain compilation" | tee -a $LOGFILE
791 prepareenv
792 buildtoolchain
793 else
794 PACKAGENAME=${PACKAGE%.tar.gz}
795 echo "`date -u '+%b %e %T'`: Restore from $PACKAGE" | tee -a $LOGFILE
796 if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then
797 tar zxf $PACKAGE
798 prepareenv
799 else
800 exiterror "$PACKAGENAME md5 did not match, check downloaded package"
801 fi
802 fi
803 else
804 echo "`date -u '+%b %e %T'`: Using installed toolchain" | tee -a $LOGFILE
805 prepareenv
806 fi
807 buildbase
808 buildipcop
809 buildinstaller
810 buildpackages
811 ;;
812shell)
813 # enter a shell inside LFS chroot
814 # may be used to changed kernel settings
815 prepareenv
816 entershell
817 ;;
818changelog)
819 echo "Building doc/Changelog from CVS"
820 # cv2cl script come from http://www.red-bean.com/cvs2cl/
821 if [ ! -s $BASEDIR/doc/CVS/Tag ]; then
822 BRANCHOPTS=""
823 else
824 BRANCH=`cat $BASEDIR/doc/CVS/Tag`
825 BRANCH=${BRANCH:1}
826 BRANCHOPTS="--follow-only $BRANCH"
827 fi
828
829 $BASEDIR/tools/cvs2cl.pl --gmt --show-dead $BRANCHOPTS -f $BASEDIR/doc/ChangeLog
830 rm -f $BASEDIR/doc/ChangeLog.bak
831 echo
832 echo "Commit the change now to update CVS"
833 ;;
834check)
835 echo "Checking sources files availability on the web"
836 if [ ! -d $DIR_CHK ]; then
837 mkdir -p $DIR_CHK
838 fi
839 FINISHED=0
840 cd $BASEDIR/lfs
841 for c in `seq $MAX_RETRIES`; do
842 if (( FINISHED==1 )); then
843 break
844 fi
845 FINISHED=1
846 cd $BASEDIR/lfs
847 for i in *; do
848 if [ -f "$i" -a "$i" != "Config" ]; then
849 make -s -f $i MACHINE=$MACHINE LFS_BASEDIR=$BASEDIR ROOT=$BASEDIR/build \
850 MESSAGE="$i\t ($c/$MAX_RETRIES)" check
851 if [ $? -ne 0 ]; then
852 echo "Check : wget error in lfs/$i"
853 FINISHED=0
854 fi
855 fi
856 done
857 done
858 cd -
859 ;;
860checkclean)
861 echo "Erasing sources files availability tags"
862 rm -rf $DIR_CHK/*
863 ;;
864clean)
865 for i in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do
866 $LOSETUP -d $i 2>/dev/null
867 done
868 for i in `mount | grep $BASEDIR | cut -d " " -f 1`; do
869 umount $i
870 done
871 stdumount
872 for i in `seq 0 7`; do
873 if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
874 umount /dev/loop${i} 2>/dev/null;
875 losetup -d /dev/loop${i} 2>/dev/null;
876 fi;
877 done
878 rm -rf $BASEDIR/build
879 rm -rf $BASEDIR/cdrom
880 rm -rf $BASEDIR/log
881 rm -f $BASEDIR/updates/$VERSION/patch.tar.gz;
882 if [ -h /tools ]; then
883 rm -f /tools
884 fi
885 ;;
886dist)
887 echo "Building source package from CVS, list of changed files, MD5 of release files"
888 if [ ! -s $BASEDIR/doc/CVS/Tag ]; then
889 BRANCH=""
890 BRANCHOPTS="-D `date +'%Y-%m-%d'`"
891 else
892 BRANCH=`cat $BASEDIR/doc/CVS/Tag`
893 BRANCH=${BRANCH:1}
894 BRANCHOPTS="-r $BRANCH"
895 fi
896
897 rm -rf $BASEDIR/build/tmp/$SNAME-$VERSION $BASEDIR/doc/release.txt
898 cd $BASEDIR/build/tmp
899 # build sources tgz
900 echo "Export tree $BRANCH $SNAME-$VERSION"
901 cvs -z3 -d `cat $BASEDIR/CVS/Root` export $BRANCHOPTS ipcop
902 if [ $? -eq 0 ]; then
903 mv ipcop $SNAME-$VERSION
904 tar cfz $BASEDIR/$SNAME-sources-$VERSION.tgz $SNAME-$VERSION
905 cd $BASEDIR
906
907 if [ ! -d $BASEDIR/build/tmp/$PREVIOUSTAG ]; then
908 # export previous version to be compared with actual, this help to check wich files need to go in update
909 cd $BASEDIR/build/tmp
910 echo "Export tree $PREVIOUSTAG"
911 cvs -z3 -d `cat $BASEDIR/CVS/Root` export -r $PREVIOUSTAG ipcop
912 mv ipcop $PREVIOUSTAG
913 fi
914 if [ -d $BASEDIR/build/tmp/$PREVIOUSTAG -o -d $BASEDIR/build/tmp/$SNAME-$VERSION ]; then
915 cd $BASEDIR/build/tmp
916 echo "diff $PREVIOUSTAG <> $BRANCH $SNAME-$VERSION >doc/updated-sources.txt"
917 diff -rq $PREVIOUSTAG $SNAME-$VERSION > $BASEDIR/doc/updated-sources.txt
918 mv $BASEDIR/doc/updated-sources.txt $BASEDIR/doc/updated-sources.bak
919 sed -e "s+Files $PREVIOUSTAG\/++" \
920 -e "s+ and .*$++" \
921 -e "s+src/rc.d+etc/rc.d+" \
922 -e "s+^langs/+var/ipcop/langs/+" \
923 -e "s+html/cgi-bin+home/httpd/cgi-bin+" $BASEDIR/doc/updated-sources.bak \
924 > $BASEDIR/doc/updated-sources.txt
925 rm -f $BASEDIR/doc/updated-sources.bak
926 fi
927 fi
928 ;;
f8e5510c 929newpak)
df5e82b3 930 # create structure for $VERSION update
f8e5510c
MT
931 echo -e "What is the name of the new package?"
932 read $NAME
933 if [ ! -f "lfs/$NAME" ]; then
934 echo "`date -u '+%b %e %T'`: Creating directory src/paks/$NAME"
935 mkdir -p src/paks/$NAME
936 cd src/paks/$NAME
937 echo "`date -u '+%b %e %T'`: Creating files"
938 cp $BASEDIR/lfs/postfix $BASEDIR/lfs/$NAME
939 touch ROOTFILES
940 touch CONFFILES
941 touch {,un}install.sh
942
943## install.sh
944 echo '#!/bin/bash' > install.sh
945 echo '#' >> install.sh
946 echo '#################################################################' >> install.sh
947 echo '# #' >> install.sh
948 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> install.sh
949 echo '# #' >> install.sh
950 echo '#################################################################' >> install.sh
951 echo '#' >> install.sh
952 echo '# Extract the files' >> install.sh
953 echo 'tar xfz files.tgz -C /' >> install.sh
954 echo 'cp -f ROOTFILES /opt/pakfire/installed/ROOTFILES.$NAME' >> install.sh
955
956## uninstall.sh
957 echo '#!/bin/bash' > uninstall.sh
958 echo '#################################################################' >> uninstall.sh
959 echo '# #' >> uninstall.sh
960 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> uninstall.sh
961 echo '# #' >> uninstall.sh
962 echo '#################################################################' >> uninstall.sh
963 echo '#' >> uninstall.sh
964 echo '# Delete the files' >> uninstall.sh
965 echo '## Befehl fehlt noch' >> uninstall.sh
966 echo 'rm -f /opt/pakfire/installed/ROOTFILES.$NAME' >> uninstall.sh
967
968 echo "`date -u '+%b %e %T'`: Adding files to SVN"
969 cd - && svn add src/paks/$NAME
df5e82b3 970 else
f8e5510c 971 echo "$NAME already exists"
df5e82b3 972 fi
df5e82b3
MT
973 exit 0
974 ;;
975prefetch)
976 if [ ! -d $BASEDIR/cache ]; then
977 mkdir $BASEDIR/cache
978 fi
979 mkdir -p $BASEDIR/log
980 echo "`date -u '+%b %e %T'`:Preload all source files" | tee -a $LOGFILE
981 FINISHED=0
982 cd $BASEDIR/lfs
983 for c in `seq $MAX_RETRIES`; do
984 if (( FINISHED==1 )); then
985 break
986 fi
987 FINISHED=1
988 cd $BASEDIR/lfs
989 for i in *; do
990 if [ -f "$i" -a "$i" != "Config" ]; then
991 make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t ($c/$MAX_RETRIES)" download >> $LOGFILE 2>&1
992 if [ $? -ne 0 ]; then
993 echo "Prefetch : wget error in lfs/$i"
994 FINISHED=0
995 else
996 if [ $c -eq 1 ]; then
997 echo "Prefetch : lfs/$i files loaded"
998 fi
999 fi
1000 fi
1001 done
1002 done
1003 echo "Prefetch : verifying md5sum"
1004 ERROR=0
1005 for i in *; do
1006 if [ -f "$i" -a "$i" != "Config" ]; then
1007 make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t " md5 >> $LOGFILE 2>&1
1008 if [ $? -ne 0 ]; then
1009 echo "md5 difference in lfs/$i"
1010 ERROR=1
1011 fi
1012 fi
1013 done
1014 if [ $ERROR -eq 0 ]; then
1015 echo "Prefetch : all files md5sum match"
1016 fi
1017 cd -
1018 ;;
1019rootfiles)
1020 PREVIOUSVERSION=`echo $PREVIOUSTAG | sed -e 's/IPCOP_v//' -e 's/_FINAL//' -e 's/_/\./g'`
1021 # make md5 list of actual build
1022 # some packages include a timestamp (kernel/perl/python/vim and more), so md5 vary at each build
1023 # anyway, it is sometime usable after a patch or a minor upgrade to know wich files include in update
1024 if [ ! -f "$BASEDIR/build/install/cdrom/$SNAME-$VERSION.tgz" ]; then
1025 echo "need cdrom be build to read include files list, use ./make.sh build before."
1026 else
1027 tar tzf $BASEDIR/build/install/cdrom/$SNAME-$VERSION.tgz > $BASEDIR/updates/$VERSION/FILES.tmp
1028 cd $BASEDIR/build
1029 rm -f $BASEDIR/updates/$VERSION/FILES-$MACHINE-$VERSION.md5
1030 for line in `cat $BASEDIR/updates/$VERSION/FILES.tmp`; do
1031 if [ -f "$line" -a ! -L "$line" ]; then
1032 md5sum "$line" >> $BASEDIR/updates/$VERSION/FILES-$MACHINE-$VERSION.md5
1033 fi
1034 done
1035 diff $BASEDIR/updates/$PREVIOUSVERSION/FILES-$MACHINE-$PREVIOUSVERSION.md5 \
1036 $BASEDIR/updates/$VERSION/FILES-$MACHINE-$VERSION.md5 \
1037 > $BASEDIR/updates/$VERSION/FILES-$MACHINE.diff
1038 awk '$1==">" {print $3}' $BASEDIR/updates/$VERSION/FILES-$MACHINE.diff \
1039 > $BASEDIR/updates/$VERSION/ROOTFILES.add.$MACHINE
1040 awk '$1=="<" {print $3}' $BASEDIR/updates/$VERSION/FILES-$MACHINE.diff \
1041 > $BASEDIR/updates/$VERSION/ROOTFILES.remove.$MACHINE.tmp
1042 rm -f $BASEDIR/updates/$VERSION/ROOTFILES.remove.$MACHINE
1043 for line in `cat $BASEDIR/updates/$VERSION/ROOTFILES.remove.$MACHINE.tmp`; do
1044 # a file is only removed when not in add file
1045 if ( ! grep -q "^$line$" $BASEDIR/updates/$VERSION/ROOTFILES.add.$MACHINE ); then
1046 echo $line >> $BASEDIR/updates/$VERSION/ROOTFILES.remove.$MACHINE
1047 fi
1048 done
1049 rm -f $BASEDIR/updates/$VERSION/{FILES.tmp,FILES-*.diff,ROOTFILES.remove.*.tmp}
1050 fi
1051 exit 0
1052 ;;
1053toolchain)
1054 prepareenv
1055 buildtoolchain
1056 BUILDMACHINE=`uname -m`
1057 echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for $BUILDMACHINE" | tee -a $LOGFILE
1058 cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \
1059 build/{bin,etc,usr/bin,usr/local} \
1060 build/tools/{bin,etc,*-linux-gnu,include,lib,libexec,sbin,share,var} \
1061 log >> $LOGFILE
1062 md5sum cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \
1063 > cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.md5
1064 stdumount
1065 ;;
1066gettoolchain)
1067 BUILDMACHINE=`uname -m`
1068 # arbitrary name to be updated in case of new toolchain package upload
e29556d8
MT
1069 PACKAGE=$SNAME-1.4-toolchain-$BUILDMACHINE
1070 URL_IPFIRE=`grep URL_IPFIRE lfs/Config | awk '{ print $3 }'`
df5e82b3
MT
1071 echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for $BUILDMACHINE" | tee -a $LOGFILE
1072 cd $BASEDIR/cache
e29556d8 1073 wget -c $URL_IPFIRE/toolchains/$PACKAGE.tar.gz $URL_IPFIRE/toolchains/$PACKAGE.md5
df5e82b3
MT
1074 if [ $? -ne 0 ]; then
1075 echo "`date -u '+%b %e %T'`: error downloading toolchain for $BUILDMACHINE machine" | tee -a $LOGFILE
1076 else
1077 if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then
1078 echo "`date -u '+%b %e %T'`: toolchain md5 ok" | tee -a $LOGFILE
e29556d8
MT
1079 echo "`date -u '+%b %e %T'`: Uncompressing toolchain" | tee -a $LOGFILE
1080 cd $BASEDIR && tar xvfz cache/$PACKAGE.tar.gz -C .
df5e82b3
MT
1081 else
1082 exiterror "$PACKAGE.md5 did not match, check downloaded package"
1083 fi
1084 fi
1085 ;;
1086*)
1087 echo "Usage: $0 {build|changelog|check|checkclean|clean|dist|gettoolchain|newupdate|prefetch|rootfiles|shell|toolchain}"
1088 cat doc/make.sh-usage
1089 exit 1
1090 ;;
3ea75603 1091esac