GeƤndert:
[ipfire-2.x.git] / make.sh
CommitLineData
df5e82b3
MT
1#!/bin/bash
2#
3############################################################################
4# #
f8e5510c 5# This file is part of the IPFire Firewall. #
df5e82b3 6# #
f8e5510c 7# IPFire is free software; you can redistribute it and/or modify #
df5e82b3
MT
8# it under the terms of the GNU General Public License as published by #
9# the Free Software Foundation; either version 2 of the License, or #
10# (at your option) any later version. #
11# #
f8e5510c 12# IPFire is distributed in the hope that it will be useful, #
df5e82b3
MT
13# but WITHOUT ANY WARRANTY; without even the implied warranty of #
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15# GNU General Public License for more details. #
16# #
17# You should have received a copy of the GNU General Public License #
f8e5510c 18# along with IPFire; if not, write to the Free Software #
df5e82b3
MT
19# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
20# #
f8e5510c 21# Copyright (C) 2006 IPFire-Team <entwickler@ipfire.org>. #
df5e82b3
MT
22# #
23############################################################################
df5e82b3
MT
24#
25
f8e5510c 26 NAME="IPFire" # Software name
3ea75603 27 SNAME="ipfire" # Short name
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
58 echo "`date -u '+%b %e %T'`: Machine is ix86 (or equivalent)" | tee -a $LOGFILE
59 MACHINE=i386
60 BUILDTARGET=i386-pc-linux-gnu
61 CFLAGS="-O2 -mcpu=i386 -march=i386 -pipe -fomit-frame-pointer"
62 CXXFLAGS="-O2 -mcpu=i386 -march=i386 -pipe -fomit-frame-pointer"
63 elif [ 'alpha' = $MACHINE ]; then
64 echo "`date -u '+%b %e %T'`: Machine is Alpha AXP" | tee -a $LOGFILE
65 BUILDTARGET=alpha-unknown-linux-gnu
66 CFLAGS="-O2 -mcpu=ev4 -mieee -pipe"
67 CXXFLAGS="-O2 -mcpu=ev4 -mieee -pipe"
68 else
69 echo "`date -u '+%b %e %T'`: Can't determine your architecture - $MACHINE" | tee -a $LOGFILE
70 exit 1
71 fi
72
73# Define immediately
74stdumount() {
75 umount $BASEDIR/build/dev/pts 2>/dev/null;
94025eea
MT
76 umount $BASEDIR/build/proc 2>/dev/null;
77 umount $BASEDIR/build/install/mnt 2>/dev/null;
df5e82b3
MT
78 umount $BASEDIR/build/usr/src/cache 2>/dev/null;
79 umount $BASEDIR/build/usr/src/ccache 2>/dev/null;
80 umount $BASEDIR/build/usr/src/config 2>/dev/null;
94025eea
MT
81 umount $BASEDIR/build/usr/src/doc 2>/dev/null;
82 umount $BASEDIR/build/usr/src/html 2>/dev/null;
df5e82b3 83 umount $BASEDIR/build/usr/src/langs 2>/dev/null;
94025eea
MT
84 umount $BASEDIR/build/usr/src/lfs 2>/dev/null;
85 umount $BASEDIR/build/usr/src/log 2>/dev/null;
86 umount $BASEDIR/build/usr/src/src 2>/dev/null;
df5e82b3
MT
87}
88
89exiterror() {
90 stdumount
91 for i in `seq 0 7`; do
92 if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
93 losetup -d /dev/loop${i} 2>/dev/null
94 fi;
95 done
96 echo "ERROR: $*"
97 echo " Check $LOGFILE for errors if applicable"
98 exit 1
99}
100
101entershell() {
102 if [ ! -e $BASEDIR/build/usr/src/lfs/ ]; then
103 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/"
104 fi
105 echo "Entering to a shell inside LFS chroot, go out with exit"
106 chroot $LFS /tools/bin/env -i HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
107 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
108 VERSION=$VERSION CONFIG_ROOT=$CONFIG_ROOT \
109 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
110 CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" \
111 CCACHE_DIR=/usr/src/ccache \
112 CCACHE_HASHDIR=1 \
113 KVER=$KVER \
114 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
115 KGCC="ccache /usr/bin/gcc" \
116 /tools/bin/bash
117 if [ $? -ne 0 ]; then
118 exiterror "chroot error"
119 else
120 stdumount
121 fi
122}
123
124prepareenv() {
125 ############################################################################
126 # #
127 # Are we running the right shell? #
128 # #
129 ############################################################################
130 if [ ! "$BASH" ]; then
131 exiterror "BASH environment variable is not set. You're probably running the wrong shell."
132 fi
133
134 if [ -z "${BASH_VERSION}" ]; then
135 exiterror "Not running BASH shell."
136 fi
137
138
139 ############################################################################
140 # #
141 # Trap on emergency exit #
142 # #
143 ############################################################################
144 trap "exiterror 'Build process interrupted'" SIGINT SIGTERM SIGKILL SIGSTOP SIGQUIT
145
146
147 ############################################################################
148 # #
149 # Resetting our nice level #
150 # #
151 ############################################################################
152 echo "`date -u '+%b %e %T'`: Resetting our nice level to $NICE" | tee -a $LOGFILE
153 renice $NICE $$ > /dev/null
154 if [ `nice` != "$NICE" ]; then
155 exiterror "Failed to set correct nice level"
156 fi
157
158 ############################################################################
159 # #
160 # Checking if running as root user #
161 # #
162 ############################################################################
163 echo "`date -u '+%b %e %T'`: Checking if we're running as root user" | tee -a $LOGFILE
164 if [ `id -u` != 0 ]; then
165 exiterror "Not building as root"
166 fi
167
168
169 ############################################################################
170 # #
171 # Checking for necessary temporary space #
172 # #
173 ############################################################################
174 echo "`date -u '+%b %e %T'`: Checking for necessary space on disk $BASE_DEV" | tee -a $LOGFILE
175 BASE_DEV=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $1 }'`
176 BASE_ASPACE=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $4 }'`
177 if (( 2202000 > $BASE_ASPACE )); then
178 BASE_USPACE=`du -skx $BASEDIR | awk '{print $1}'`
179 if (( 2202000 - $BASE_USPACE > $BASE_ASPACE )); then
180 exiterror "Not enough temporary space available, need at least 2.1GB on $BASE_DEV"
181 fi
182 fi
183
184 ############################################################################
185 # #
186 # Building Linux From Scratch system #
187 # #
188 ############################################################################
189 echo "`date -u '+%b %e %T'`: Building Linux From Scratch system" | tee -a $LOGFILE
190
191 # Set umask
192 umask 022
193
194 # Set LFS Directory
195 LFS=$BASEDIR/build
196
197 # Check /tools symlink
198 if [ -h /tools ]; then
199 rm -f /tools
200 fi
201 if [ ! -a /tools ]; then
202 ln -s $BASEDIR/build/tools /
203 fi
204 if [ ! -h /tools ]; then
205 exiterror "Could not create /tools symbolic link."
206 fi
207
208 # Setup environment
209 set +h
210 LC_ALL=POSIX
211 export LFS LC_ALL CFLAGS CXXFLAGS
212 unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
213
214 # Make some extra directories
215 mkdir -p $BASEDIR/build/{tools,etc,usr/src} 2>/dev/null
216 mkdir -p $BASEDIR/{cache,ccache} 2>/dev/null
217 mkdir -p $BASEDIR/build/dev/pts $BASEDIR/build/proc $BASEDIR/build/usr/src/{cache,config,doc,html,langs,lfs,log,src,ccache}
218
219 # Make all sources and proc available under lfs build
220 mount --bind /dev/pts $BASEDIR/build/dev/pts
221 mount --bind /proc $BASEDIR/build/proc
222 mount --bind $BASEDIR/cache $BASEDIR/build/usr/src/cache
223 mount --bind $BASEDIR/ccache $BASEDIR/build/usr/src/ccache
224 mount --bind $BASEDIR/config $BASEDIR/build/usr/src/config
225 mount --bind $BASEDIR/doc $BASEDIR/build/usr/src/doc
226 mount --bind $BASEDIR/html $BASEDIR/build/usr/src/html
227 mount --bind $BASEDIR/langs $BASEDIR/build/usr/src/langs
228 mount --bind $BASEDIR/lfs $BASEDIR/build/usr/src/lfs
229 mount --bind $BASEDIR/log $BASEDIR/build/usr/src/log
230 mount --bind $BASEDIR/src $BASEDIR/build/usr/src/src
231
232 # Run LFS static binary creation scripts one by one
233 export CCACHE_DIR=$BASEDIR/ccache
234 export CCACHE_HASHDIR=1
235
236 # Remove pre-install list of installed files in case user erase some files before rebuild
237 rm -f $BASEDIR/build/usr/src/lsalr 2>/dev/null
238}
239
240
241############################################################################
242# #
243# Necessary shell functions #
244# #
245############################################################################
246lfsmake1() {
247 if [ -f $BASEDIR/lfs/$1 ]; then
248 echo "`date -u '+%b %e %T'`: Building $*" | tee -a $LOGFILE
249 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t " download >> $LOGFILE 2>&1
250 if [ $? -ne 0 ]; then
251 exiterror "Download error in $1"
252 fi
253 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1
254 if [ $? -ne 0 ]; then
255 exiterror "md5sum error in $1, check file in cache or signature"
256 fi
257 cd $BASEDIR/lfs && make -f $* BUILDTARGET=$BUILDTARGET \
258 MACHINE=$MACHINE \
259 LFS_BASEDIR=$BASEDIR \
260 ROOT=$LFS \
261 KVER=$KVER \
262 install >> $LOGFILE 2>&1
263 if [ $? -ne 0 ]; then
264 exiterror "Building $*";
265 fi
266 else
267 exiterror "No such file or directory: $BASEDIR/$1"
268 fi
269 return 0
270}
271
272lfsmake2() {
273 if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then
274 echo "`date -u '+%b %e %T'`: Building $*" | tee -a $LOGFILE
275 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t " download >> $LOGFILE 2>&1
276 if [ $? -ne 0 ]; then
277 exiterror "Download error in $1"
278 fi
279 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1
280 if [ $? -ne 0 ]; then
281 exiterror "md5sum error in $1, check file in cache or signature"
282 fi
283 chroot $LFS /tools/bin/env -i HOME=/root \
284 TERM=$TERM PS1='\u:\w\$ ' \
285 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
286 VERSION=$VERSION \
287 CONFIG_ROOT=$CONFIG_ROOT \
288 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
289 CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" \
290 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
291 KVER=$KVER \
292 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
293 /tools/bin/bash -x -c "cd /usr/src/lfs && \
294 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
295 if [ $? -ne 0 ]; then
296 exiterror "Building $*"
297 fi
298 else
299 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
300 fi
301 return 0
302}
303
304ipcopmake() {
305 if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then
306 echo "`date -u '+%b %e %T'`: Building $*" | tee -a $LOGFILE
307 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t " download >> $LOGFILE 2>&1
308 if [ $? -ne 0 ]; then
309 exiterror "Download error in $1"
310 fi
311 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1
312 if [ $? -ne 0 ]; then
313 exiterror "md5sum error in $1, check file in cache or signature"
314 fi
315 chroot $LFS /tools/bin/env -i HOME=/root \
316 TERM=$TERM PS1='\u:\w\$ ' \
317 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \
318 VERSION=$VERSION \
319 CONFIG_ROOT=$CONFIG_ROOT \
320 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
321 CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" \
322 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
323 KVER=$KVER \
324 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
325 /bin/bash -x -c "cd /usr/src/lfs && \
326 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
327 if [ $? -ne 0 ]; then
328 exiterror "Building $*"
329 fi
330 else
331 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
332 fi
333 return 0
334}
335
e7164bb4
MT
336ipfiredist() {
337 if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then
e67a57fe
MT
338 ls $BASEDIR/packages/$1* >& /dev/null
339 if [ $? -eq 1 ]; then
e7164bb4 340 echo "`date -u '+%b %e %T'`: Packaging $1" | tee -a $LOGFILE
98d413ac 341 cp -f $BASEDIR/src/scripts/make-packages.sh $BASEDIR/build/usr/local/bin
e7164bb4
MT
342 chroot $LFS /tools/bin/env -i HOME=/root \
343 TERM=$TERM PS1='\u:\w\$ ' \
344 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \
345 VERSION=$VERSION \
346 CONFIG_ROOT=$CONFIG_ROOT \
347 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
348 CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" \
349 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
350 KVER=$KVER \
351 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
352 /bin/bash -x -c "cd /usr/src/lfs && \
353 make -f $1 LFS_BASEDIR=/usr/src dist" >>$LOGFILE 2>&1
354 if [ $? -ne 0 ]; then
355 exiterror "Packaging $1"
356 fi
78331e30 357 else
0d0521b6 358 echo -e "`date -u '+%b %e %T'`: Package with name $1 already exists!" | tee -a $LOGFILE
e67a57fe 359 fi
e7164bb4
MT
360 else
361 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
362 fi
e7164bb4
MT
363 return 0
364}
365
df5e82b3
MT
366
367installmake() {
368 if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then
369 echo "`date -u '+%b %e %T'`: Building $*" | tee -a $LOGFILE
370 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t " download >> $LOGFILE 2>&1
371 if [ $? -ne 0 ]; then
372 exiterror "Download error in $1"
373 fi
374 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1
375 if [ $? -ne 0 ]; then
376 exiterror "md5sum error in $1, check file in cache or signature"
377 fi
378 chroot $LFS /tools/bin/env -i HOME=/root \
379 TERM=$TERM PS1='\u:\w\$ ' \
380 PATH=/usr/local/bin:/opt/$MACHINE-uClibc/usr/bin:/bin:/usr/bin:/sbin:/usr/sbin \
381 VERSION=$VERSION \
382 CONFIG_ROOT=$CONFIG_ROOT \
383 LFS_PASS="install" \
384 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
385 CFLAGS="-Os" CXXFLAGS="-Os" \
386 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
387 KVER=$KVER \
388 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
389 /bin/bash -x -c "cd /usr/src/lfs && \
390 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
391 if [ $? -ne 0 ]; then
392 exiterror "Building $*"
393 fi
394 else
395 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
396 fi
397 return 0
398}
399
400buildtoolchain() {
401 LOGFILE="$BASEDIR/log/_build.toolchain.log"
402 export LOGFILE
403 echo -ne "`date -u '+%b %e %T'`: Stage1 toolchain build \n" | tee -a $LOGFILE
404 # Build sed now, as we use some extensions
405 ORG_PATH=$PATH
406 NATIVEGCC=`gcc --version | grep GCC | awk {'print $3'}`
407 export NATIVEGCC GCCmajor=${NATIVEGCC:0:1} GCCminor=${NATIVEGCC:2:1} GCCrelease=${NATIVEGCC:4:1}
408 lfsmake1 ccache
409 lfsmake1 sed LFS_PASS=1
410 lfsmake1 m4 LFS_PASS=1
411 lfsmake1 bison LFS_PASS=1
412 lfsmake1 flex LFS_PASS=1
413 lfsmake1 binutils LFS_PASS=1
414 lfsmake1 gcc LFS_PASS=1
415 export PATH=$BASEDIR/build/usr/local/bin:$BASEDIR/build/tools/bin:$PATH
416
417 lfsmake1 linux
418 lfsmake1 tcl
419 lfsmake1 expect
420 lfsmake1 glibc
421 lfsmake1 dejagnu
422 lfsmake1 gcc LFS_PASS=2
423 lfsmake1 binutils LFS_PASS=2
424 lfsmake1 gawk
425 lfsmake1 coreutils
426 lfsmake1 bzip2
427 lfsmake1 gzip
428 lfsmake1 diffutils
429 lfsmake1 findutils
430 lfsmake1 make
431 lfsmake1 grep
432 lfsmake1 sed LFS_PASS=2
433 lfsmake1 m4 LFS_PASS=2
434 lfsmake1 bison LFS_PASS=2
435 lfsmake1 flex LFS_PASS=2
436 lfsmake1 gettext
437 lfsmake1 ncurses
438 lfsmake1 patch
439 lfsmake1 tar
440 lfsmake1 texinfo
441 lfsmake1 bash
442 lfsmake1 util-linux
443 lfsmake1 perl
444 export PATH=$ORG_PATH
445}
446
447buildbase() {
448 LOGFILE="$BASEDIR/log/_build.base.log"
449 export LOGFILE
450 echo -ne "`date -u '+%b %e %T'`: Stage2 linux base build \n" | tee -a $LOGFILE
451 # Run LFS dynamic binary creation scripts one by one
452 lfsmake2 stage2
453 lfsmake2 makedev
454 lfsmake2 linux
455 lfsmake2 man-pages
456 lfsmake2 glibc
457 lfsmake2 binutils
458 lfsmake2 gcc
459 lfsmake2 coreutils
460 lfsmake2 zlib
461 lfsmake2 mktemp
462 lfsmake2 iana-etc
463 lfsmake2 findutils
464 lfsmake2 gawk
465 lfsmake2 ncurses
466 lfsmake2 vim
467 lfsmake2 m4
468 lfsmake2 bison
469 lfsmake2 less
470 lfsmake2 groff
471 lfsmake2 sed
472 lfsmake2 flex
473 lfsmake2 gettext
474 lfsmake2 net-tools
475 lfsmake2 inetutils
476 lfsmake2 perl
477 lfsmake2 texinfo
478 lfsmake2 autoconf
479 lfsmake2 automake
480 lfsmake2 bash
481 lfsmake2 file
482 lfsmake2 libtool
483 lfsmake2 bzip2
484 lfsmake2 diffutils
485 lfsmake2 ed
486 lfsmake2 kbd
487 lfsmake2 e2fsprogs
488 lfsmake2 grep
489 if [ 'i386' = $MACHINE ]; then
490 lfsmake2 grub
491 elif [ 'alpha' = $MACHINE ]; then
492 lfsmake2 aboot
493 fi
494 lfsmake2 gzip
495 lfsmake2 man
496 lfsmake2 make
497 lfsmake2 modutils
498 lfsmake2 patch
499 lfsmake2 procinfo
500 lfsmake2 procps
501 lfsmake2 psmisc
502 lfsmake2 shadow
503 lfsmake2 sysklogd
504 lfsmake2 sysvinit
505 lfsmake2 tar
506 lfsmake2 util-linux
507}
508
509buildipcop() {
907cd036
MT
510 # Run IPFire make scripts one by one
511 LOGFILE="$BASEDIR/log/_build.ipfire.log"
df5e82b3
MT
512 export LOGFILE
513 echo -ne "`date -u '+%b %e %T'`: Stage3 $NAME build \n" | tee -a $LOGFILE
514
515 # Build these first as some of the kernel packages below rely on
516 # these for some of their client program functionality
517 ipcopmake configroot
518 ipcopmake dhcp
519 ipcopmake dhcpcd
520 ipcopmake libusb
521 ipcopmake libpcap
522 ipcopmake linux-atm
523 ipcopmake ppp
524 ipcopmake rp-pppoe
525 ipcopmake unzip
526 # Do SMP now
527 if [ 'i386' = $MACHINE ]; then
528 # abuse the SMP flag, and make an minimal installer kernel first
529 # so that the boot floppy always works.....
530 ipcopmake linux LFS_PASS=ipcop SMP=installer
531 ipcopmake linux LFS_PASS=ipcop SMP=1
532 ipcopmake 3cp4218 SMP=1
533 ipcopmake amedyn SMP=1
534 ipcopmake cxacru SMP=1
535 ipcopmake eagle SMP=1
536
537 # These are here because they have i386 only binary libraries
538 # included in the package.
539 ipcopmake cnx_pci SMP=1
540 ipcopmake fcdsl SMP=1
541 ipcopmake fcdsl2 SMP=1
542 ipcopmake fcdslsl SMP=1
543 ipcopmake fcdslusb SMP=1
544 ipcopmake fcdslslusb SMP=1
6ca65b88 545 ipcopmake fcpci SMP=1
ff7df9d4 546 ipcopmake fcclassic SMP=1
df5e82b3
MT
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
6ca65b88 566 ipcopmake fcdslslusb
ff7df9d4
MT
567 ipcopmake fcpci
568 ipcopmake fcclassic
df5e82b3
MT
569 ipcopmake pulsar
570 ipcopmake unicorn
571 fi
572
573 ipcopmake pcmcia-cs
574 ipcopmake expat
575 ipcopmake gdbm
576 ipcopmake gmp
577 ipcopmake openssl
578 ipcopmake python
579 ipcopmake libnet
580 ipcopmake libpng
581 ipcopmake gd
582 ipcopmake popt
583 ipcopmake slang
584 ipcopmake newt
585 ipcopmake libcap
586 ipcopmake pciutils
587 ipcopmake pcre
588 ipcopmake apache
589 ipcopmake arping
590 ipcopmake beep
591 ipcopmake bind
592 ipcopmake capi4k-utils
593 ipcopmake cdrtools
594 ipcopmake dnsmasq
595 ipcopmake dosfstools
596 ipcopmake ethtool
597 ipcopmake ez-ipupdate
598 ipcopmake fcron
599 ipcopmake perl-GD
600 ipcopmake gnupg
601 ipcopmake hdparm
602 ipcopmake ibod
603 ipcopmake initscripts
604 ipcopmake iptables
605 ipcopmake ipac-ng
606 ipcopmake ipaddr
607 ipcopmake iproute2
608 ipcopmake iptstate
609 ipcopmake iputils
78331e30 610 ipcopmake l7-protocols
df5e82b3
MT
611 ipcopmake isapnptools
612 ipcopmake isdn4k-utils
613 ipcopmake kudzu
614 ipcopmake logrotate
615 ipcopmake logwatch
616 ipcopmake mingetty
617 ipcopmake misc-progs
618 ipcopmake mtools
619 ipcopmake nano
620 ipcopmake nash
621 ipcopmake nasm
622 ipcopmake URI
623 ipcopmake HTML-Tagset
624 ipcopmake HTML-Parser
625 ipcopmake Compress-Zlib
626 ipcopmake Digest
627 ipcopmake Digest-SHA1
628 ipcopmake Digest-HMAC
629 ipcopmake libwww-perl
630 ipcopmake Net-DNS
631 ipcopmake Net-IPv4Addr
632 ipcopmake Net_SSLeay
4f8b6695
MT
633 ipcopmake IO-Stringy
634 ipcopmake Unix-Syslog
635 ipcopmake Mail-Tools
636 ipcopmake MIME-Tools
637 ipcopmake Net-Server
638 ipcopmake Convert-TNEF
639 ipcopmake Convert-UUlib
640 ipcopmake Archive-Tar
641 ipcopmake Archive-Zip
dace10b5 642 ipcopmake GeoIP
df8c7810 643 ipcopmake fwhits
6d4147d2
MT
644 ipcopmake berkeley
645 ipcopmake BerkeleyDB ## The Perl module
df5e82b3
MT
646 ipcopmake noip_updater
647 ipcopmake ntp
648 ipcopmake oinkmaster
649 ipcopmake openssh
650 ipcopmake openswan
651 ipcopmake pptpclient
652 ipcopmake rrdtool
653 ipcopmake setserial
654 ipcopmake setup
655 ipcopmake snort
656 #ipcopmake speedycgi
6d4147d2
MT
657 ipcopmake saslauthd PASS=1
658 ipcopmake openldap
659 ipcopmake saslauthd PASS=2
df5e82b3
MT
660 ipcopmake squid
661 ipcopmake squid-graph
662 ipcopmake tcpdump
663 ipcopmake traceroute
664 ipcopmake vlan
5fcb6d5a 665 #ipcopmake wireless
df5e82b3
MT
666 ipcopmake libsafe
667 ipcopmake 3c5x9setup
b34fd95d
MT
668 echo -ne "`date -u '+%b %e %T'`: Building ### IPFire modules ### \n" | tee -a $LOGFILE
669 ipcopmake pakfire
6ef0bff8 670 ipcopmake startscripts
5e69ef1a 671## Zuerst die Libs und dann die Programme. Ordnung muss sein!
6ef0bff8 672 ipcopmake java
5e69ef1a 673 ipcopmake libtiff
c3defe9b 674 ipcopmake libjpeg
5e69ef1a
MT
675 ipcopmake libxml2
676 ipcopmake spandsp
677 ipcopmake lzo
6ef0bff8 678 ipcopmake openvpn
f8e5510c
MT
679 ipcopmake pkg-config
680 ipcopmake glib
180cd3be 681 ipcopmake xampp
5e69ef1a
MT
682 ipcopmake pam
683 ipcopmake pammysql
a31b2bc4 684 ipcopmake xinetd
316160b0
MT
685 ipcopmake ghostscript
686 ipcopmake cups
b34fd95d 687# ipcopmake lpd ## Im Moment aus, da CUPS vorhanden ist.
98d413ac 688 ipcopmake samba
5e69ef1a
MT
689 ipcopmake sudo
690 ipcopmake mc
691 ipcopmake pwlib
692 ipcopmake openh323
1fe6c87b 693 ipcopmake wget
1fe6c87b 694 ipcopmake bridge-utils
b34fd95d 695 echo -ne "`date -u '+%b %e %T'`: Building ### Mailserver ### \n" | tee -a $LOGFILE
94025eea 696 ipcopmake postfix
93dc5548
MT
697 ipcopmake fetchmail
698 ipcopmake cyrusimap
f9a5a4f0 699 ipcopmake procmail
33a31f1a 700 ipcopmake mailx
f9315063
MT
701 ipcopmake clamav
702 ipcopmake razor
4f8b6695
MT
703 ipcopmake spamassassin
704 ipcopmake amavisd
b34fd95d 705 echo -ne "`date -u '+%b %e %T'`: Building ### VoIP-Server ### \n" | tee -a $LOGFILE
94025eea 706 ipcopmake stund
5e69ef1a 707 ipcopmake asterisk
b34fd95d 708 echo -ne "`date -u '+%b %e %T'`: Building ### MP3-Server ### \n" | tee -a $LOGFILE
316160b0
MT
709 ipcopmake lame
710 ipcopmake gnump3d
6ef0bff8
MT
711 echo -ne "`date -u '+%b %e %T'`: Building ### P2P-Clients ### \n" | tee -a $LOGFILE
712 ipcopmake applejuice
907cd036
MT
713 ipcopmake edonkeyclc
714 ipcopmake sane
d1dd6669 715 ipcopmake rsync
3b9f6349 716 ipcopmake tcpwrapper
769a61c5 717 ipcopmake portmap
6ef0bff8 718 ipcopmake screen
907cd036 719 ipcopmake nmap
a743d285 720 ipcopmake htop
769a61c5 721 ipcopmake nfs
ef05c8bb 722 ipcopmake ncftp
33a31f1a 723 ipcopmake ethereal
052ad1cd 724# wget http://www.guzu.net/linux/hddtemp.db && mv hddtemp.db $BASEDIR/build/etc/hddtemp.db
f8e5510c 725# ipcopmake hddtemp
0eab8e84 726# ipcopmake stunnel # Ausgeschaltet, weil wir es doch nicht nutzen
df5e82b3
MT
727}
728
729buildinstaller() {
730 # Run installer scripts one by one
731 LOGFILE="$BASEDIR/log/_build.installer.log"
732 export LOGFILE
733 echo -ne "`date -u '+%b %e %T'`: Stage4 installer build \n" | tee -a $LOGFILE
734 if [ 'i386' = $MACHINE ]; then
735 ipcopmake syslinux
736 ipcopmake as86
737 ipcopmake mbr
738 ipcopmake uClibc
739 fi
740 installmake busybox
741 installmake sysvinit
742 installmake e2fsprogs
743 installmake misc-progs
744 installmake slang
745 installmake util-linux
746 installmake newt
747 installmake pciutils
748 installmake pcmcia-cs
749 installmake kbd
750 installmake installer
751 installmake scsi.img
752 installmake driver.img
753 installmake initrd
754 installmake boot.img
755}
756
757buildpackages() {
758 LOGFILE="$BASEDIR/log/_build.packages.log"
759 export LOGFILE
760 echo "... see detailed log in _build.*.log files" >> $LOGFILE
761 echo -ne "`date -u '+%b %e %T'`: Stage5 packages build \n" | tee -a $LOGFILE
762 # Strip files
763 echo "`date -u '+%b %e %T'`: Stripping files" | tee -a $LOGFILE
764 find $LFS/lib $LFS/usr/lib $LFS/usr/share/rrdtool-* $LFS/install ! -type l \( -name '*.so' -o -name '*.so[\.0-9]*' \) \
765 ! -name 'libc.so' ! -name 'libpthread.so' ! -name 'libcrypto.so.0.9.7.sha1' \
94025eea 766 -ls -exec $LFS/tools/bin/strip --strip-all {} \; >> $LOGFILE 2>&1
df5e82b3
MT
767 # add -ls before -exec if you want to verify what files are stripped
768
769 find $LFS/{,s}bin $LFS/usr/{,s}bin $LFS/usr/local/{,s}bin ! -type l \
770 -exec file {} \; | grep " ELF " | cut -f1 -d ':' | xargs $LFS/tools/bin/strip --strip-all >> $LOGFILE 2>&1
771 # there add -v to strip to verify
772
773 if [ 'i386' = $MACHINE ]; then
774 # Create fcdsl packages
775 echo "`date -u '+%b %e %T'`: Building fcdsl tgz" | tee -a $LOGFILE
776 cp $LFS/install/images/fcdsl/license.txt $LFS >> $LOGFILE 2>&1
777 touch $LFS/var/run/{need-depmod-$KVER,need-depmod-$KVER-smp}
778 cd $LFS && tar cvfz $LFS/install/images/$SNAME-fcdsl-$VERSION.$MACHINE.tgz \
779 lib/modules/$KVER/misc/fcdsl*.o.gz \
780 lib/modules/$KVER-smp/misc/fcdsl*.o.gz \
781 usr/lib/isdn/{fds?base.bin,fd?ubase.frm} \
782 etc/fcdsl/fcdsl*.conf \
783 etc/drdsl/{drdsl,drdsl.ini} \
784 license.txt \
785 var/run/{need-depmod-$KVER,need-depmod-$KVER-smp} >> $LOGFILE 2>&1
786 rm -f $LFS/license.txt >> $LOGFILE 2>&1
787 cd $BASEDIR
788 fi
df5e82b3
MT
789
790 # Generating list of packages used
791 echo "`date -u '+%b %e %T'`: Generating packages list from logs" | tee -a $LOGFILE
792 rm -f $BASEDIR/doc/packages-list
793 for i in `ls -1tr $BASEDIR/log/[^_]*`; do
794 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
3ea75603 795 echo " * `basename $i`" >>$BASEDIR/doc/packages-list
df5e82b3
MT
796 fi
797 done
3ea75603 798 echo "====== List of softwares used to build $NAME Version: $VERSION ======" > $BASEDIR/doc/packages-list.txt
e67a57fe 799 grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|ipcop$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$' \
df5e82b3
MT
800 $BASEDIR/doc/packages-list | sort >> $BASEDIR/doc/packages-list.txt
801 rm -f $BASEDIR/doc/packages-list
c9673262 802 # packages-list.txt is ready to be displayed for wiki page
df5e82b3
MT
803
804 # Create ISO for CDRom and USB-superfloppy
c3defe9b 805 ipcopmake cdrom
e67a57fe 806 rm -f $LFS/install/images/*usb*
c3defe9b 807 cp $LFS/install/images/{*.iso,*.tgz} $BASEDIR >> $LOGFILE 2>&1
c9673262 808
e67a57fe
MT
809 ipfirepackages
810
811 # Cleanup
812 stdumount
813 rm -rf $BASEDIR/build/tmp/*
814
815 # Generating total list of files
816 echo "`date -u '+%b %e %T'`: Generating files list from logs" | tee -a $LOGFILE
817 rm -f $BASEDIR/log/FILES
818 for i in `ls -1tr $BASEDIR/log/[^_]*`; do
819 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
820 echo "##" >>$BASEDIR/log/FILES
821 echo "## `basename $i`" >>$BASEDIR/log/FILES
822 echo "##" >>$BASEDIR/log/FILES
823 cat $i | sed "s%^\./%#%" | sort >> $BASEDIR/log/FILES
824 fi
825 done
826
827 cd $PWD
828
829}
830
831ipfirepackages() {
78331e30
MT
832 ipfiredist applejuice
833 ipfiredist asterisk
834 ipfiredist cyrusimap
835 ipfiredist fetchmail
836 ipfiredist gnump3d
0d0521b6 837 ipfiredist java
78331e30
MT
838 ipfiredist lame
839 ipfiredist libtiff
840 ipfiredist libxml2
841 ipfiredist mc
842 ipfiredist postfix
843 ipfiredist pwlib
844 ipfiredist sane
845 ipfiredist spandsp
846 ipfiredist sudo
847 ipfiredist xampp
848 ipfiredist xinetd
849 test -d $BASEDIR/packages || mkdir $BASEDIR/packages
850 mv -f $LFS/paks/*.tar.gz $LFS/paks/*.md5 $BASEDIR/packages >> $LOGFILE 2>&1
851 rm -rf $LFS/paks
852 rm -rf $BASEDIR/build/tmp/*
df5e82b3
MT
853}
854
855# See what we're supposed to do
856case "$1" in
857build)
858 BUILDMACHINE=`uname -m`
859 PACKAGE=`ls -v -r $BASEDIR/cache/$SNAME-1.4.*-toolchain-$BUILDMACHINE.tar.gz 2> /dev/null | head -n 1`
860 #only restore on a clean disk
861 if [ ! -f log/perl-*-tools ]; then
862 if [ ! -n "$PACKAGE" ]; then
863 echo "`date -u '+%b %e %T'`: Full toolchain compilation" | tee -a $LOGFILE
864 prepareenv
865 buildtoolchain
866 else
867 PACKAGENAME=${PACKAGE%.tar.gz}
868 echo "`date -u '+%b %e %T'`: Restore from $PACKAGE" | tee -a $LOGFILE
869 if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then
870 tar zxf $PACKAGE
871 prepareenv
872 else
873 exiterror "$PACKAGENAME md5 did not match, check downloaded package"
874 fi
875 fi
876 else
877 echo "`date -u '+%b %e %T'`: Using installed toolchain" | tee -a $LOGFILE
878 prepareenv
879 fi
880 buildbase
881 buildipcop
882 buildinstaller
883 buildpackages
884 ;;
885shell)
886 # enter a shell inside LFS chroot
887 # may be used to changed kernel settings
888 prepareenv
889 entershell
890 ;;
891changelog)
d1dd6669 892 echo -n "Loading new Changelog from SVN: "
f9315063 893 svn log http://svn.ipfire.eu/svn/ipfire > doc/ChangeLog
d1dd6669 894 echo "Finished!"
df5e82b3
MT
895 ;;
896check)
897 echo "Checking sources files availability on the web"
898 if [ ! -d $DIR_CHK ]; then
899 mkdir -p $DIR_CHK
900 fi
901 FINISHED=0
902 cd $BASEDIR/lfs
903 for c in `seq $MAX_RETRIES`; do
904 if (( FINISHED==1 )); then
905 break
906 fi
907 FINISHED=1
908 cd $BASEDIR/lfs
909 for i in *; do
910 if [ -f "$i" -a "$i" != "Config" ]; then
911 make -s -f $i MACHINE=$MACHINE LFS_BASEDIR=$BASEDIR ROOT=$BASEDIR/build \
912 MESSAGE="$i\t ($c/$MAX_RETRIES)" check
913 if [ $? -ne 0 ]; then
914 echo "Check : wget error in lfs/$i"
915 FINISHED=0
916 fi
917 fi
918 done
919 done
920 cd -
921 ;;
922checkclean)
923 echo "Erasing sources files availability tags"
924 rm -rf $DIR_CHK/*
925 ;;
926clean)
927 for i in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do
928 $LOSETUP -d $i 2>/dev/null
929 done
930 for i in `mount | grep $BASEDIR | cut -d " " -f 1`; do
931 umount $i
932 done
933 stdumount
934 for i in `seq 0 7`; do
935 if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
936 umount /dev/loop${i} 2>/dev/null;
937 losetup -d /dev/loop${i} 2>/dev/null;
938 fi;
939 done
940 rm -rf $BASEDIR/build
941 rm -rf $BASEDIR/cdrom
f9315063 942 rm -rf $BASEDIR/packages
df5e82b3 943 rm -rf $BASEDIR/log
df5e82b3
MT
944 if [ -h /tools ]; then
945 rm -f /tools
946 fi
947 ;;
948dist)
4f8b6695 949 echo -ne "Updating & building source package from SVN: "
a414d696
MT
950 svn up > /dev/null
951 svn export http://svn.ipfire.eu/svn/ipfire ipfire-source/ --force > /dev/null
ecc898f7
MT
952 tar cfz ipfire-source-`date +'%Y-%m-%d'`-r`svn info | grep Revision | cut -c 11-`.tar.gz ipfire-source
953 rm ipfire-source/ -r
4f8b6695 954 echo "Finished!"
df5e82b3 955 ;;
f8e5510c 956newpak)
a9b17001
MT
957 # create structure for a new package
958 echo -e "Name of the new package: $2"
959 if [ ! -f "lfs/$2" ]; then
960 echo "`date -u '+%b %e %T'`: Creating directory src/paks/$2"
961 mkdir -p src/paks/$2
962 cd src/paks/$2
f8e5510c 963 echo "`date -u '+%b %e %T'`: Creating files"
a9b17001
MT
964 cp $BASEDIR/lfs/postfix $BASEDIR/lfs/$2
965
f8e5510c
MT
966 touch ROOTFILES
967 touch CONFFILES
968 touch {,un}install.sh
a9b17001 969 ## install.sh
f8e5510c
MT
970 echo '#!/bin/bash' > install.sh
971 echo '#' >> install.sh
972 echo '#################################################################' >> install.sh
973 echo '# #' >> install.sh
974 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> install.sh
975 echo '# #' >> install.sh
976 echo '#################################################################' >> install.sh
977 echo '#' >> install.sh
978 echo '# Extract the files' >> install.sh
979 echo 'tar xfz files.tgz -C /' >> install.sh
a9b17001
MT
980 echo 'cp -f ROOTFILES /opt/pakfire/installed/ROOTFILES.$2' >> install.sh
981 ## uninstall.sh
f8e5510c
MT
982 echo '#!/bin/bash' > uninstall.sh
983 echo '#################################################################' >> uninstall.sh
984 echo '# #' >> uninstall.sh
985 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> uninstall.sh
986 echo '# #' >> uninstall.sh
987 echo '#################################################################' >> uninstall.sh
988 echo '#' >> uninstall.sh
989 echo '# Delete the files' >> uninstall.sh
990 echo '## Befehl fehlt noch' >> uninstall.sh
a9b17001 991 echo 'rm -f /opt/pakfire/installed/ROOTFILES.$2' >> uninstall.sh
f8e5510c 992 echo "`date -u '+%b %e %T'`: Adding files to SVN"
a9b17001
MT
993 cd - && svn add lfs/$2 && svn add src/paks/$2
994
995 echo -n "Do you want to remove the folders? [y/n]"
996 read REM
997 if [ "$REM" == "y" ]; then
998 echo "Removing the folders..."
999 svn del src/paks/$2 --force
1000 else
1001 echo "Folders are kept."
1002 fi
df5e82b3 1003 else
a9b17001 1004 echo "$2 already exists"
df5e82b3 1005 fi
df5e82b3
MT
1006 exit 0
1007 ;;
1008prefetch)
1009 if [ ! -d $BASEDIR/cache ]; then
1010 mkdir $BASEDIR/cache
1011 fi
1012 mkdir -p $BASEDIR/log
1013 echo "`date -u '+%b %e %T'`:Preload all source files" | tee -a $LOGFILE
1014 FINISHED=0
1015 cd $BASEDIR/lfs
1016 for c in `seq $MAX_RETRIES`; do
1017 if (( FINISHED==1 )); then
1018 break
1019 fi
1020 FINISHED=1
1021 cd $BASEDIR/lfs
1022 for i in *; do
1023 if [ -f "$i" -a "$i" != "Config" ]; then
1024 make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t ($c/$MAX_RETRIES)" download >> $LOGFILE 2>&1
1025 if [ $? -ne 0 ]; then
1026 echo "Prefetch : wget error in lfs/$i"
1027 FINISHED=0
1028 else
1029 if [ $c -eq 1 ]; then
1030 echo "Prefetch : lfs/$i files loaded"
1031 fi
1032 fi
1033 fi
1034 done
1035 done
1036 echo "Prefetch : verifying md5sum"
1037 ERROR=0
1038 for i in *; do
1039 if [ -f "$i" -a "$i" != "Config" ]; then
1040 make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t " md5 >> $LOGFILE 2>&1
1041 if [ $? -ne 0 ]; then
1042 echo "md5 difference in lfs/$i"
1043 ERROR=1
1044 fi
1045 fi
1046 done
1047 if [ $ERROR -eq 0 ]; then
1048 echo "Prefetch : all files md5sum match"
1049 fi
1050 cd -
1051 ;;
df5e82b3
MT
1052toolchain)
1053 prepareenv
1054 buildtoolchain
1055 BUILDMACHINE=`uname -m`
1056 echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for $BUILDMACHINE" | tee -a $LOGFILE
1057 cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \
1058 build/{bin,etc,usr/bin,usr/local} \
1059 build/tools/{bin,etc,*-linux-gnu,include,lib,libexec,sbin,share,var} \
1060 log >> $LOGFILE
1061 md5sum cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \
1062 > cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.md5
1063 stdumount
1064 ;;
1065gettoolchain)
1066 BUILDMACHINE=`uname -m`
1067 # arbitrary name to be updated in case of new toolchain package upload
e29556d8
MT
1068 PACKAGE=$SNAME-1.4-toolchain-$BUILDMACHINE
1069 URL_IPFIRE=`grep URL_IPFIRE lfs/Config | awk '{ print $3 }'`
df5e82b3
MT
1070 echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for $BUILDMACHINE" | tee -a $LOGFILE
1071 cd $BASEDIR/cache
54113aa2 1072 wget $URL_IPFIRE/toolchains/$PACKAGE.tar.gz $URL_IPFIRE/toolchains/$PACKAGE.md5
df5e82b3
MT
1073 if [ $? -ne 0 ]; then
1074 echo "`date -u '+%b %e %T'`: error downloading toolchain for $BUILDMACHINE machine" | tee -a $LOGFILE
1075 else
1076 if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then
1077 echo "`date -u '+%b %e %T'`: toolchain md5 ok" | tee -a $LOGFILE
e29556d8 1078 echo "`date -u '+%b %e %T'`: Uncompressing toolchain" | tee -a $LOGFILE
548f60a5 1079 cd $BASEDIR && tar xfz cache/$PACKAGE.tar.gz -C .
6d4147d2 1080 rm -f $BASEDIR/cache/$PACKAGE.{tar.gz,md5}
df5e82b3
MT
1081 else
1082 exiterror "$PACKAGE.md5 did not match, check downloaded package"
1083 fi
1084 fi
1085 ;;
78331e30
MT
1086paks)
1087 prepareenv
1088 buildpackages
e67a57fe 1089 # ipfirepackages
78331e30 1090 ;;
a9b17001
MT
1091update)
1092 echo "Load the latest source-files:"
1093 svn update
1094 ;;
3b9f6349
MT
1095commit)
1096 echo "Upload the changed files:"
3b9f6349 1097 svn commit
ff7df9d4 1098 ./make.sh sync
e67a57fe 1099 svn up > /dev/null
3b9f6349 1100 ;;
f9315063
MT
1101make)
1102 echo "Do a complete compile:"
78331e30 1103 ./make.sh prefetch && ./make.sh gettoolchain && ./make.sh build
4f8b6695
MT
1104 ;;
1105diff)
1106 echo -ne "Make a local diff to last SVN revision: "
1107 svn diff > ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff
1108 echo "Finished!"
1109 echo "Diff was successfully saved to ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff"
f9315063 1110 ;;
0eab8e84
MT
1111sync)
1112 echo -e "Syncing Cache to FTP:"
1113 echo -ne "Password for mirror.ipfire.org: "; read PASS
ef05c8bb 1114 rm -f doc/packages-to-remove-from-ftp
0eab8e84
MT
1115 ncftpls -u web3 -p $PASS ftp://mirror.ipfire.org/html/source-packages/source/ > ftplist
1116 for i in `ls -w1 cache/`; do
1117 grep $i ftplist
1118 if [ "$?" -ne "0" ]; then
1119 ncftpput -u web3 -p $PASS mirror.ipfire.org /html/source-packages/source cache/$i
1120 if [ "$?" -eq "0" ]; then
1121 echo -e "$i was successfully uploaded to the ftp server."
1122 else
1123 echo -e "There was an error while uploading $i to the ftp server."
1124 fi
1125 fi
1126 done
ef05c8bb
MT
1127 for i in `cat ftplist`; do
1128 ls -w1 cache/ | grep $i
1129 if [ "$?" -eq "1" ]; then
1130 echo $i | grep -v toolchain >> doc/packages-to-remove-from-ftp
1131 fi
1132 done
0eab8e84
MT
1133 rm -f ftplist
1134 ;;
0d0521b6 1135pub-iso)
e67a57fe
MT
1136 echo -e "Upload the ISO to the beta-mirror!"
1137 echo -ne "Password for mirror.ipfire.org: "; read PASS
e67a57fe
MT
1138 ncftpls -u web3 -p $PASS ftp://mirror.ipfire.org/html/source-packages/beta/ | grep `svn info | grep Revision | cut -c 11-`
1139 if [ "$?" -eq "1" ]; then
1140 cp $BASEDIR/ipfire-install-1.4.i386.iso $BASEDIR/ipfire-install-1.4.i386-r`svn info | grep Revision | cut -c 11-`.iso
1141 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
1142 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
1143 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
1144 if [ "$?" -eq "0" ]; then
1145 echo -e "The ISO of Revision `svn info | grep Revision | cut -c 11-` was successfully uploaded to the ftp server."
1146 else
1147 echo -e "There was an error while uploading the ISO to the ftp server."
1148 fi
1149 else
1150 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!"
1151 fi
1152 rm -f ipfire-install-1.4.i386-r`svn info | grep Revision | cut -c 11-`.iso{,.md5}
1153 ;;
0d0521b6
MT
1154pub-paks)
1155 echo -e "Upload the packages to the beta-mirror!"
1156 echo -ne "Password for mirror.ipfire.org: "; read PASS
1157 ncftpput -z -u web3 -p $PASS mirror.ipfire.org /html/source-packages/packages/ packages/*
1158 if [ "$?" -eq "0" ]; then
1159 echo -e "The packages were successfully uploaded to the ftp server."
1160 else
1161 echo -e "There was an error while uploading the packages to the ftp server."
1162 fi
1163 ;;
df5e82b3 1164*)
0d0521b6 1165 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
1166 cat doc/make.sh-usage
1167 exit 1
1168 ;;
3ea75603 1169esac