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
98d413ac 340 cp -f $BASEDIR/src/scripts/make-packages.sh $BASEDIR/build/usr/local/bin
e7164bb4
MT
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
93dc5548
MT
359# test -d $BASEDIR/packages || mkdir $BASEDIR/packages
360# mv -f $BASEDIR/build/paks/* $BASEDIR/packages/
e7164bb4
MT
361 return 0
362}
363
df5e82b3
MT
364
365installmake() {
366 if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then
367 echo "`date -u '+%b %e %T'`: Building $*" | tee -a $LOGFILE
368 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t " download >> $LOGFILE 2>&1
369 if [ $? -ne 0 ]; then
370 exiterror "Download error in $1"
371 fi
372 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1
373 if [ $? -ne 0 ]; then
374 exiterror "md5sum error in $1, check file in cache or signature"
375 fi
376 chroot $LFS /tools/bin/env -i HOME=/root \
377 TERM=$TERM PS1='\u:\w\$ ' \
378 PATH=/usr/local/bin:/opt/$MACHINE-uClibc/usr/bin:/bin:/usr/bin:/sbin:/usr/sbin \
379 VERSION=$VERSION \
380 CONFIG_ROOT=$CONFIG_ROOT \
381 LFS_PASS="install" \
382 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
383 CFLAGS="-Os" CXXFLAGS="-Os" \
384 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
385 KVER=$KVER \
386 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
387 /bin/bash -x -c "cd /usr/src/lfs && \
388 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
389 if [ $? -ne 0 ]; then
390 exiterror "Building $*"
391 fi
392 else
393 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
394 fi
395 return 0
396}
397
398buildtoolchain() {
399 LOGFILE="$BASEDIR/log/_build.toolchain.log"
400 export LOGFILE
401 echo -ne "`date -u '+%b %e %T'`: Stage1 toolchain build \n" | tee -a $LOGFILE
402 # Build sed now, as we use some extensions
403 ORG_PATH=$PATH
404 NATIVEGCC=`gcc --version | grep GCC | awk {'print $3'}`
405 export NATIVEGCC GCCmajor=${NATIVEGCC:0:1} GCCminor=${NATIVEGCC:2:1} GCCrelease=${NATIVEGCC:4:1}
406 lfsmake1 ccache
407 lfsmake1 sed LFS_PASS=1
408 lfsmake1 m4 LFS_PASS=1
409 lfsmake1 bison LFS_PASS=1
410 lfsmake1 flex LFS_PASS=1
411 lfsmake1 binutils LFS_PASS=1
412 lfsmake1 gcc LFS_PASS=1
413 export PATH=$BASEDIR/build/usr/local/bin:$BASEDIR/build/tools/bin:$PATH
414
415 lfsmake1 linux
416 lfsmake1 tcl
417 lfsmake1 expect
418 lfsmake1 glibc
419 lfsmake1 dejagnu
420 lfsmake1 gcc LFS_PASS=2
421 lfsmake1 binutils LFS_PASS=2
422 lfsmake1 gawk
423 lfsmake1 coreutils
424 lfsmake1 bzip2
425 lfsmake1 gzip
426 lfsmake1 diffutils
427 lfsmake1 findutils
428 lfsmake1 make
429 lfsmake1 grep
430 lfsmake1 sed LFS_PASS=2
431 lfsmake1 m4 LFS_PASS=2
432 lfsmake1 bison LFS_PASS=2
433 lfsmake1 flex LFS_PASS=2
434 lfsmake1 gettext
435 lfsmake1 ncurses
436 lfsmake1 patch
437 lfsmake1 tar
438 lfsmake1 texinfo
439 lfsmake1 bash
440 lfsmake1 util-linux
441 lfsmake1 perl
442 export PATH=$ORG_PATH
443}
444
445buildbase() {
446 LOGFILE="$BASEDIR/log/_build.base.log"
447 export LOGFILE
448 echo -ne "`date -u '+%b %e %T'`: Stage2 linux base build \n" | tee -a $LOGFILE
449 # Run LFS dynamic binary creation scripts one by one
450 lfsmake2 stage2
451 lfsmake2 makedev
452 lfsmake2 linux
453 lfsmake2 man-pages
454 lfsmake2 glibc
455 lfsmake2 binutils
456 lfsmake2 gcc
457 lfsmake2 coreutils
458 lfsmake2 zlib
459 lfsmake2 mktemp
460 lfsmake2 iana-etc
461 lfsmake2 findutils
462 lfsmake2 gawk
463 lfsmake2 ncurses
464 lfsmake2 vim
465 lfsmake2 m4
466 lfsmake2 bison
467 lfsmake2 less
468 lfsmake2 groff
469 lfsmake2 sed
470 lfsmake2 flex
471 lfsmake2 gettext
472 lfsmake2 net-tools
473 lfsmake2 inetutils
474 lfsmake2 perl
475 lfsmake2 texinfo
476 lfsmake2 autoconf
477 lfsmake2 automake
478 lfsmake2 bash
479 lfsmake2 file
480 lfsmake2 libtool
481 lfsmake2 bzip2
482 lfsmake2 diffutils
483 lfsmake2 ed
484 lfsmake2 kbd
485 lfsmake2 e2fsprogs
486 lfsmake2 grep
487 if [ 'i386' = $MACHINE ]; then
488 lfsmake2 grub
489 elif [ 'alpha' = $MACHINE ]; then
490 lfsmake2 aboot
491 fi
492 lfsmake2 gzip
493 lfsmake2 man
494 lfsmake2 make
495 lfsmake2 modutils
496 lfsmake2 patch
497 lfsmake2 procinfo
498 lfsmake2 procps
499 lfsmake2 psmisc
500 lfsmake2 shadow
501 lfsmake2 sysklogd
502 lfsmake2 sysvinit
503 lfsmake2 tar
504 lfsmake2 util-linux
505}
506
507buildipcop() {
508 # Run IPCop make scripts one by one
509 LOGFILE="$BASEDIR/log/_build.ipcop.log"
510 export LOGFILE
511 echo -ne "`date -u '+%b %e %T'`: Stage3 $NAME build \n" | tee -a $LOGFILE
512
513 # Build these first as some of the kernel packages below rely on
514 # these for some of their client program functionality
515 ipcopmake configroot
516 ipcopmake dhcp
517 ipcopmake dhcpcd
518 ipcopmake libusb
519 ipcopmake libpcap
520 ipcopmake linux-atm
521 ipcopmake ppp
522 ipcopmake rp-pppoe
523 ipcopmake unzip
524 # Do SMP now
525 if [ 'i386' = $MACHINE ]; then
526 # abuse the SMP flag, and make an minimal installer kernel first
527 # so that the boot floppy always works.....
528 ipcopmake linux LFS_PASS=ipcop SMP=installer
529 ipcopmake linux LFS_PASS=ipcop SMP=1
530 ipcopmake 3cp4218 SMP=1
531 ipcopmake amedyn SMP=1
532 ipcopmake cxacru SMP=1
533 ipcopmake eagle SMP=1
534
535 # These are here because they have i386 only binary libraries
536 # included in the package.
537 ipcopmake cnx_pci SMP=1
538 ipcopmake fcdsl SMP=1
539 ipcopmake fcdsl2 SMP=1
540 ipcopmake fcdslsl SMP=1
541 ipcopmake fcdslusb SMP=1
542 ipcopmake fcdslslusb SMP=1
543 ipcopmake pulsar SMP=1
544 ipcopmake unicorn SMP=1
545 fi
546
547 ipcopmake linux LFS_PASS=ipcop
548 ipcopmake 3cp4218
549 ipcopmake amedyn
550 ipcopmake cxacru
551 ipcopmake eciadsl
552 ipcopmake eagle
553 ipcopmake speedtouch
554 if [ 'i386' = $MACHINE ]; then
555 # These are here because they have i386 only binary libraries
556 # included in the package.
557 ipcopmake cnx_pci
558 ipcopmake fcdsl
559 ipcopmake fcdsl2
560 ipcopmake fcdslsl
561 ipcopmake fcdslusb
562 ipcopmake fcdslslusb
563 ipcopmake pulsar
564 ipcopmake unicorn
565 fi
566
567 ipcopmake pcmcia-cs
568 ipcopmake expat
569 ipcopmake gdbm
570 ipcopmake gmp
571 ipcopmake openssl
572 ipcopmake python
573 ipcopmake libnet
574 ipcopmake libpng
575 ipcopmake gd
576 ipcopmake popt
577 ipcopmake slang
578 ipcopmake newt
579 ipcopmake libcap
580 ipcopmake pciutils
581 ipcopmake pcre
582 ipcopmake apache
583 ipcopmake arping
584 ipcopmake beep
585 ipcopmake bind
586 ipcopmake capi4k-utils
587 ipcopmake cdrtools
588 ipcopmake dnsmasq
589 ipcopmake dosfstools
590 ipcopmake ethtool
591 ipcopmake ez-ipupdate
592 ipcopmake fcron
593 ipcopmake perl-GD
594 ipcopmake gnupg
595 ipcopmake hdparm
596 ipcopmake ibod
597 ipcopmake initscripts
598 ipcopmake iptables
599 ipcopmake ipac-ng
600 ipcopmake ipaddr
601 ipcopmake iproute2
602 ipcopmake iptstate
603 ipcopmake iputils
604 ipcopmake isapnptools
605 ipcopmake isdn4k-utils
606 ipcopmake kudzu
607 ipcopmake logrotate
608 ipcopmake logwatch
609 ipcopmake mingetty
610 ipcopmake misc-progs
611 ipcopmake mtools
612 ipcopmake nano
613 ipcopmake nash
614 ipcopmake nasm
615 ipcopmake URI
616 ipcopmake HTML-Tagset
617 ipcopmake HTML-Parser
618 ipcopmake Compress-Zlib
619 ipcopmake Digest
620 ipcopmake Digest-SHA1
621 ipcopmake Digest-HMAC
622 ipcopmake libwww-perl
623 ipcopmake Net-DNS
624 ipcopmake Net-IPv4Addr
625 ipcopmake Net_SSLeay
626 ipcopmake noip_updater
627 ipcopmake ntp
628 ipcopmake oinkmaster
629 ipcopmake openssh
630 ipcopmake openswan
631 ipcopmake pptpclient
632 ipcopmake rrdtool
633 ipcopmake setserial
634 ipcopmake setup
635 ipcopmake snort
636 #ipcopmake speedycgi
637 ipcopmake squid
638 ipcopmake squid-graph
639 ipcopmake tcpdump
640 ipcopmake traceroute
641 ipcopmake vlan
642 ipcopmake wireless
643 ipcopmake libsafe
644 ipcopmake 3c5x9setup
56daf5bb 645 echo -ne "`date -u '+%b %e %T'`: Building IPFire modules \n" | tee -a $LOGFILE
5e69ef1a 646## Zuerst die Libs und dann die Programme. Ordnung muss sein!
98d413ac 647 ipcopmake berkeley
5e69ef1a 648 ipcopmake libtiff
c3defe9b 649 ipcopmake libjpeg
5e69ef1a
MT
650 ipcopmake libxml2
651 ipcopmake spandsp
652 ipcopmake lzo
f8e5510c
MT
653 ipcopmake pkg-config
654 ipcopmake glib
180cd3be 655 ipcopmake xampp
5e69ef1a
MT
656 ipcopmake pam
657 ipcopmake pammysql
98d413ac
MT
658 ipcopmake saslauthd PASS=1
659 ipcopmake openldap
660 ipcopmake saslauthd PASS=2
a31b2bc4 661 ipcopmake xinetd
98d413ac 662 ipcopmake samba
5e69ef1a
MT
663 ipcopmake sudo
664 ipcopmake mc
665 ipcopmake pwlib
666 ipcopmake openh323
1fe6c87b 667 ipcopmake wget
1fe6c87b 668 ipcopmake bridge-utils
94025eea 669 ipcopmake postfix
93dc5548
MT
670 ipcopmake fetchmail
671 ipcopmake cyrusimap
94025eea 672 ipcopmake stund
a31b2bc4 673# ipcopmake lpd
5e69ef1a
MT
674 ipcopmake openvpn
675 ipcopmake asterisk
676 ipcopmake edonkeyclc
c3defe9b 677 ipcopmake sane
a31b2bc4
MT
678 ipcopmake ghostscript
679 ipcopmake cups
052ad1cd 680# wget http://www.guzu.net/linux/hddtemp.db && mv hddtemp.db $BASEDIR/build/etc/hddtemp.db
f8e5510c 681# ipcopmake hddtemp
5e69ef1a 682# ipcopmake stunnel # Ausgeschaltet, weil wir es doch nicht nutzen
df5e82b3
MT
683}
684
685buildinstaller() {
686 # Run installer scripts one by one
687 LOGFILE="$BASEDIR/log/_build.installer.log"
688 export LOGFILE
689 echo -ne "`date -u '+%b %e %T'`: Stage4 installer build \n" | tee -a $LOGFILE
690 if [ 'i386' = $MACHINE ]; then
691 ipcopmake syslinux
692 ipcopmake as86
693 ipcopmake mbr
694 ipcopmake uClibc
695 fi
696 installmake busybox
697 installmake sysvinit
698 installmake e2fsprogs
699 installmake misc-progs
700 installmake slang
701 installmake util-linux
702 installmake newt
703 installmake pciutils
704 installmake pcmcia-cs
705 installmake kbd
706 installmake installer
707 installmake scsi.img
708 installmake driver.img
709 installmake initrd
710 installmake boot.img
711}
712
713buildpackages() {
714 LOGFILE="$BASEDIR/log/_build.packages.log"
715 export LOGFILE
716 echo "... see detailed log in _build.*.log files" >> $LOGFILE
717 echo -ne "`date -u '+%b %e %T'`: Stage5 packages build \n" | tee -a $LOGFILE
718 # Strip files
719 echo "`date -u '+%b %e %T'`: Stripping files" | tee -a $LOGFILE
720 find $LFS/lib $LFS/usr/lib $LFS/usr/share/rrdtool-* $LFS/install ! -type l \( -name '*.so' -o -name '*.so[\.0-9]*' \) \
721 ! -name 'libc.so' ! -name 'libpthread.so' ! -name 'libcrypto.so.0.9.7.sha1' \
94025eea 722 -ls -exec $LFS/tools/bin/strip --strip-all {} \; >> $LOGFILE 2>&1
df5e82b3
MT
723 # add -ls before -exec if you want to verify what files are stripped
724
725 find $LFS/{,s}bin $LFS/usr/{,s}bin $LFS/usr/local/{,s}bin ! -type l \
726 -exec file {} \; | grep " ELF " | cut -f1 -d ':' | xargs $LFS/tools/bin/strip --strip-all >> $LOGFILE 2>&1
727 # there add -v to strip to verify
728
729 if [ 'i386' = $MACHINE ]; then
730 # Create fcdsl packages
731 echo "`date -u '+%b %e %T'`: Building fcdsl tgz" | tee -a $LOGFILE
732 cp $LFS/install/images/fcdsl/license.txt $LFS >> $LOGFILE 2>&1
733 touch $LFS/var/run/{need-depmod-$KVER,need-depmod-$KVER-smp}
734 cd $LFS && tar cvfz $LFS/install/images/$SNAME-fcdsl-$VERSION.$MACHINE.tgz \
735 lib/modules/$KVER/misc/fcdsl*.o.gz \
736 lib/modules/$KVER-smp/misc/fcdsl*.o.gz \
737 usr/lib/isdn/{fds?base.bin,fd?ubase.frm} \
738 etc/fcdsl/fcdsl*.conf \
739 etc/drdsl/{drdsl,drdsl.ini} \
740 license.txt \
741 var/run/{need-depmod-$KVER,need-depmod-$KVER-smp} >> $LOGFILE 2>&1
742 rm -f $LFS/license.txt >> $LOGFILE 2>&1
743 cd $BASEDIR
744 fi
745
c2b15814 746# Create update for this version
df5e82b3
MT
747# echo "`date -u '+%b %e %T'`: Building update $VERSION tgz" | tee -a $LOGFILE
748# tar -cz -C $BASEDIR/build --files-from=$BASEDIR/updates/$VERSION/ROOTFILES.$MACHINE-$VERSION -f $BASEDIR/updates/$VERSION/patch.tar.gz --exclude='#*';
749# chmod 755 $BASEDIR/updates/$VERSION/setup
750# tar -cz -C $BASEDIR/updates/$VERSION -f $LFS/install/images/$SNAME-update-$VERSION.$MACHINE.tgz patch.tar.gz setup information
751# rm -f $LFS/var/run/{need-depmod-$KVER,need-depmod-$KVER-smp}
752
753 # Generating list of packages used
754 echo "`date -u '+%b %e %T'`: Generating packages list from logs" | tee -a $LOGFILE
755 rm -f $BASEDIR/doc/packages-list
756 for i in `ls -1tr $BASEDIR/log/[^_]*`; do
757 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
3ea75603 758 echo " * `basename $i`" >>$BASEDIR/doc/packages-list
df5e82b3
MT
759 fi
760 done
3ea75603 761 echo "====== List of softwares used to build $NAME Version: $VERSION ======" > $BASEDIR/doc/packages-list.txt
df5e82b3
MT
762 grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|ipcop$\|setup$\|stage2$\|smp$\|tools$\|tools1$\|tools2$' \
763 $BASEDIR/doc/packages-list | sort >> $BASEDIR/doc/packages-list.txt
764 rm -f $BASEDIR/doc/packages-list
c9673262 765 # packages-list.txt is ready to be displayed for wiki page
df5e82b3
MT
766
767 # Create ISO for CDRom and USB-superfloppy
c3defe9b
MT
768 ipcopmake cdrom
769 cp $LFS/install/images/{*.iso,*.tgz} $BASEDIR >> $LOGFILE 2>&1
c9673262 770
e7164bb4 771 # Build IPFire packages
98d413ac 772 ipfiredist asterisk
93dc5548
MT
773 ipfiredist cyrusimap
774 ipfiredist fetchmail
5e69ef1a
MT
775 ipfiredist libtiff
776 ipfiredist libxml2
f8e5510c 777 ipfiredist mc
c9673262 778 ipfiredist postfix
98d413ac 779 ipfiredist pwlib
93dc5548 780 ipfiredist sane
5e69ef1a 781 ipfiredist spandsp
c9673262 782 ipfiredist sudo
93dc5548 783 ipfiredist xampp
c9673262 784 ipfiredist xinetd
98d413ac 785 test -d $BASEDIR/packages || mkdir $BASEDIR/packages
93dc5548 786 cp -f $LFS/paks/*.tar.gz $LFS/paks/*.md5 $BASEDIR/packages >> $LOGFILE 2>&1
98d413ac 787
df5e82b3
MT
788 # Cleanup
789 stdumount
790 rm -rf $BASEDIR/build/tmp/*
791
792 # Generating total list of files
793 echo "`date -u '+%b %e %T'`: Generating files list from logs" | tee -a $LOGFILE
794 rm -f $BASEDIR/log/FILES
795 for i in `ls -1tr $BASEDIR/log/[^_]*`; do
796 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
797 echo "##" >>$BASEDIR/log/FILES
798 echo "## `basename $i`" >>$BASEDIR/log/FILES
799 echo "##" >>$BASEDIR/log/FILES
800 cat $i | sed "s%^\./%#%" | sort >> $BASEDIR/log/FILES
801 fi
802 done
803
804 cd $PWD
805
806}
807
808# See what we're supposed to do
809case "$1" in
810build)
811 BUILDMACHINE=`uname -m`
812 PACKAGE=`ls -v -r $BASEDIR/cache/$SNAME-1.4.*-toolchain-$BUILDMACHINE.tar.gz 2> /dev/null | head -n 1`
813 #only restore on a clean disk
814 if [ ! -f log/perl-*-tools ]; then
815 if [ ! -n "$PACKAGE" ]; then
816 echo "`date -u '+%b %e %T'`: Full toolchain compilation" | tee -a $LOGFILE
817 prepareenv
818 buildtoolchain
819 else
820 PACKAGENAME=${PACKAGE%.tar.gz}
821 echo "`date -u '+%b %e %T'`: Restore from $PACKAGE" | tee -a $LOGFILE
822 if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then
823 tar zxf $PACKAGE
824 prepareenv
825 else
826 exiterror "$PACKAGENAME md5 did not match, check downloaded package"
827 fi
828 fi
829 else
830 echo "`date -u '+%b %e %T'`: Using installed toolchain" | tee -a $LOGFILE
831 prepareenv
832 fi
833 buildbase
834 buildipcop
835 buildinstaller
836 buildpackages
837 ;;
838shell)
839 # enter a shell inside LFS chroot
840 # may be used to changed kernel settings
841 prepareenv
842 entershell
843 ;;
844changelog)
845 echo "Building doc/Changelog from CVS"
846 # cv2cl script come from http://www.red-bean.com/cvs2cl/
847 if [ ! -s $BASEDIR/doc/CVS/Tag ]; then
848 BRANCHOPTS=""
849 else
850 BRANCH=`cat $BASEDIR/doc/CVS/Tag`
851 BRANCH=${BRANCH:1}
852 BRANCHOPTS="--follow-only $BRANCH"
853 fi
854
855 $BASEDIR/tools/cvs2cl.pl --gmt --show-dead $BRANCHOPTS -f $BASEDIR/doc/ChangeLog
856 rm -f $BASEDIR/doc/ChangeLog.bak
857 echo
858 echo "Commit the change now to update CVS"
859 ;;
860check)
861 echo "Checking sources files availability on the web"
862 if [ ! -d $DIR_CHK ]; then
863 mkdir -p $DIR_CHK
864 fi
865 FINISHED=0
866 cd $BASEDIR/lfs
867 for c in `seq $MAX_RETRIES`; do
868 if (( FINISHED==1 )); then
869 break
870 fi
871 FINISHED=1
872 cd $BASEDIR/lfs
873 for i in *; do
874 if [ -f "$i" -a "$i" != "Config" ]; then
875 make -s -f $i MACHINE=$MACHINE LFS_BASEDIR=$BASEDIR ROOT=$BASEDIR/build \
876 MESSAGE="$i\t ($c/$MAX_RETRIES)" check
877 if [ $? -ne 0 ]; then
878 echo "Check : wget error in lfs/$i"
879 FINISHED=0
880 fi
881 fi
882 done
883 done
884 cd -
885 ;;
886checkclean)
887 echo "Erasing sources files availability tags"
888 rm -rf $DIR_CHK/*
889 ;;
890clean)
891 for i in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do
892 $LOSETUP -d $i 2>/dev/null
893 done
894 for i in `mount | grep $BASEDIR | cut -d " " -f 1`; do
895 umount $i
896 done
897 stdumount
898 for i in `seq 0 7`; do
899 if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
900 umount /dev/loop${i} 2>/dev/null;
901 losetup -d /dev/loop${i} 2>/dev/null;
902 fi;
903 done
904 rm -rf $BASEDIR/build
905 rm -rf $BASEDIR/cdrom
906 rm -rf $BASEDIR/log
907 rm -f $BASEDIR/updates/$VERSION/patch.tar.gz;
908 if [ -h /tools ]; then
909 rm -f /tools
910 fi
911 ;;
912dist)
913 echo "Building source package from CVS, list of changed files, MD5 of release files"
914 if [ ! -s $BASEDIR/doc/CVS/Tag ]; then
915 BRANCH=""
916 BRANCHOPTS="-D `date +'%Y-%m-%d'`"
917 else
918 BRANCH=`cat $BASEDIR/doc/CVS/Tag`
919 BRANCH=${BRANCH:1}
920 BRANCHOPTS="-r $BRANCH"
921 fi
922
923 rm -rf $BASEDIR/build/tmp/$SNAME-$VERSION $BASEDIR/doc/release.txt
924 cd $BASEDIR/build/tmp
925 # build sources tgz
926 echo "Export tree $BRANCH $SNAME-$VERSION"
927 cvs -z3 -d `cat $BASEDIR/CVS/Root` export $BRANCHOPTS ipcop
928 if [ $? -eq 0 ]; then
929 mv ipcop $SNAME-$VERSION
930 tar cfz $BASEDIR/$SNAME-sources-$VERSION.tgz $SNAME-$VERSION
931 cd $BASEDIR
932
933 if [ ! -d $BASEDIR/build/tmp/$PREVIOUSTAG ]; then
934 # export previous version to be compared with actual, this help to check wich files need to go in update
935 cd $BASEDIR/build/tmp
936 echo "Export tree $PREVIOUSTAG"
937 cvs -z3 -d `cat $BASEDIR/CVS/Root` export -r $PREVIOUSTAG ipcop
938 mv ipcop $PREVIOUSTAG
939 fi
940 if [ -d $BASEDIR/build/tmp/$PREVIOUSTAG -o -d $BASEDIR/build/tmp/$SNAME-$VERSION ]; then
941 cd $BASEDIR/build/tmp
942 echo "diff $PREVIOUSTAG <> $BRANCH $SNAME-$VERSION >doc/updated-sources.txt"
943 diff -rq $PREVIOUSTAG $SNAME-$VERSION > $BASEDIR/doc/updated-sources.txt
944 mv $BASEDIR/doc/updated-sources.txt $BASEDIR/doc/updated-sources.bak
945 sed -e "s+Files $PREVIOUSTAG\/++" \
946 -e "s+ and .*$++" \
947 -e "s+src/rc.d+etc/rc.d+" \
948 -e "s+^langs/+var/ipcop/langs/+" \
949 -e "s+html/cgi-bin+home/httpd/cgi-bin+" $BASEDIR/doc/updated-sources.bak \
950 > $BASEDIR/doc/updated-sources.txt
951 rm -f $BASEDIR/doc/updated-sources.bak
952 fi
953 fi
954 ;;
f8e5510c 955newpak)
a9b17001
MT
956 # create structure for a new package
957 echo -e "Name of the new package: $2"
958 if [ ! -f "lfs/$2" ]; then
959 echo "`date -u '+%b %e %T'`: Creating directory src/paks/$2"
960 mkdir -p src/paks/$2
961 cd src/paks/$2
f8e5510c 962 echo "`date -u '+%b %e %T'`: Creating files"
a9b17001
MT
963 cp $BASEDIR/lfs/postfix $BASEDIR/lfs/$2
964
f8e5510c
MT
965 touch ROOTFILES
966 touch CONFFILES
967 touch {,un}install.sh
a9b17001 968 ## install.sh
f8e5510c
MT
969 echo '#!/bin/bash' > install.sh
970 echo '#' >> install.sh
971 echo '#################################################################' >> install.sh
972 echo '# #' >> install.sh
973 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> install.sh
974 echo '# #' >> install.sh
975 echo '#################################################################' >> install.sh
976 echo '#' >> install.sh
977 echo '# Extract the files' >> install.sh
978 echo 'tar xfz files.tgz -C /' >> install.sh
a9b17001
MT
979 echo 'cp -f ROOTFILES /opt/pakfire/installed/ROOTFILES.$2' >> install.sh
980 ## uninstall.sh
f8e5510c
MT
981 echo '#!/bin/bash' > uninstall.sh
982 echo '#################################################################' >> uninstall.sh
983 echo '# #' >> uninstall.sh
984 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> uninstall.sh
985 echo '# #' >> uninstall.sh
986 echo '#################################################################' >> uninstall.sh
987 echo '#' >> uninstall.sh
988 echo '# Delete the files' >> uninstall.sh
989 echo '## Befehl fehlt noch' >> uninstall.sh
a9b17001 990 echo 'rm -f /opt/pakfire/installed/ROOTFILES.$2' >> uninstall.sh
f8e5510c 991 echo "`date -u '+%b %e %T'`: Adding files to SVN"
a9b17001
MT
992 cd - && svn add lfs/$2 && svn add src/paks/$2
993
994 echo -n "Do you want to remove the folders? [y/n]"
995 read REM
996 if [ "$REM" == "y" ]; then
997 echo "Removing the folders..."
998 svn del src/paks/$2 --force
999 else
1000 echo "Folders are kept."
1001 fi
df5e82b3 1002 else
a9b17001 1003 echo "$2 already exists"
df5e82b3 1004 fi
df5e82b3
MT
1005 exit 0
1006 ;;
1007prefetch)
1008 if [ ! -d $BASEDIR/cache ]; then
1009 mkdir $BASEDIR/cache
1010 fi
1011 mkdir -p $BASEDIR/log
1012 echo "`date -u '+%b %e %T'`:Preload all source files" | tee -a $LOGFILE
1013 FINISHED=0
1014 cd $BASEDIR/lfs
1015 for c in `seq $MAX_RETRIES`; do
1016 if (( FINISHED==1 )); then
1017 break
1018 fi
1019 FINISHED=1
1020 cd $BASEDIR/lfs
1021 for i in *; do
1022 if [ -f "$i" -a "$i" != "Config" ]; then
1023 make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t ($c/$MAX_RETRIES)" download >> $LOGFILE 2>&1
1024 if [ $? -ne 0 ]; then
1025 echo "Prefetch : wget error in lfs/$i"
1026 FINISHED=0
1027 else
1028 if [ $c -eq 1 ]; then
1029 echo "Prefetch : lfs/$i files loaded"
1030 fi
1031 fi
1032 fi
1033 done
1034 done
1035 echo "Prefetch : verifying md5sum"
1036 ERROR=0
1037 for i in *; do
1038 if [ -f "$i" -a "$i" != "Config" ]; then
1039 make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t " md5 >> $LOGFILE 2>&1
1040 if [ $? -ne 0 ]; then
1041 echo "md5 difference in lfs/$i"
1042 ERROR=1
1043 fi
1044 fi
1045 done
1046 if [ $ERROR -eq 0 ]; then
1047 echo "Prefetch : all files md5sum match"
1048 fi
1049 cd -
1050 ;;
1051rootfiles)
1052 PREVIOUSVERSION=`echo $PREVIOUSTAG | sed -e 's/IPCOP_v//' -e 's/_FINAL//' -e 's/_/\./g'`
1053 # make md5 list of actual build
1054 # some packages include a timestamp (kernel/perl/python/vim and more), so md5 vary at each build
1055 # anyway, it is sometime usable after a patch or a minor upgrade to know wich files include in update
1056 if [ ! -f "$BASEDIR/build/install/cdrom/$SNAME-$VERSION.tgz" ]; then
1057 echo "need cdrom be build to read include files list, use ./make.sh build before."
1058 else
1059 tar tzf $BASEDIR/build/install/cdrom/$SNAME-$VERSION.tgz > $BASEDIR/updates/$VERSION/FILES.tmp
1060 cd $BASEDIR/build
1061 rm -f $BASEDIR/updates/$VERSION/FILES-$MACHINE-$VERSION.md5
1062 for line in `cat $BASEDIR/updates/$VERSION/FILES.tmp`; do
1063 if [ -f "$line" -a ! -L "$line" ]; then
1064 md5sum "$line" >> $BASEDIR/updates/$VERSION/FILES-$MACHINE-$VERSION.md5
1065 fi
1066 done
1067 diff $BASEDIR/updates/$PREVIOUSVERSION/FILES-$MACHINE-$PREVIOUSVERSION.md5 \
1068 $BASEDIR/updates/$VERSION/FILES-$MACHINE-$VERSION.md5 \
1069 > $BASEDIR/updates/$VERSION/FILES-$MACHINE.diff
1070 awk '$1==">" {print $3}' $BASEDIR/updates/$VERSION/FILES-$MACHINE.diff \
1071 > $BASEDIR/updates/$VERSION/ROOTFILES.add.$MACHINE
1072 awk '$1=="<" {print $3}' $BASEDIR/updates/$VERSION/FILES-$MACHINE.diff \
1073 > $BASEDIR/updates/$VERSION/ROOTFILES.remove.$MACHINE.tmp
1074 rm -f $BASEDIR/updates/$VERSION/ROOTFILES.remove.$MACHINE
1075 for line in `cat $BASEDIR/updates/$VERSION/ROOTFILES.remove.$MACHINE.tmp`; do
1076 # a file is only removed when not in add file
1077 if ( ! grep -q "^$line$" $BASEDIR/updates/$VERSION/ROOTFILES.add.$MACHINE ); then
1078 echo $line >> $BASEDIR/updates/$VERSION/ROOTFILES.remove.$MACHINE
1079 fi
1080 done
1081 rm -f $BASEDIR/updates/$VERSION/{FILES.tmp,FILES-*.diff,ROOTFILES.remove.*.tmp}
1082 fi
1083 exit 0
1084 ;;
1085toolchain)
1086 prepareenv
1087 buildtoolchain
1088 BUILDMACHINE=`uname -m`
1089 echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for $BUILDMACHINE" | tee -a $LOGFILE
1090 cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \
1091 build/{bin,etc,usr/bin,usr/local} \
1092 build/tools/{bin,etc,*-linux-gnu,include,lib,libexec,sbin,share,var} \
1093 log >> $LOGFILE
1094 md5sum cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \
1095 > cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.md5
1096 stdumount
1097 ;;
1098gettoolchain)
1099 BUILDMACHINE=`uname -m`
1100 # arbitrary name to be updated in case of new toolchain package upload
e29556d8
MT
1101 PACKAGE=$SNAME-1.4-toolchain-$BUILDMACHINE
1102 URL_IPFIRE=`grep URL_IPFIRE lfs/Config | awk '{ print $3 }'`
df5e82b3
MT
1103 echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for $BUILDMACHINE" | tee -a $LOGFILE
1104 cd $BASEDIR/cache
54113aa2 1105 wget $URL_IPFIRE/toolchains/$PACKAGE.tar.gz $URL_IPFIRE/toolchains/$PACKAGE.md5
df5e82b3
MT
1106 if [ $? -ne 0 ]; then
1107 echo "`date -u '+%b %e %T'`: error downloading toolchain for $BUILDMACHINE machine" | tee -a $LOGFILE
1108 else
1109 if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then
1110 echo "`date -u '+%b %e %T'`: toolchain md5 ok" | tee -a $LOGFILE
e29556d8
MT
1111 echo "`date -u '+%b %e %T'`: Uncompressing toolchain" | tee -a $LOGFILE
1112 cd $BASEDIR && tar xvfz cache/$PACKAGE.tar.gz -C .
df5e82b3
MT
1113 else
1114 exiterror "$PACKAGE.md5 did not match, check downloaded package"
1115 fi
1116 fi
1117 ;;
a9b17001
MT
1118update)
1119 echo "Load the latest source-files:"
1120 svn update
1121 ;;
df5e82b3 1122*)
a9b17001 1123 echo "Usage: $0 {build|changelog|check|checkclean|clean|dist|gettoolchain|newpak|prefetch|rootfiles|shell|toolchain|update}"
df5e82b3
MT
1124 cat doc/make.sh-usage
1125 exit 1
1126 ;;
3ea75603 1127esac