Ă„nderung am Linux-Kernel (BootSplash)
[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 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
36 # Debian specific settings
37 if [ ! -e /etc/debian_version ]; then
38 FULLPATH=`which $0`
39 else
40 if [ -x /usr/bin/realpath ]; then
41 FULLPATH=`/usr/bin/realpath $0`
42 else
43 echo "ERROR: Need to do apt-get install realpath"
44 exit 1
45 fi
46 fi
47
48
49 PWD=`pwd`
50 BASENAME=`basename $0`
51 BASEDIR=`echo $FULLPATH | sed "s/\/$BASENAME//g"`
52 LOGFILE=$BASEDIR/log/_build.preparation.log
53 export BASEDIR LOGFILE
54 DIR_CHK=$BASEDIR/cache/check
55 mkdir $BASEDIR/log/ 2>/dev/null
56
57 if [ 'x86_64' = $MACHINE -o 'i686' = $MACHINE -o 'i586' = $MACHINE -o 'i486' = $MACHINE -o 'i386' = $MACHINE ]; then
5cfe86e6 58
df5e82b3
MT
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
a68fedca 339# if [ ! `ls -w1 $BASEDIR/packages/*.tar.gz | grep $1` ]; then
e7164bb4 340 echo "`date -u '+%b %e %T'`: Packaging $1" | tee -a $LOGFILE
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
a68fedca
MT
356# else
357# echo "`date -u '+%b %e %T'`: Packaging: The package $1 already exists"
358# fi
e7164bb4
MT
359 else
360 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
361 fi
e7164bb4
MT
362 return 0
363}
364
df5e82b3
MT
365
366installmake() {
367 if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then
368 echo "`date -u '+%b %e %T'`: Building $*" | tee -a $LOGFILE
369 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t " download >> $LOGFILE 2>&1
370 if [ $? -ne 0 ]; then
371 exiterror "Download error in $1"
372 fi
373 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1
374 if [ $? -ne 0 ]; then
375 exiterror "md5sum error in $1, check file in cache or signature"
376 fi
377 chroot $LFS /tools/bin/env -i HOME=/root \
378 TERM=$TERM PS1='\u:\w\$ ' \
379 PATH=/usr/local/bin:/opt/$MACHINE-uClibc/usr/bin:/bin:/usr/bin:/sbin:/usr/sbin \
380 VERSION=$VERSION \
381 CONFIG_ROOT=$CONFIG_ROOT \
382 LFS_PASS="install" \
383 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
384 CFLAGS="-Os" CXXFLAGS="-Os" \
385 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
386 KVER=$KVER \
387 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
388 /bin/bash -x -c "cd /usr/src/lfs && \
389 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
390 if [ $? -ne 0 ]; then
391 exiterror "Building $*"
392 fi
393 else
394 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
395 fi
396 return 0
397}
398
399buildtoolchain() {
400 LOGFILE="$BASEDIR/log/_build.toolchain.log"
401 export LOGFILE
402 echo -ne "`date -u '+%b %e %T'`: Stage1 toolchain build \n" | tee -a $LOGFILE
403 # Build sed now, as we use some extensions
404 ORG_PATH=$PATH
405 NATIVEGCC=`gcc --version | grep GCC | awk {'print $3'}`
406 export NATIVEGCC GCCmajor=${NATIVEGCC:0:1} GCCminor=${NATIVEGCC:2:1} GCCrelease=${NATIVEGCC:4:1}
407 lfsmake1 ccache
408 lfsmake1 sed LFS_PASS=1
409 lfsmake1 m4 LFS_PASS=1
410 lfsmake1 bison LFS_PASS=1
411 lfsmake1 flex LFS_PASS=1
412 lfsmake1 binutils LFS_PASS=1
413 lfsmake1 gcc LFS_PASS=1
414 export PATH=$BASEDIR/build/usr/local/bin:$BASEDIR/build/tools/bin:$PATH
415
416 lfsmake1 linux
417 lfsmake1 tcl
418 lfsmake1 expect
419 lfsmake1 glibc
420 lfsmake1 dejagnu
421 lfsmake1 gcc LFS_PASS=2
422 lfsmake1 binutils LFS_PASS=2
423 lfsmake1 gawk
424 lfsmake1 coreutils
425 lfsmake1 bzip2
426 lfsmake1 gzip
427 lfsmake1 diffutils
428 lfsmake1 findutils
429 lfsmake1 make
430 lfsmake1 grep
431 lfsmake1 sed LFS_PASS=2
432 lfsmake1 m4 LFS_PASS=2
433 lfsmake1 bison LFS_PASS=2
434 lfsmake1 flex LFS_PASS=2
435 lfsmake1 gettext
436 lfsmake1 ncurses
437 lfsmake1 patch
438 lfsmake1 tar
439 lfsmake1 texinfo
440 lfsmake1 bash
441 lfsmake1 util-linux
442 lfsmake1 perl
443 export PATH=$ORG_PATH
444}
445
446buildbase() {
447 LOGFILE="$BASEDIR/log/_build.base.log"
448 export LOGFILE
449 echo -ne "`date -u '+%b %e %T'`: Stage2 linux base build \n" | tee -a $LOGFILE
450 # Run LFS dynamic binary creation scripts one by one
451 lfsmake2 stage2
452 lfsmake2 makedev
453 lfsmake2 linux
454 lfsmake2 man-pages
455 lfsmake2 glibc
456 lfsmake2 binutils
457 lfsmake2 gcc
458 lfsmake2 coreutils
459 lfsmake2 zlib
460 lfsmake2 mktemp
461 lfsmake2 iana-etc
462 lfsmake2 findutils
463 lfsmake2 gawk
464 lfsmake2 ncurses
465 lfsmake2 vim
466 lfsmake2 m4
467 lfsmake2 bison
468 lfsmake2 less
469 lfsmake2 groff
470 lfsmake2 sed
471 lfsmake2 flex
472 lfsmake2 gettext
473 lfsmake2 net-tools
474 lfsmake2 inetutils
475 lfsmake2 perl
476 lfsmake2 texinfo
477 lfsmake2 autoconf
478 lfsmake2 automake
479 lfsmake2 bash
480 lfsmake2 file
481 lfsmake2 libtool
482 lfsmake2 bzip2
483 lfsmake2 diffutils
484 lfsmake2 ed
485 lfsmake2 kbd
486 lfsmake2 e2fsprogs
487 lfsmake2 grep
488 if [ 'i386' = $MACHINE ]; then
489 lfsmake2 grub
490 elif [ 'alpha' = $MACHINE ]; then
491 lfsmake2 aboot
492 fi
493 lfsmake2 gzip
494 lfsmake2 man
495 lfsmake2 make
496 lfsmake2 modutils
497 lfsmake2 patch
498 lfsmake2 procinfo
499 lfsmake2 procps
500 lfsmake2 psmisc
501 lfsmake2 shadow
502 lfsmake2 sysklogd
503 lfsmake2 sysvinit
504 lfsmake2 tar
505 lfsmake2 util-linux
506}
507
508buildipcop() {
907cd036
MT
509 # Run IPFire make scripts one by one
510 LOGFILE="$BASEDIR/log/_build.ipfire.log"
df5e82b3
MT
511 export LOGFILE
512 echo -ne "`date -u '+%b %e %T'`: Stage3 $NAME build \n" | tee -a $LOGFILE
513
514 # Build these first as some of the kernel packages below rely on
515 # these for some of their client program functionality
516 ipcopmake configroot
517 ipcopmake dhcp
518 ipcopmake dhcpcd
519 ipcopmake libusb
520 ipcopmake libpcap
521 ipcopmake linux-atm
522 ipcopmake ppp
523 ipcopmake rp-pppoe
524 ipcopmake unzip
525 # Do SMP now
526 if [ 'i386' = $MACHINE ]; then
527 # abuse the SMP flag, and make an minimal installer kernel first
528 # so that the boot floppy always works.....
3e45cc09
MT
529 ipcopmake linux LFS_PASS=ipfire SMP=installer
530 ipcopmake linux LFS_PASS=ipfire SMP=1
df5e82b3
MT
531 ipcopmake 3cp4218 SMP=1
532 ipcopmake amedyn SMP=1
533 ipcopmake cxacru SMP=1
534 ipcopmake eagle SMP=1
535
536 # These are here because they have i386 only binary libraries
537 # included in the package.
538 ipcopmake cnx_pci SMP=1
539 ipcopmake fcdsl SMP=1
540 ipcopmake fcdsl2 SMP=1
541 ipcopmake fcdslsl SMP=1
542 ipcopmake fcdslusb SMP=1
543 ipcopmake fcdslslusb SMP=1
6ca65b88 544 ipcopmake fcpci SMP=1
ff7df9d4 545 ipcopmake fcclassic SMP=1
df5e82b3
MT
546 ipcopmake pulsar SMP=1
547 ipcopmake unicorn SMP=1
548 fi
549
3e45cc09 550 ipcopmake linux LFS_PASS=ipfire
df5e82b3
MT
551 ipcopmake 3cp4218
552 ipcopmake amedyn
553 ipcopmake cxacru
554 ipcopmake eciadsl
555 ipcopmake eagle
556 ipcopmake speedtouch
557 if [ 'i386' = $MACHINE ]; then
558 # These are here because they have i386 only binary libraries
559 # included in the package.
560 ipcopmake cnx_pci
561 ipcopmake fcdsl
562 ipcopmake fcdsl2
563 ipcopmake fcdslsl
564 ipcopmake fcdslusb
6ca65b88 565 ipcopmake fcdslslusb
ff7df9d4
MT
566 ipcopmake fcpci
567 ipcopmake fcclassic
df5e82b3
MT
568 ipcopmake pulsar
569 ipcopmake unicorn
570 fi
571
572 ipcopmake pcmcia-cs
573 ipcopmake expat
574 ipcopmake gdbm
575 ipcopmake gmp
576 ipcopmake openssl
577 ipcopmake python
578 ipcopmake libnet
579 ipcopmake libpng
580 ipcopmake gd
581 ipcopmake popt
582 ipcopmake slang
583 ipcopmake newt
584 ipcopmake libcap
585 ipcopmake pciutils
586 ipcopmake pcre
587 ipcopmake apache
588 ipcopmake arping
589 ipcopmake beep
590 ipcopmake bind
591 ipcopmake capi4k-utils
592 ipcopmake cdrtools
593 ipcopmake dnsmasq
594 ipcopmake dosfstools
595 ipcopmake ethtool
596 ipcopmake ez-ipupdate
597 ipcopmake fcron
598 ipcopmake perl-GD
599 ipcopmake gnupg
600 ipcopmake hdparm
601 ipcopmake ibod
602 ipcopmake initscripts
603 ipcopmake iptables
604 ipcopmake ipac-ng
605 ipcopmake ipaddr
606 ipcopmake iproute2
607 ipcopmake iptstate
608 ipcopmake iputils
78331e30 609 ipcopmake l7-protocols
df5e82b3
MT
610 ipcopmake isapnptools
611 ipcopmake isdn4k-utils
612 ipcopmake kudzu
613 ipcopmake logrotate
614 ipcopmake logwatch
615 ipcopmake mingetty
616 ipcopmake misc-progs
617 ipcopmake mtools
618 ipcopmake nano
619 ipcopmake nash
620 ipcopmake nasm
621 ipcopmake URI
622 ipcopmake HTML-Tagset
623 ipcopmake HTML-Parser
624 ipcopmake Compress-Zlib
625 ipcopmake Digest
626 ipcopmake Digest-SHA1
627 ipcopmake Digest-HMAC
628 ipcopmake libwww-perl
629 ipcopmake Net-DNS
630 ipcopmake Net-IPv4Addr
631 ipcopmake Net_SSLeay
4f8b6695
MT
632 ipcopmake IO-Stringy
633 ipcopmake Unix-Syslog
634 ipcopmake Mail-Tools
635 ipcopmake MIME-Tools
636 ipcopmake Net-Server
637 ipcopmake Convert-TNEF
638 ipcopmake Convert-UUlib
639 ipcopmake Archive-Tar
640 ipcopmake Archive-Zip
f28d0ddc 641 ipcopmake Text-Tabs+Wrap
90350ff3 642 ipcopmake Locale-Country
dace10b5 643 ipcopmake GeoIP
df8c7810 644 ipcopmake fwhits
6d4147d2
MT
645 ipcopmake berkeley
646 ipcopmake BerkeleyDB ## The Perl module
df5e82b3
MT
647 ipcopmake noip_updater
648 ipcopmake ntp
649 ipcopmake oinkmaster
650 ipcopmake openssh
651 ipcopmake openswan
652 ipcopmake pptpclient
653 ipcopmake rrdtool
654 ipcopmake setserial
655 ipcopmake setup
656 ipcopmake snort
657 #ipcopmake speedycgi
6d4147d2
MT
658 ipcopmake saslauthd PASS=1
659 ipcopmake openldap
df5e82b3
MT
660 ipcopmake squid
661 ipcopmake squid-graph
60cbd6e7 662 ipcopmake squidguard
df5e82b3
MT
663 ipcopmake tcpdump
664 ipcopmake traceroute
665 ipcopmake vlan
5fcb6d5a 666 #ipcopmake wireless
df5e82b3
MT
667 ipcopmake libsafe
668 ipcopmake 3c5x9setup
894c6feb 669# echo -ne "`date -u '+%b %e %T'`: Building ### IPFire modules ### \n" | tee -a $LOGFILE
b34fd95d 670 ipcopmake pakfire
6ef0bff8 671 ipcopmake startscripts
5e69ef1a 672## Zuerst die Libs und dann die Programme. Ordnung muss sein!
6ef0bff8 673 ipcopmake java
5e69ef1a 674 ipcopmake libtiff
c3defe9b 675 ipcopmake libjpeg
5e69ef1a
MT
676 ipcopmake libxml2
677 ipcopmake spandsp
678 ipcopmake lzo
6ef0bff8 679 ipcopmake openvpn
f8e5510c
MT
680 ipcopmake pkg-config
681 ipcopmake glib
180cd3be 682 ipcopmake xampp
5e69ef1a
MT
683 ipcopmake pam
684 ipcopmake pammysql
371d9df0 685 ipcopmake saslauthd PASS=2
a31b2bc4 686 ipcopmake xinetd
316160b0
MT
687 ipcopmake ghostscript
688 ipcopmake cups
b34fd95d 689# ipcopmake lpd ## Im Moment aus, da CUPS vorhanden ist.
98d413ac 690 ipcopmake samba
5e69ef1a
MT
691 ipcopmake sudo
692 ipcopmake mc
693 ipcopmake pwlib
694 ipcopmake openh323
1fe6c87b 695 ipcopmake wget
60cbd6e7 696 ipcopmake wput
1fe6c87b 697 ipcopmake bridge-utils
3e45cc09
MT
698 ipcopmake screen
699 ipcopmake hddtemp
700 ipcopmake htop
701 ipcopmake lynx
b34fd95d 702 echo -ne "`date -u '+%b %e %T'`: Building ### Mailserver ### \n" | tee -a $LOGFILE
94025eea 703 ipcopmake postfix
6c666a3b 704 ipcopmake procmail
93dc5548
MT
705 ipcopmake fetchmail
706 ipcopmake cyrusimap
f28d0ddc 707 ipcopmake web-cyradm
33a31f1a 708 ipcopmake mailx
f9315063
MT
709 ipcopmake clamav
710 ipcopmake razor
4f8b6695 711 ipcopmake spamassassin
f28d0ddc 712# ipcopmake amavisd
b34fd95d 713 echo -ne "`date -u '+%b %e %T'`: Building ### VoIP-Server ### \n" | tee -a $LOGFILE
94025eea 714 ipcopmake stund
5e69ef1a 715 ipcopmake asterisk
894c6feb 716 ipcopmake mpg123
b34fd95d 717 echo -ne "`date -u '+%b %e %T'`: Building ### MP3-Server ### \n" | tee -a $LOGFILE
316160b0
MT
718 ipcopmake lame
719 ipcopmake gnump3d
6ef0bff8
MT
720 echo -ne "`date -u '+%b %e %T'`: Building ### P2P-Clients ### \n" | tee -a $LOGFILE
721 ipcopmake applejuice
907cd036 722 ipcopmake edonkeyclc
894c6feb 723# ipcopmake sane
3e45cc09
MT
724 echo -ne "`date -u '+%b %e %T'`: Building ### Net-Tools ### \n" | tee -a $LOGFILE
725 ipcopmake ntop
894c6feb 726# ipcopmake rsync
3b9f6349 727 ipcopmake tcpwrapper
769a61c5 728 ipcopmake portmap
894c6feb 729 ipcopmake nfs
907cd036 730 ipcopmake nmap
3e45cc09 731 ipcopmake iftop
ef05c8bb 732 ipcopmake ncftp
ca35618d 733 ipcopmake cftp
60cbd6e7 734 ipcopmake etherwake
33a31f1a 735 ipcopmake ethereal
0eab8e84 736# ipcopmake stunnel # Ausgeschaltet, weil wir es doch nicht nutzen
df5e82b3
MT
737}
738
739buildinstaller() {
740 # Run installer scripts one by one
741 LOGFILE="$BASEDIR/log/_build.installer.log"
742 export LOGFILE
743 echo -ne "`date -u '+%b %e %T'`: Stage4 installer build \n" | tee -a $LOGFILE
744 if [ 'i386' = $MACHINE ]; then
745 ipcopmake syslinux
746 ipcopmake as86
747 ipcopmake mbr
748 ipcopmake uClibc
749 fi
750 installmake busybox
751 installmake sysvinit
752 installmake e2fsprogs
753 installmake misc-progs
754 installmake slang
755 installmake util-linux
756 installmake newt
757 installmake pciutils
758 installmake pcmcia-cs
759 installmake kbd
760 installmake installer
761 installmake scsi.img
762 installmake driver.img
763 installmake initrd
764 installmake boot.img
765}
766
767buildpackages() {
768 LOGFILE="$BASEDIR/log/_build.packages.log"
769 export LOGFILE
770 echo "... see detailed log in _build.*.log files" >> $LOGFILE
771 echo -ne "`date -u '+%b %e %T'`: Stage5 packages build \n" | tee -a $LOGFILE
772 # Strip files
773 echo "`date -u '+%b %e %T'`: Stripping files" | tee -a $LOGFILE
774 find $LFS/lib $LFS/usr/lib $LFS/usr/share/rrdtool-* $LFS/install ! -type l \( -name '*.so' -o -name '*.so[\.0-9]*' \) \
775 ! -name 'libc.so' ! -name 'libpthread.so' ! -name 'libcrypto.so.0.9.7.sha1' \
90350ff3 776 -exec $LFS/tools/bin/strip --strip-all {} \; >> $LOGFILE 2>&1
df5e82b3
MT
777 # add -ls before -exec if you want to verify what files are stripped
778
779 find $LFS/{,s}bin $LFS/usr/{,s}bin $LFS/usr/local/{,s}bin ! -type l \
780 -exec file {} \; | grep " ELF " | cut -f1 -d ':' | xargs $LFS/tools/bin/strip --strip-all >> $LOGFILE 2>&1
781 # there add -v to strip to verify
782
783 if [ 'i386' = $MACHINE ]; then
784 # Create fcdsl packages
785 echo "`date -u '+%b %e %T'`: Building fcdsl tgz" | tee -a $LOGFILE
786 cp $LFS/install/images/fcdsl/license.txt $LFS >> $LOGFILE 2>&1
787 touch $LFS/var/run/{need-depmod-$KVER,need-depmod-$KVER-smp}
788 cd $LFS && tar cvfz $LFS/install/images/$SNAME-fcdsl-$VERSION.$MACHINE.tgz \
789 lib/modules/$KVER/misc/fcdsl*.o.gz \
790 lib/modules/$KVER-smp/misc/fcdsl*.o.gz \
791 usr/lib/isdn/{fds?base.bin,fd?ubase.frm} \
792 etc/fcdsl/fcdsl*.conf \
793 etc/drdsl/{drdsl,drdsl.ini} \
794 license.txt \
795 var/run/{need-depmod-$KVER,need-depmod-$KVER-smp} >> $LOGFILE 2>&1
796 rm -f $LFS/license.txt >> $LOGFILE 2>&1
797 cd $BASEDIR
798 fi
df5e82b3
MT
799
800 # Generating list of packages used
801 echo "`date -u '+%b %e %T'`: Generating packages list from logs" | tee -a $LOGFILE
802 rm -f $BASEDIR/doc/packages-list
803 for i in `ls -1tr $BASEDIR/log/[^_]*`; do
804 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
3ea75603 805 echo " * `basename $i`" >>$BASEDIR/doc/packages-list
df5e82b3
MT
806 fi
807 done
3ea75603 808 echo "====== List of softwares used to build $NAME Version: $VERSION ======" > $BASEDIR/doc/packages-list.txt
e67a57fe 809 grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|ipcop$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$' \
df5e82b3
MT
810 $BASEDIR/doc/packages-list | sort >> $BASEDIR/doc/packages-list.txt
811 rm -f $BASEDIR/doc/packages-list
c9673262 812 # packages-list.txt is ready to be displayed for wiki page
df5e82b3
MT
813
814 # Create ISO for CDRom and USB-superfloppy
c3defe9b 815 ipcopmake cdrom
e67a57fe 816 rm -f $LFS/install/images/*usb*
c3defe9b 817 cp $LFS/install/images/{*.iso,*.tgz} $BASEDIR >> $LOGFILE 2>&1
c9673262 818
e67a57fe
MT
819 ipfirepackages
820
821 # Cleanup
822 stdumount
823 rm -rf $BASEDIR/build/tmp/*
824
825 # Generating total list of files
826 echo "`date -u '+%b %e %T'`: Generating files list from logs" | tee -a $LOGFILE
827 rm -f $BASEDIR/log/FILES
828 for i in `ls -1tr $BASEDIR/log/[^_]*`; do
829 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
830 echo "##" >>$BASEDIR/log/FILES
831 echo "## `basename $i`" >>$BASEDIR/log/FILES
832 echo "##" >>$BASEDIR/log/FILES
833 cat $i | sed "s%^\./%#%" | sort >> $BASEDIR/log/FILES
834 fi
835 done
836
837 cd $PWD
838
839}
840
841ipfirepackages() {
483f59cd
MT
842 for i in `ls $BASEDIR/packages`; do
843 touch $BASEDIR/build/install/packages/$i.empty
844 done
f0ca8c34 845 ipfiredist amavisd
78331e30
MT
846 ipfiredist applejuice
847 ipfiredist asterisk
c7acba4a 848 ipfiredist clamav
483f59cd 849 ipfiredist cups
78331e30
MT
850 ipfiredist cyrusimap
851 ipfiredist fetchmail
852 ipfiredist gnump3d
0d0521b6 853 ipfiredist java
78331e30
MT
854 ipfiredist lame
855 ipfiredist libtiff
856 ipfiredist libxml2
f0ca8c34
MT
857 ipfiredist mailx
858 ipfiredist nfs
859 ipfiredist nmap
3e45cc09 860 ipfiredist ntop
78331e30 861 ipfiredist postfix
371d9df0 862 ipfiredist procmail
90350ff3 863 ipfiredist samba
f0ca8c34 864 ipfiredist spamassassin
f28d0ddc 865 ipfiredist web-cyradm
483f59cd 866 ipfiredist xampp
78331e30
MT
867 ipfiredist xinetd
868 test -d $BASEDIR/packages || mkdir $BASEDIR/packages
a8b159e7 869 mv -f $LFS/install/packages/*.{tar.gz,md5} $BASEDIR/packages >> $LOGFILE 2>&1
483f59cd 870 rm -rf $BASEDIR/build/install/packages/*
df5e82b3
MT
871}
872
873# See what we're supposed to do
874case "$1" in
875build)
876 BUILDMACHINE=`uname -m`
21757737 877 PACKAGE=`ls -v -r $BASEDIR/cache/$SNAME-1.4-toolchain-$BUILDMACHINE.tar.gz 2> /dev/null | head -n 1`
df5e82b3
MT
878 #only restore on a clean disk
879 if [ ! -f log/perl-*-tools ]; then
880 if [ ! -n "$PACKAGE" ]; then
881 echo "`date -u '+%b %e %T'`: Full toolchain compilation" | tee -a $LOGFILE
882 prepareenv
883 buildtoolchain
884 else
885 PACKAGENAME=${PACKAGE%.tar.gz}
886 echo "`date -u '+%b %e %T'`: Restore from $PACKAGE" | tee -a $LOGFILE
887 if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then
888 tar zxf $PACKAGE
889 prepareenv
890 else
891 exiterror "$PACKAGENAME md5 did not match, check downloaded package"
892 fi
893 fi
894 else
895 echo "`date -u '+%b %e %T'`: Using installed toolchain" | tee -a $LOGFILE
896 prepareenv
897 fi
5cfe86e6 898
df5e82b3
MT
899 buildbase
900 buildipcop
5cfe86e6
HS
901
902 # Setzen des IPFire Builds
903 if [ -e ./.svn ]; then
904 cat .svn/entries |sed -n 's/^[ \t]*revision=\"// p' | sed -n 's/\".*$// p' > $LFS/home/httpd/html/firebuild
905 else
906 echo "_(OvO)_" > $LFS/home/httpd/html/firebuild
907 fi
908
df5e82b3
MT
909 buildinstaller
910 buildpackages
911 ;;
912shell)
913 # enter a shell inside LFS chroot
914 # may be used to changed kernel settings
915 prepareenv
916 entershell
917 ;;
918changelog)
d1dd6669 919 echo -n "Loading new Changelog from SVN: "
f9315063 920 svn log http://svn.ipfire.eu/svn/ipfire > doc/ChangeLog
d1dd6669 921 echo "Finished!"
df5e82b3
MT
922 ;;
923check)
924 echo "Checking sources files availability on the web"
925 if [ ! -d $DIR_CHK ]; then
926 mkdir -p $DIR_CHK
927 fi
928 FINISHED=0
929 cd $BASEDIR/lfs
930 for c in `seq $MAX_RETRIES`; do
931 if (( FINISHED==1 )); then
932 break
933 fi
934 FINISHED=1
935 cd $BASEDIR/lfs
936 for i in *; do
937 if [ -f "$i" -a "$i" != "Config" ]; then
938 make -s -f $i MACHINE=$MACHINE LFS_BASEDIR=$BASEDIR ROOT=$BASEDIR/build \
939 MESSAGE="$i\t ($c/$MAX_RETRIES)" check
940 if [ $? -ne 0 ]; then
941 echo "Check : wget error in lfs/$i"
942 FINISHED=0
943 fi
944 fi
945 done
946 done
947 cd -
948 ;;
949checkclean)
950 echo "Erasing sources files availability tags"
951 rm -rf $DIR_CHK/*
952 ;;
953clean)
954 for i in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do
955 $LOSETUP -d $i 2>/dev/null
956 done
957 for i in `mount | grep $BASEDIR | cut -d " " -f 1`; do
958 umount $i
959 done
960 stdumount
961 for i in `seq 0 7`; do
962 if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
963 umount /dev/loop${i} 2>/dev/null;
964 losetup -d /dev/loop${i} 2>/dev/null;
965 fi;
966 done
967 rm -rf $BASEDIR/build
968 rm -rf $BASEDIR/cdrom
f9315063 969 rm -rf $BASEDIR/packages
df5e82b3 970 rm -rf $BASEDIR/log
df5e82b3
MT
971 if [ -h /tools ]; then
972 rm -f /tools
973 fi
974 ;;
975dist)
4f8b6695 976 echo -ne "Updating & building source package from SVN: "
a414d696
MT
977 svn up > /dev/null
978 svn export http://svn.ipfire.eu/svn/ipfire ipfire-source/ --force > /dev/null
ecc898f7
MT
979 tar cfz ipfire-source-`date +'%Y-%m-%d'`-r`svn info | grep Revision | cut -c 11-`.tar.gz ipfire-source
980 rm ipfire-source/ -r
4f8b6695 981 echo "Finished!"
df5e82b3 982 ;;
f8e5510c 983newpak)
a9b17001
MT
984 # create structure for a new package
985 echo -e "Name of the new package: $2"
986 if [ ! -f "lfs/$2" ]; then
987 echo "`date -u '+%b %e %T'`: Creating directory src/paks/$2"
988 mkdir -p src/paks/$2
989 cd src/paks/$2
f8e5510c 990 echo "`date -u '+%b %e %T'`: Creating files"
a9b17001
MT
991 cp $BASEDIR/lfs/postfix $BASEDIR/lfs/$2
992
f8e5510c 993 touch ROOTFILES
f8e5510c 994 touch {,un}install.sh
a9b17001 995 ## install.sh
f8e5510c
MT
996 echo '#!/bin/bash' > install.sh
997 echo '#' >> install.sh
998 echo '#################################################################' >> install.sh
999 echo '# #' >> install.sh
1000 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> install.sh
1001 echo '# #' >> install.sh
1002 echo '#################################################################' >> install.sh
1003 echo '#' >> install.sh
1004 echo '# Extract the files' >> install.sh
1005 echo 'tar xfz files.tgz -C /' >> install.sh
a9b17001
MT
1006 echo 'cp -f ROOTFILES /opt/pakfire/installed/ROOTFILES.$2' >> install.sh
1007 ## uninstall.sh
f8e5510c
MT
1008 echo '#!/bin/bash' > uninstall.sh
1009 echo '#################################################################' >> uninstall.sh
1010 echo '# #' >> uninstall.sh
1011 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> uninstall.sh
1012 echo '# #' >> uninstall.sh
1013 echo '#################################################################' >> uninstall.sh
1014 echo '#' >> uninstall.sh
1015 echo '# Delete the files' >> uninstall.sh
1016 echo '## Befehl fehlt noch' >> uninstall.sh
a9b17001 1017 echo 'rm -f /opt/pakfire/installed/ROOTFILES.$2' >> uninstall.sh
f8e5510c 1018 echo "`date -u '+%b %e %T'`: Adding files to SVN"
a9b17001
MT
1019 cd - && svn add lfs/$2 && svn add src/paks/$2
1020
1021 echo -n "Do you want to remove the folders? [y/n]"
1022 read REM
1023 if [ "$REM" == "y" ]; then
1024 echo "Removing the folders..."
1025 svn del src/paks/$2 --force
1026 else
1027 echo "Folders are kept."
1028 fi
df5e82b3 1029 else
a9b17001 1030 echo "$2 already exists"
df5e82b3 1031 fi
df5e82b3
MT
1032 exit 0
1033 ;;
1034prefetch)
1035 if [ ! -d $BASEDIR/cache ]; then
1036 mkdir $BASEDIR/cache
1037 fi
1038 mkdir -p $BASEDIR/log
1039 echo "`date -u '+%b %e %T'`:Preload all source files" | tee -a $LOGFILE
1040 FINISHED=0
1041 cd $BASEDIR/lfs
1042 for c in `seq $MAX_RETRIES`; do
1043 if (( FINISHED==1 )); then
1044 break
1045 fi
1046 FINISHED=1
1047 cd $BASEDIR/lfs
1048 for i in *; do
1049 if [ -f "$i" -a "$i" != "Config" ]; then
1050 make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t ($c/$MAX_RETRIES)" download >> $LOGFILE 2>&1
1051 if [ $? -ne 0 ]; then
1052 echo "Prefetch : wget error in lfs/$i"
1053 FINISHED=0
1054 else
1055 if [ $c -eq 1 ]; then
1056 echo "Prefetch : lfs/$i files loaded"
1057 fi
1058 fi
1059 fi
1060 done
1061 done
1062 echo "Prefetch : verifying md5sum"
1063 ERROR=0
1064 for i in *; do
1065 if [ -f "$i" -a "$i" != "Config" ]; then
1066 make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t " md5 >> $LOGFILE 2>&1
1067 if [ $? -ne 0 ]; then
1068 echo "md5 difference in lfs/$i"
1069 ERROR=1
1070 fi
1071 fi
1072 done
1073 if [ $ERROR -eq 0 ]; then
1074 echo "Prefetch : all files md5sum match"
1075 fi
1076 cd -
1077 ;;
df5e82b3
MT
1078toolchain)
1079 prepareenv
1080 buildtoolchain
1081 BUILDMACHINE=`uname -m`
1082 echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for $BUILDMACHINE" | tee -a $LOGFILE
1083 cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \
1084 build/{bin,etc,usr/bin,usr/local} \
1085 build/tools/{bin,etc,*-linux-gnu,include,lib,libexec,sbin,share,var} \
1086 log >> $LOGFILE
1087 md5sum cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \
1088 > cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.md5
1089 stdumount
1090 ;;
1091gettoolchain)
1092 BUILDMACHINE=`uname -m`
1093 # arbitrary name to be updated in case of new toolchain package upload
e29556d8
MT
1094 PACKAGE=$SNAME-1.4-toolchain-$BUILDMACHINE
1095 URL_IPFIRE=`grep URL_IPFIRE lfs/Config | awk '{ print $3 }'`
df5e82b3
MT
1096 echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for $BUILDMACHINE" | tee -a $LOGFILE
1097 cd $BASEDIR/cache
21757737 1098 wget $URL_IPFIRE/toolchains/$PACKAGE.tar.gz $URL_IPFIRE/toolchains/$PACKAGE.md5 >& /dev/null
df5e82b3
MT
1099 if [ $? -ne 0 ]; then
1100 echo "`date -u '+%b %e %T'`: error downloading toolchain for $BUILDMACHINE machine" | tee -a $LOGFILE
21757737
MT
1101# else
1102# if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then
1103# echo "`date -u '+%b %e %T'`: toolchain md5 ok" | tee -a $LOGFILE
1104# echo "`date -u '+%b %e %T'`: Uncompressing toolchain" | tee -a $LOGFILE
1105# cd $BASEDIR && tar xfz cache/$PACKAGE.tar.gz -C .
1106# rm -f $BASEDIR/cache/$PACKAGE.{tar.gz,md5}
1107# else
1108# exiterror "$PACKAGE.md5 did not match, check downloaded package"
1109# fi
df5e82b3
MT
1110 fi
1111 ;;
78331e30
MT
1112paks)
1113 prepareenv
c7acba4a
MT
1114 # buildpackages
1115 ipfirepackages
78331e30 1116 ;;
a9b17001
MT
1117update)
1118 echo "Load the latest source-files:"
1119 svn update
1120 ;;
3b9f6349
MT
1121commit)
1122 echo "Upload the changed files:"
3b9f6349 1123 svn commit
ff7df9d4 1124 ./make.sh sync
e67a57fe 1125 svn up > /dev/null
3b9f6349 1126 ;;
f9315063
MT
1127make)
1128 echo "Do a complete compile:"
78331e30 1129 ./make.sh prefetch && ./make.sh gettoolchain && ./make.sh build
4f8b6695
MT
1130 ;;
1131diff)
1132 echo -ne "Make a local diff to last SVN revision: "
1133 svn diff > ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff
1134 echo "Finished!"
1135 echo "Diff was successfully saved to ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff"
f9315063 1136 ;;
0eab8e84
MT
1137sync)
1138 echo -e "Syncing Cache to FTP:"
a68fedca
MT
1139 if [ -f .pass ]; then
1140 PASS="`cat .pass`"
1141 else
1142 echo -ne "Password for mirror.ipfire.org: "; read PASS
1143 fi
ef05c8bb 1144 rm -f doc/packages-to-remove-from-ftp
0eab8e84
MT
1145 ncftpls -u web3 -p $PASS ftp://mirror.ipfire.org/html/source-packages/source/ > ftplist
1146 for i in `ls -w1 cache/`; do
1147 grep $i ftplist
1148 if [ "$?" -ne "0" ]; then
1149 ncftpput -u web3 -p $PASS mirror.ipfire.org /html/source-packages/source cache/$i
1150 if [ "$?" -eq "0" ]; then
1151 echo -e "$i was successfully uploaded to the ftp server."
1152 else
1153 echo -e "There was an error while uploading $i to the ftp server."
1154 fi
1155 fi
1156 done
ef05c8bb
MT
1157 for i in `cat ftplist`; do
1158 ls -w1 cache/ | grep $i
1159 if [ "$?" -eq "1" ]; then
1160 echo $i | grep -v toolchain >> doc/packages-to-remove-from-ftp
1161 fi
1162 done
0eab8e84
MT
1163 rm -f ftplist
1164 ;;
0d0521b6 1165pub-iso)
e67a57fe 1166 echo -e "Upload the ISO to the beta-mirror!"
a68fedca
MT
1167 if [ -f .pass ]; then
1168 PASS="`cat .pass`"
1169 else
1170 echo -ne "Password for mirror.ipfire.org: "; read PASS
1171 fi
e67a57fe
MT
1172 ncftpls -u web3 -p $PASS ftp://mirror.ipfire.org/html/source-packages/beta/ | grep `svn info | grep Revision | cut -c 11-`
1173 if [ "$?" -eq "1" ]; then
1174 cp $BASEDIR/ipfire-install-1.4.i386.iso $BASEDIR/ipfire-install-1.4.i386-r`svn info | grep Revision | cut -c 11-`.iso
1175 md5sum ipfire-install-1.4.i386-r`svn info | grep Revision | cut -c 11-`.iso > ipfire-install-1.4.i386-r`svn info | grep Revision | cut -c 11-`.iso.md5
1176 ncftpput -u web3 -p $PASS mirror.ipfire.org /html/source-packages/beta/ ipfire-install-1.4.i386-r`svn info | grep Revision | cut -c 11-`.iso
1177 ncftpput -u web3 -p $PASS mirror.ipfire.org /html/source-packages/beta/ ipfire-install-1.4.i386-r`svn info | grep Revision | cut -c 11-`.iso.md5
1178 if [ "$?" -eq "0" ]; then
1179 echo -e "The ISO of Revision `svn info | grep Revision | cut -c 11-` was successfully uploaded to the ftp server."
1180 else
1181 echo -e "There was an error while uploading the ISO to the ftp server."
1182 fi
1183 else
1184 echo -e "File with name ipfire-install-1.4.i386-r`svn info | grep Revision | cut -c 11-`.iso already exists on the ftp server!"
1185 fi
1186 rm -f ipfire-install-1.4.i386-r`svn info | grep Revision | cut -c 11-`.iso{,.md5}
1187 ;;
0d0521b6
MT
1188pub-paks)
1189 echo -e "Upload the packages to the beta-mirror!"
a68fedca
MT
1190 if [ -f .pass ]; then
1191 PASS="`cat .pass`"
1192 else
1193 echo -ne "Password for mirror.ipfire.org: "; read PASS
1194 fi
0d0521b6
MT
1195 ncftpput -z -u web3 -p $PASS mirror.ipfire.org /html/source-packages/packages/ packages/*
1196 if [ "$?" -eq "0" ]; then
1197 echo -e "The packages were successfully uploaded to the ftp server."
1198 else
1199 echo -e "There was an error while uploading the packages to the ftp server."
1200 fi
1201 ;;
df5e82b3 1202*)
0d0521b6 1203 echo "Usage: $0 {build|changelog|check|checkclean|clean|commit|diff|dist|gettoolchain|make|newpak|prefetch|pub-iso|pub-paks|shell|sync|toolchain|update}"
df5e82b3
MT
1204 cat doc/make.sh-usage
1205 exit 1
1206 ;;
3ea75603 1207esac