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 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
a68fedca 338# if [ ! `ls -w1 $BASEDIR/packages/*.tar.gz | grep $1` ]; then
e7164bb4 339 echo "`date -u '+%b %e %T'`: Packaging $1" | tee -a $LOGFILE
e7164bb4
MT
340 chroot $LFS /tools/bin/env -i HOME=/root \
341 TERM=$TERM PS1='\u:\w\$ ' \
342 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \
343 VERSION=$VERSION \
344 CONFIG_ROOT=$CONFIG_ROOT \
345 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
346 CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" \
347 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
348 KVER=$KVER \
349 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
350 /bin/bash -x -c "cd /usr/src/lfs && \
351 make -f $1 LFS_BASEDIR=/usr/src dist" >>$LOGFILE 2>&1
352 if [ $? -ne 0 ]; then
353 exiterror "Packaging $1"
354 fi
a68fedca
MT
355# else
356# echo "`date -u '+%b %e %T'`: Packaging: The package $1 already exists"
357# fi
e7164bb4
MT
358 else
359 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
360 fi
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() {
907cd036
MT
508 # Run IPFire make scripts one by one
509 LOGFILE="$BASEDIR/log/_build.ipfire.log"
df5e82b3
MT
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.....
3e45cc09
MT
528 ipcopmake linux LFS_PASS=ipfire SMP=installer
529 ipcopmake linux LFS_PASS=ipfire SMP=1
df5e82b3
MT
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
6ca65b88 543 ipcopmake fcpci SMP=1
ff7df9d4 544 ipcopmake fcclassic SMP=1
df5e82b3
MT
545 ipcopmake pulsar SMP=1
546 ipcopmake unicorn SMP=1
547 fi
548
3e45cc09 549 ipcopmake linux LFS_PASS=ipfire
df5e82b3
MT
550 ipcopmake 3cp4218
551 ipcopmake amedyn
552 ipcopmake cxacru
553 ipcopmake eciadsl
554 ipcopmake eagle
555 ipcopmake speedtouch
556 if [ 'i386' = $MACHINE ]; then
557 # These are here because they have i386 only binary libraries
558 # included in the package.
559 ipcopmake cnx_pci
560 ipcopmake fcdsl
561 ipcopmake fcdsl2
562 ipcopmake fcdslsl
563 ipcopmake fcdslusb
6ca65b88 564 ipcopmake fcdslslusb
ff7df9d4
MT
565 ipcopmake fcpci
566 ipcopmake fcclassic
df5e82b3
MT
567 ipcopmake pulsar
568 ipcopmake unicorn
569 fi
570
571 ipcopmake pcmcia-cs
572 ipcopmake expat
573 ipcopmake gdbm
574 ipcopmake gmp
575 ipcopmake openssl
576 ipcopmake python
577 ipcopmake libnet
578 ipcopmake libpng
579 ipcopmake gd
580 ipcopmake popt
581 ipcopmake slang
582 ipcopmake newt
583 ipcopmake libcap
584 ipcopmake pciutils
585 ipcopmake pcre
586 ipcopmake apache
587 ipcopmake arping
588 ipcopmake beep
589 ipcopmake bind
590 ipcopmake capi4k-utils
591 ipcopmake cdrtools
592 ipcopmake dnsmasq
593 ipcopmake dosfstools
594 ipcopmake ethtool
595 ipcopmake ez-ipupdate
596 ipcopmake fcron
597 ipcopmake perl-GD
598 ipcopmake gnupg
599 ipcopmake hdparm
600 ipcopmake ibod
601 ipcopmake initscripts
602 ipcopmake iptables
603 ipcopmake ipac-ng
604 ipcopmake ipaddr
605 ipcopmake iproute2
606 ipcopmake iptstate
607 ipcopmake iputils
78331e30 608 ipcopmake l7-protocols
df5e82b3
MT
609 ipcopmake isapnptools
610 ipcopmake isdn4k-utils
611 ipcopmake kudzu
612 ipcopmake logrotate
613 ipcopmake logwatch
614 ipcopmake mingetty
615 ipcopmake misc-progs
616 ipcopmake mtools
617 ipcopmake nano
618 ipcopmake nash
619 ipcopmake nasm
620 ipcopmake URI
621 ipcopmake HTML-Tagset
622 ipcopmake HTML-Parser
623 ipcopmake Compress-Zlib
624 ipcopmake Digest
625 ipcopmake Digest-SHA1
626 ipcopmake Digest-HMAC
627 ipcopmake libwww-perl
628 ipcopmake Net-DNS
629 ipcopmake Net-IPv4Addr
630 ipcopmake Net_SSLeay
4f8b6695
MT
631 ipcopmake IO-Stringy
632 ipcopmake Unix-Syslog
633 ipcopmake Mail-Tools
634 ipcopmake MIME-Tools
635 ipcopmake Net-Server
636 ipcopmake Convert-TNEF
637 ipcopmake Convert-UUlib
638 ipcopmake Archive-Tar
639 ipcopmake Archive-Zip
90350ff3 640 ipcopmake Locale-Country
dace10b5 641 ipcopmake GeoIP
df8c7810 642 ipcopmake fwhits
6d4147d2
MT
643 ipcopmake berkeley
644 ipcopmake BerkeleyDB ## The Perl module
df5e82b3
MT
645 ipcopmake noip_updater
646 ipcopmake ntp
647 ipcopmake oinkmaster
648 ipcopmake openssh
649 ipcopmake openswan
650 ipcopmake pptpclient
651 ipcopmake rrdtool
652 ipcopmake setserial
653 ipcopmake setup
654 ipcopmake snort
655 #ipcopmake speedycgi
6d4147d2
MT
656 ipcopmake saslauthd PASS=1
657 ipcopmake openldap
df5e82b3
MT
658 ipcopmake squid
659 ipcopmake squid-graph
60cbd6e7 660 ipcopmake squidguard
df5e82b3
MT
661 ipcopmake tcpdump
662 ipcopmake traceroute
663 ipcopmake vlan
5fcb6d5a 664 #ipcopmake wireless
df5e82b3
MT
665 ipcopmake libsafe
666 ipcopmake 3c5x9setup
894c6feb 667# echo -ne "`date -u '+%b %e %T'`: Building ### IPFire modules ### \n" | tee -a $LOGFILE
b34fd95d 668 ipcopmake pakfire
6ef0bff8 669 ipcopmake startscripts
5e69ef1a 670## Zuerst die Libs und dann die Programme. Ordnung muss sein!
6ef0bff8 671 ipcopmake java
5e69ef1a 672 ipcopmake libtiff
c3defe9b 673 ipcopmake libjpeg
5e69ef1a
MT
674 ipcopmake libxml2
675 ipcopmake spandsp
676 ipcopmake lzo
6ef0bff8 677 ipcopmake openvpn
f8e5510c
MT
678 ipcopmake pkg-config
679 ipcopmake glib
180cd3be 680 ipcopmake xampp
5e69ef1a
MT
681 ipcopmake pam
682 ipcopmake pammysql
371d9df0 683 ipcopmake saslauthd PASS=2
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
60cbd6e7 694 ipcopmake wput
1fe6c87b 695 ipcopmake bridge-utils
3e45cc09
MT
696 ipcopmake screen
697 ipcopmake hddtemp
698 ipcopmake htop
699 ipcopmake lynx
b34fd95d 700 echo -ne "`date -u '+%b %e %T'`: Building ### Mailserver ### \n" | tee -a $LOGFILE
94025eea 701 ipcopmake postfix
6c666a3b 702 ipcopmake procmail
93dc5548
MT
703 ipcopmake fetchmail
704 ipcopmake cyrusimap
33a31f1a 705 ipcopmake mailx
f9315063
MT
706 ipcopmake clamav
707 ipcopmake razor
4f8b6695
MT
708 ipcopmake spamassassin
709 ipcopmake amavisd
b34fd95d 710 echo -ne "`date -u '+%b %e %T'`: Building ### VoIP-Server ### \n" | tee -a $LOGFILE
94025eea 711 ipcopmake stund
5e69ef1a 712 ipcopmake asterisk
894c6feb 713 ipcopmake mpg123
b34fd95d 714 echo -ne "`date -u '+%b %e %T'`: Building ### MP3-Server ### \n" | tee -a $LOGFILE
316160b0
MT
715 ipcopmake lame
716 ipcopmake gnump3d
6ef0bff8
MT
717 echo -ne "`date -u '+%b %e %T'`: Building ### P2P-Clients ### \n" | tee -a $LOGFILE
718 ipcopmake applejuice
907cd036 719 ipcopmake edonkeyclc
894c6feb 720# ipcopmake sane
3e45cc09
MT
721 echo -ne "`date -u '+%b %e %T'`: Building ### Net-Tools ### \n" | tee -a $LOGFILE
722 ipcopmake ntop
894c6feb 723# ipcopmake rsync
3b9f6349 724 ipcopmake tcpwrapper
769a61c5 725 ipcopmake portmap
894c6feb 726 ipcopmake nfs
907cd036 727 ipcopmake nmap
3e45cc09 728 ipcopmake iftop
ef05c8bb 729 ipcopmake ncftp
ca35618d 730 ipcopmake cftp
60cbd6e7 731 ipcopmake etherwake
33a31f1a 732 ipcopmake ethereal
0eab8e84 733# ipcopmake stunnel # Ausgeschaltet, weil wir es doch nicht nutzen
df5e82b3
MT
734}
735
736buildinstaller() {
737 # Run installer scripts one by one
738 LOGFILE="$BASEDIR/log/_build.installer.log"
739 export LOGFILE
740 echo -ne "`date -u '+%b %e %T'`: Stage4 installer build \n" | tee -a $LOGFILE
741 if [ 'i386' = $MACHINE ]; then
742 ipcopmake syslinux
743 ipcopmake as86
744 ipcopmake mbr
745 ipcopmake uClibc
746 fi
747 installmake busybox
748 installmake sysvinit
749 installmake e2fsprogs
750 installmake misc-progs
751 installmake slang
752 installmake util-linux
753 installmake newt
754 installmake pciutils
755 installmake pcmcia-cs
756 installmake kbd
757 installmake installer
758 installmake scsi.img
759 installmake driver.img
760 installmake initrd
761 installmake boot.img
762}
763
764buildpackages() {
765 LOGFILE="$BASEDIR/log/_build.packages.log"
766 export LOGFILE
767 echo "... see detailed log in _build.*.log files" >> $LOGFILE
768 echo -ne "`date -u '+%b %e %T'`: Stage5 packages build \n" | tee -a $LOGFILE
769 # Strip files
770 echo "`date -u '+%b %e %T'`: Stripping files" | tee -a $LOGFILE
771 find $LFS/lib $LFS/usr/lib $LFS/usr/share/rrdtool-* $LFS/install ! -type l \( -name '*.so' -o -name '*.so[\.0-9]*' \) \
772 ! -name 'libc.so' ! -name 'libpthread.so' ! -name 'libcrypto.so.0.9.7.sha1' \
90350ff3 773 -exec $LFS/tools/bin/strip --strip-all {} \; >> $LOGFILE 2>&1
df5e82b3
MT
774 # add -ls before -exec if you want to verify what files are stripped
775
776 find $LFS/{,s}bin $LFS/usr/{,s}bin $LFS/usr/local/{,s}bin ! -type l \
777 -exec file {} \; | grep " ELF " | cut -f1 -d ':' | xargs $LFS/tools/bin/strip --strip-all >> $LOGFILE 2>&1
778 # there add -v to strip to verify
779
780 if [ 'i386' = $MACHINE ]; then
781 # Create fcdsl packages
782 echo "`date -u '+%b %e %T'`: Building fcdsl tgz" | tee -a $LOGFILE
783 cp $LFS/install/images/fcdsl/license.txt $LFS >> $LOGFILE 2>&1
784 touch $LFS/var/run/{need-depmod-$KVER,need-depmod-$KVER-smp}
785 cd $LFS && tar cvfz $LFS/install/images/$SNAME-fcdsl-$VERSION.$MACHINE.tgz \
786 lib/modules/$KVER/misc/fcdsl*.o.gz \
787 lib/modules/$KVER-smp/misc/fcdsl*.o.gz \
788 usr/lib/isdn/{fds?base.bin,fd?ubase.frm} \
789 etc/fcdsl/fcdsl*.conf \
790 etc/drdsl/{drdsl,drdsl.ini} \
791 license.txt \
792 var/run/{need-depmod-$KVER,need-depmod-$KVER-smp} >> $LOGFILE 2>&1
793 rm -f $LFS/license.txt >> $LOGFILE 2>&1
794 cd $BASEDIR
795 fi
df5e82b3
MT
796
797 # Generating list of packages used
798 echo "`date -u '+%b %e %T'`: Generating packages list from logs" | tee -a $LOGFILE
799 rm -f $BASEDIR/doc/packages-list
800 for i in `ls -1tr $BASEDIR/log/[^_]*`; do
801 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
3ea75603 802 echo " * `basename $i`" >>$BASEDIR/doc/packages-list
df5e82b3
MT
803 fi
804 done
3ea75603 805 echo "====== List of softwares used to build $NAME Version: $VERSION ======" > $BASEDIR/doc/packages-list.txt
e67a57fe 806 grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|ipcop$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$' \
df5e82b3
MT
807 $BASEDIR/doc/packages-list | sort >> $BASEDIR/doc/packages-list.txt
808 rm -f $BASEDIR/doc/packages-list
c9673262 809 # packages-list.txt is ready to be displayed for wiki page
df5e82b3
MT
810
811 # Create ISO for CDRom and USB-superfloppy
c3defe9b 812 ipcopmake cdrom
e67a57fe 813 rm -f $LFS/install/images/*usb*
c3defe9b 814 cp $LFS/install/images/{*.iso,*.tgz} $BASEDIR >> $LOGFILE 2>&1
c9673262 815
e67a57fe
MT
816 ipfirepackages
817
818 # Cleanup
819 stdumount
820 rm -rf $BASEDIR/build/tmp/*
821
822 # Generating total list of files
823 echo "`date -u '+%b %e %T'`: Generating files list from logs" | tee -a $LOGFILE
824 rm -f $BASEDIR/log/FILES
825 for i in `ls -1tr $BASEDIR/log/[^_]*`; do
826 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
827 echo "##" >>$BASEDIR/log/FILES
828 echo "## `basename $i`" >>$BASEDIR/log/FILES
829 echo "##" >>$BASEDIR/log/FILES
830 cat $i | sed "s%^\./%#%" | sort >> $BASEDIR/log/FILES
831 fi
832 done
833
834 cd $PWD
835
836}
837
838ipfirepackages() {
483f59cd
MT
839 for i in `ls $BASEDIR/packages`; do
840 touch $BASEDIR/build/install/packages/$i.empty
841 done
f0ca8c34 842 ipfiredist amavisd
78331e30
MT
843 ipfiredist applejuice
844 ipfiredist asterisk
c7acba4a 845 ipfiredist clamav
483f59cd 846 ipfiredist cups
78331e30
MT
847 ipfiredist cyrusimap
848 ipfiredist fetchmail
849 ipfiredist gnump3d
0d0521b6 850 ipfiredist java
78331e30
MT
851 ipfiredist lame
852 ipfiredist libtiff
853 ipfiredist libxml2
f0ca8c34
MT
854 ipfiredist mailx
855 ipfiredist nfs
856 ipfiredist nmap
3e45cc09 857 ipfiredist ntop
78331e30 858 ipfiredist postfix
371d9df0 859 ipfiredist procmail
90350ff3 860 ipfiredist samba
f0ca8c34 861 ipfiredist spamassassin
483f59cd 862 ipfiredist xampp
78331e30
MT
863 ipfiredist xinetd
864 test -d $BASEDIR/packages || mkdir $BASEDIR/packages
a8b159e7 865 mv -f $LFS/install/packages/*.{tar.gz,md5} $BASEDIR/packages >> $LOGFILE 2>&1
483f59cd 866 rm -rf $BASEDIR/build/install/packages/*
df5e82b3
MT
867}
868
869# See what we're supposed to do
870case "$1" in
871build)
872 BUILDMACHINE=`uname -m`
21757737 873 PACKAGE=`ls -v -r $BASEDIR/cache/$SNAME-1.4-toolchain-$BUILDMACHINE.tar.gz 2> /dev/null | head -n 1`
df5e82b3
MT
874 #only restore on a clean disk
875 if [ ! -f log/perl-*-tools ]; then
876 if [ ! -n "$PACKAGE" ]; then
877 echo "`date -u '+%b %e %T'`: Full toolchain compilation" | tee -a $LOGFILE
878 prepareenv
879 buildtoolchain
880 else
881 PACKAGENAME=${PACKAGE%.tar.gz}
882 echo "`date -u '+%b %e %T'`: Restore from $PACKAGE" | tee -a $LOGFILE
883 if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then
884 tar zxf $PACKAGE
885 prepareenv
886 else
887 exiterror "$PACKAGENAME md5 did not match, check downloaded package"
888 fi
889 fi
890 else
891 echo "`date -u '+%b %e %T'`: Using installed toolchain" | tee -a $LOGFILE
892 prepareenv
893 fi
894 buildbase
895 buildipcop
896 buildinstaller
897 buildpackages
898 ;;
899shell)
900 # enter a shell inside LFS chroot
901 # may be used to changed kernel settings
902 prepareenv
903 entershell
904 ;;
905changelog)
d1dd6669 906 echo -n "Loading new Changelog from SVN: "
f9315063 907 svn log http://svn.ipfire.eu/svn/ipfire > doc/ChangeLog
d1dd6669 908 echo "Finished!"
df5e82b3
MT
909 ;;
910check)
911 echo "Checking sources files availability on the web"
912 if [ ! -d $DIR_CHK ]; then
913 mkdir -p $DIR_CHK
914 fi
915 FINISHED=0
916 cd $BASEDIR/lfs
917 for c in `seq $MAX_RETRIES`; do
918 if (( FINISHED==1 )); then
919 break
920 fi
921 FINISHED=1
922 cd $BASEDIR/lfs
923 for i in *; do
924 if [ -f "$i" -a "$i" != "Config" ]; then
925 make -s -f $i MACHINE=$MACHINE LFS_BASEDIR=$BASEDIR ROOT=$BASEDIR/build \
926 MESSAGE="$i\t ($c/$MAX_RETRIES)" check
927 if [ $? -ne 0 ]; then
928 echo "Check : wget error in lfs/$i"
929 FINISHED=0
930 fi
931 fi
932 done
933 done
934 cd -
935 ;;
936checkclean)
937 echo "Erasing sources files availability tags"
938 rm -rf $DIR_CHK/*
939 ;;
940clean)
941 for i in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do
942 $LOSETUP -d $i 2>/dev/null
943 done
944 for i in `mount | grep $BASEDIR | cut -d " " -f 1`; do
945 umount $i
946 done
947 stdumount
948 for i in `seq 0 7`; do
949 if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
950 umount /dev/loop${i} 2>/dev/null;
951 losetup -d /dev/loop${i} 2>/dev/null;
952 fi;
953 done
954 rm -rf $BASEDIR/build
955 rm -rf $BASEDIR/cdrom
f9315063 956 rm -rf $BASEDIR/packages
df5e82b3 957 rm -rf $BASEDIR/log
df5e82b3
MT
958 if [ -h /tools ]; then
959 rm -f /tools
960 fi
961 ;;
962dist)
4f8b6695 963 echo -ne "Updating & building source package from SVN: "
a414d696
MT
964 svn up > /dev/null
965 svn export http://svn.ipfire.eu/svn/ipfire ipfire-source/ --force > /dev/null
ecc898f7
MT
966 tar cfz ipfire-source-`date +'%Y-%m-%d'`-r`svn info | grep Revision | cut -c 11-`.tar.gz ipfire-source
967 rm ipfire-source/ -r
4f8b6695 968 echo "Finished!"
df5e82b3 969 ;;
f8e5510c 970newpak)
a9b17001
MT
971 # create structure for a new package
972 echo -e "Name of the new package: $2"
973 if [ ! -f "lfs/$2" ]; then
974 echo "`date -u '+%b %e %T'`: Creating directory src/paks/$2"
975 mkdir -p src/paks/$2
976 cd src/paks/$2
f8e5510c 977 echo "`date -u '+%b %e %T'`: Creating files"
a9b17001
MT
978 cp $BASEDIR/lfs/postfix $BASEDIR/lfs/$2
979
f8e5510c
MT
980 touch ROOTFILES
981 touch CONFFILES
982 touch {,un}install.sh
a9b17001 983 ## install.sh
f8e5510c
MT
984 echo '#!/bin/bash' > install.sh
985 echo '#' >> install.sh
986 echo '#################################################################' >> install.sh
987 echo '# #' >> install.sh
988 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> install.sh
989 echo '# #' >> install.sh
990 echo '#################################################################' >> install.sh
991 echo '#' >> install.sh
992 echo '# Extract the files' >> install.sh
993 echo 'tar xfz files.tgz -C /' >> install.sh
a9b17001
MT
994 echo 'cp -f ROOTFILES /opt/pakfire/installed/ROOTFILES.$2' >> install.sh
995 ## uninstall.sh
f8e5510c
MT
996 echo '#!/bin/bash' > uninstall.sh
997 echo '#################################################################' >> uninstall.sh
998 echo '# #' >> uninstall.sh
999 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> uninstall.sh
1000 echo '# #' >> uninstall.sh
1001 echo '#################################################################' >> uninstall.sh
1002 echo '#' >> uninstall.sh
1003 echo '# Delete the files' >> uninstall.sh
1004 echo '## Befehl fehlt noch' >> uninstall.sh
a9b17001 1005 echo 'rm -f /opt/pakfire/installed/ROOTFILES.$2' >> uninstall.sh
f8e5510c 1006 echo "`date -u '+%b %e %T'`: Adding files to SVN"
a9b17001
MT
1007 cd - && svn add lfs/$2 && svn add src/paks/$2
1008
1009 echo -n "Do you want to remove the folders? [y/n]"
1010 read REM
1011 if [ "$REM" == "y" ]; then
1012 echo "Removing the folders..."
1013 svn del src/paks/$2 --force
1014 else
1015 echo "Folders are kept."
1016 fi
df5e82b3 1017 else
a9b17001 1018 echo "$2 already exists"
df5e82b3 1019 fi
df5e82b3
MT
1020 exit 0
1021 ;;
1022prefetch)
1023 if [ ! -d $BASEDIR/cache ]; then
1024 mkdir $BASEDIR/cache
1025 fi
1026 mkdir -p $BASEDIR/log
1027 echo "`date -u '+%b %e %T'`:Preload all source files" | tee -a $LOGFILE
1028 FINISHED=0
1029 cd $BASEDIR/lfs
1030 for c in `seq $MAX_RETRIES`; do
1031 if (( FINISHED==1 )); then
1032 break
1033 fi
1034 FINISHED=1
1035 cd $BASEDIR/lfs
1036 for i in *; do
1037 if [ -f "$i" -a "$i" != "Config" ]; then
1038 make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t ($c/$MAX_RETRIES)" download >> $LOGFILE 2>&1
1039 if [ $? -ne 0 ]; then
1040 echo "Prefetch : wget error in lfs/$i"
1041 FINISHED=0
1042 else
1043 if [ $c -eq 1 ]; then
1044 echo "Prefetch : lfs/$i files loaded"
1045 fi
1046 fi
1047 fi
1048 done
1049 done
1050 echo "Prefetch : verifying md5sum"
1051 ERROR=0
1052 for i in *; do
1053 if [ -f "$i" -a "$i" != "Config" ]; then
1054 make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t " md5 >> $LOGFILE 2>&1
1055 if [ $? -ne 0 ]; then
1056 echo "md5 difference in lfs/$i"
1057 ERROR=1
1058 fi
1059 fi
1060 done
1061 if [ $ERROR -eq 0 ]; then
1062 echo "Prefetch : all files md5sum match"
1063 fi
1064 cd -
1065 ;;
df5e82b3
MT
1066toolchain)
1067 prepareenv
1068 buildtoolchain
1069 BUILDMACHINE=`uname -m`
1070 echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for $BUILDMACHINE" | tee -a $LOGFILE
1071 cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \
1072 build/{bin,etc,usr/bin,usr/local} \
1073 build/tools/{bin,etc,*-linux-gnu,include,lib,libexec,sbin,share,var} \
1074 log >> $LOGFILE
1075 md5sum cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \
1076 > cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.md5
1077 stdumount
1078 ;;
1079gettoolchain)
1080 BUILDMACHINE=`uname -m`
1081 # arbitrary name to be updated in case of new toolchain package upload
e29556d8
MT
1082 PACKAGE=$SNAME-1.4-toolchain-$BUILDMACHINE
1083 URL_IPFIRE=`grep URL_IPFIRE lfs/Config | awk '{ print $3 }'`
df5e82b3
MT
1084 echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for $BUILDMACHINE" | tee -a $LOGFILE
1085 cd $BASEDIR/cache
21757737 1086 wget $URL_IPFIRE/toolchains/$PACKAGE.tar.gz $URL_IPFIRE/toolchains/$PACKAGE.md5 >& /dev/null
df5e82b3
MT
1087 if [ $? -ne 0 ]; then
1088 echo "`date -u '+%b %e %T'`: error downloading toolchain for $BUILDMACHINE machine" | tee -a $LOGFILE
21757737
MT
1089# else
1090# if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then
1091# echo "`date -u '+%b %e %T'`: toolchain md5 ok" | tee -a $LOGFILE
1092# echo "`date -u '+%b %e %T'`: Uncompressing toolchain" | tee -a $LOGFILE
1093# cd $BASEDIR && tar xfz cache/$PACKAGE.tar.gz -C .
1094# rm -f $BASEDIR/cache/$PACKAGE.{tar.gz,md5}
1095# else
1096# exiterror "$PACKAGE.md5 did not match, check downloaded package"
1097# fi
df5e82b3
MT
1098 fi
1099 ;;
78331e30
MT
1100paks)
1101 prepareenv
c7acba4a
MT
1102 # buildpackages
1103 ipfirepackages
78331e30 1104 ;;
a9b17001
MT
1105update)
1106 echo "Load the latest source-files:"
1107 svn update
1108 ;;
3b9f6349
MT
1109commit)
1110 echo "Upload the changed files:"
3b9f6349 1111 svn commit
ff7df9d4 1112 ./make.sh sync
e67a57fe 1113 svn up > /dev/null
3b9f6349 1114 ;;
f9315063
MT
1115make)
1116 echo "Do a complete compile:"
78331e30 1117 ./make.sh prefetch && ./make.sh gettoolchain && ./make.sh build
4f8b6695
MT
1118 ;;
1119diff)
1120 echo -ne "Make a local diff to last SVN revision: "
1121 svn diff > ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff
1122 echo "Finished!"
1123 echo "Diff was successfully saved to ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff"
f9315063 1124 ;;
0eab8e84
MT
1125sync)
1126 echo -e "Syncing Cache to FTP:"
a68fedca
MT
1127 if [ -f .pass ]; then
1128 PASS="`cat .pass`"
1129 else
1130 echo -ne "Password for mirror.ipfire.org: "; read PASS
1131 fi
ef05c8bb 1132 rm -f doc/packages-to-remove-from-ftp
0eab8e84
MT
1133 ncftpls -u web3 -p $PASS ftp://mirror.ipfire.org/html/source-packages/source/ > ftplist
1134 for i in `ls -w1 cache/`; do
1135 grep $i ftplist
1136 if [ "$?" -ne "0" ]; then
1137 ncftpput -u web3 -p $PASS mirror.ipfire.org /html/source-packages/source cache/$i
1138 if [ "$?" -eq "0" ]; then
1139 echo -e "$i was successfully uploaded to the ftp server."
1140 else
1141 echo -e "There was an error while uploading $i to the ftp server."
1142 fi
1143 fi
1144 done
ef05c8bb
MT
1145 for i in `cat ftplist`; do
1146 ls -w1 cache/ | grep $i
1147 if [ "$?" -eq "1" ]; then
1148 echo $i | grep -v toolchain >> doc/packages-to-remove-from-ftp
1149 fi
1150 done
0eab8e84
MT
1151 rm -f ftplist
1152 ;;
0d0521b6 1153pub-iso)
e67a57fe 1154 echo -e "Upload the ISO to the beta-mirror!"
a68fedca
MT
1155 if [ -f .pass ]; then
1156 PASS="`cat .pass`"
1157 else
1158 echo -ne "Password for mirror.ipfire.org: "; read PASS
1159 fi
e67a57fe
MT
1160 ncftpls -u web3 -p $PASS ftp://mirror.ipfire.org/html/source-packages/beta/ | grep `svn info | grep Revision | cut -c 11-`
1161 if [ "$?" -eq "1" ]; then
1162 cp $BASEDIR/ipfire-install-1.4.i386.iso $BASEDIR/ipfire-install-1.4.i386-r`svn info | grep Revision | cut -c 11-`.iso
1163 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
1164 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
1165 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
1166 if [ "$?" -eq "0" ]; then
1167 echo -e "The ISO of Revision `svn info | grep Revision | cut -c 11-` was successfully uploaded to the ftp server."
1168 else
1169 echo -e "There was an error while uploading the ISO to the ftp server."
1170 fi
1171 else
1172 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!"
1173 fi
1174 rm -f ipfire-install-1.4.i386-r`svn info | grep Revision | cut -c 11-`.iso{,.md5}
1175 ;;
0d0521b6
MT
1176pub-paks)
1177 echo -e "Upload the packages to the beta-mirror!"
a68fedca
MT
1178 if [ -f .pass ]; then
1179 PASS="`cat .pass`"
1180 else
1181 echo -ne "Password for mirror.ipfire.org: "; read PASS
1182 fi
0d0521b6
MT
1183 ncftpput -z -u web3 -p $PASS mirror.ipfire.org /html/source-packages/packages/ packages/*
1184 if [ "$?" -eq "0" ]; then
1185 echo -e "The packages were successfully uploaded to the ftp server."
1186 else
1187 echo -e "There was an error while uploading the packages to the ftp server."
1188 fi
1189 ;;
df5e82b3 1190*)
0d0521b6 1191 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
1192 cat doc/make.sh-usage
1193 exit 1
1194 ;;
3ea75603 1195esac