GeƤndert:
[people/pmueller/ipfire-2.x.git] / make.sh
1 #!/bin/bash
2 #
3 ############################################################################
4 # #
5 # This file is part of the IPFire Firewall. #
6 # #
7 # IPFire is free software; you can redistribute it and/or modify #
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 # #
12 # IPFire is distributed in the hope that it will be useful, #
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 #
18 # along with IPFire; if not, write to the Free Software #
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
20 # #
21 # Copyright (C) 2006 IPFire-Team <entwickler@ipfire.org>. #
22 # #
23 ############################################################################
24 #
25
26 NAME="IPFire" # Software name
27 SNAME="ipfire" # Short name
28 VERSION="1.4" # Version number
29 SLOGAN="We secure your network" # Software slogan
30 CONFIG_ROOT=/var/ipfire # Configuration rootdir
31 NICE=10
32 MAX_RETRIES=3 # prefetch/check loop
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
74 stdumount() {
75 umount $BASEDIR/build/dev/pts 2>/dev/null;
76 umount $BASEDIR/build/proc 2>/dev/null;
77 umount $BASEDIR/build/install/mnt 2>/dev/null;
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;
81 umount $BASEDIR/build/usr/src/doc 2>/dev/null;
82 umount $BASEDIR/build/usr/src/html 2>/dev/null;
83 umount $BASEDIR/build/usr/src/langs 2>/dev/null;
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;
87 }
88
89 exiterror() {
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
101 entershell() {
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
124 prepareenv() {
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 ############################################################################
246 lfsmake1() {
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
272 lfsmake2() {
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
304 ipcopmake() {
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
336 ipfiredist() {
337 if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then
338 # if [ ! `ls -w1 $BASEDIR/packages/*.tar.gz | grep $1` ]; then
339 echo "`date -u '+%b %e %T'`: Packaging $1" | tee -a $LOGFILE
340 cp -f $BASEDIR/src/scripts/make-packages.sh $BASEDIR/build/usr/local/bin
341 chroot $LFS /tools/bin/env -i HOME=/root \
342 TERM=$TERM PS1='\u:\w\$ ' \
343 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \
344 VERSION=$VERSION \
345 CONFIG_ROOT=$CONFIG_ROOT \
346 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
347 CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" \
348 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
349 KVER=$KVER \
350 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
351 /bin/bash -x -c "cd /usr/src/lfs && \
352 make -f $1 LFS_BASEDIR=/usr/src dist" >>$LOGFILE 2>&1
353 if [ $? -ne 0 ]; then
354 exiterror "Packaging $1"
355 fi
356 # else
357 # echo "`date -u '+%b %e %T'`: Packaging: The package $1 already exists"
358 # fi
359 else
360 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
361 fi
362 return 0
363 }
364
365
366 installmake() {
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
399 buildtoolchain() {
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
446 buildbase() {
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
508 buildipcop() {
509 # Run IPFire make scripts one by one
510 LOGFILE="$BASEDIR/log/_build.ipfire.log"
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.....
529 ipcopmake linux LFS_PASS=ipfire SMP=installer
530 ipcopmake linux LFS_PASS=ipfire SMP=1
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
544 ipcopmake fcpci SMP=1
545 ipcopmake fcclassic SMP=1
546 ipcopmake pulsar SMP=1
547 ipcopmake unicorn SMP=1
548 fi
549
550 ipcopmake linux LFS_PASS=ipfire
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
565 ipcopmake fcdslslusb
566 ipcopmake fcpci
567 ipcopmake fcclassic
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
609 ipcopmake l7-protocols
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
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
641 ipcopmake Locale-Country
642 ipcopmake GeoIP
643 ipcopmake fwhits
644 ipcopmake berkeley
645 ipcopmake BerkeleyDB ## The Perl module
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
657 ipcopmake saslauthd PASS=1
658 ipcopmake openldap
659 ipcopmake saslauthd PASS=2
660 ipcopmake squid
661 ipcopmake squid-graph
662 ipcopmake squidguard
663 ipcopmake tcpdump
664 ipcopmake traceroute
665 ipcopmake vlan
666 #ipcopmake wireless
667 ipcopmake libsafe
668 ipcopmake 3c5x9setup
669 # echo -ne "`date -u '+%b %e %T'`: Building ### IPFire modules ### \n" | tee -a $LOGFILE
670 ipcopmake pakfire
671 ipcopmake startscripts
672 ## Zuerst die Libs und dann die Programme. Ordnung muss sein!
673 ipcopmake java
674 ipcopmake libtiff
675 ipcopmake libjpeg
676 ipcopmake libxml2
677 ipcopmake spandsp
678 ipcopmake lzo
679 ipcopmake openvpn
680 ipcopmake pkg-config
681 ipcopmake glib
682 ipcopmake xampp
683 ipcopmake pam
684 ipcopmake pammysql
685 ipcopmake xinetd
686 ipcopmake ghostscript
687 ipcopmake cups
688 # ipcopmake lpd ## Im Moment aus, da CUPS vorhanden ist.
689 ipcopmake samba
690 ipcopmake sudo
691 ipcopmake mc
692 ipcopmake pwlib
693 ipcopmake openh323
694 ipcopmake wget
695 ipcopmake wput
696 ipcopmake bridge-utils
697 ipcopmake screen
698 ipcopmake hddtemp
699 ipcopmake htop
700 ipcopmake lynx
701 echo -ne "`date -u '+%b %e %T'`: Building ### Mailserver ### \n" | tee -a $LOGFILE
702 ipcopmake postfix
703 ipcopmake procmail
704 ipcopmake fetchmail
705 ipcopmake cyrusimap
706 ipcopmake mailx
707 ipcopmake clamav
708 ipcopmake razor
709 ipcopmake spamassassin
710 ipcopmake amavisd
711 echo -ne "`date -u '+%b %e %T'`: Building ### VoIP-Server ### \n" | tee -a $LOGFILE
712 ipcopmake stund
713 ipcopmake asterisk
714 ipcopmake mpg123
715 echo -ne "`date -u '+%b %e %T'`: Building ### MP3-Server ### \n" | tee -a $LOGFILE
716 ipcopmake lame
717 ipcopmake gnump3d
718 echo -ne "`date -u '+%b %e %T'`: Building ### P2P-Clients ### \n" | tee -a $LOGFILE
719 ipcopmake applejuice
720 ipcopmake edonkeyclc
721 # ipcopmake sane
722 echo -ne "`date -u '+%b %e %T'`: Building ### Net-Tools ### \n" | tee -a $LOGFILE
723 ipcopmake ntop
724 # ipcopmake rsync
725 ipcopmake tcpwrapper
726 ipcopmake portmap
727 ipcopmake nfs
728 ipcopmake nmap
729 ipcopmake iftop
730 ipcopmake ncftp
731 ipcopmake cftp
732 ipcopmake etherwake
733 ipcopmake ethereal
734 # ipcopmake stunnel # Ausgeschaltet, weil wir es doch nicht nutzen
735 }
736
737 buildinstaller() {
738 # Run installer scripts one by one
739 LOGFILE="$BASEDIR/log/_build.installer.log"
740 export LOGFILE
741 echo -ne "`date -u '+%b %e %T'`: Stage4 installer build \n" | tee -a $LOGFILE
742 if [ 'i386' = $MACHINE ]; then
743 ipcopmake syslinux
744 ipcopmake as86
745 ipcopmake mbr
746 ipcopmake uClibc
747 fi
748 installmake busybox
749 installmake sysvinit
750 installmake e2fsprogs
751 installmake misc-progs
752 installmake slang
753 installmake util-linux
754 installmake newt
755 installmake pciutils
756 installmake pcmcia-cs
757 installmake kbd
758 installmake installer
759 installmake scsi.img
760 installmake driver.img
761 installmake initrd
762 installmake boot.img
763 }
764
765 buildpackages() {
766 LOGFILE="$BASEDIR/log/_build.packages.log"
767 export LOGFILE
768 echo "... see detailed log in _build.*.log files" >> $LOGFILE
769 echo -ne "`date -u '+%b %e %T'`: Stage5 packages build \n" | tee -a $LOGFILE
770 # Strip files
771 echo "`date -u '+%b %e %T'`: Stripping files" | tee -a $LOGFILE
772 find $LFS/lib $LFS/usr/lib $LFS/usr/share/rrdtool-* $LFS/install ! -type l \( -name '*.so' -o -name '*.so[\.0-9]*' \) \
773 ! -name 'libc.so' ! -name 'libpthread.so' ! -name 'libcrypto.so.0.9.7.sha1' \
774 -exec $LFS/tools/bin/strip --strip-all {} \; >> $LOGFILE 2>&1
775 # add -ls before -exec if you want to verify what files are stripped
776
777 find $LFS/{,s}bin $LFS/usr/{,s}bin $LFS/usr/local/{,s}bin ! -type l \
778 -exec file {} \; | grep " ELF " | cut -f1 -d ':' | xargs $LFS/tools/bin/strip --strip-all >> $LOGFILE 2>&1
779 # there add -v to strip to verify
780
781 if [ 'i386' = $MACHINE ]; then
782 # Create fcdsl packages
783 echo "`date -u '+%b %e %T'`: Building fcdsl tgz" | tee -a $LOGFILE
784 cp $LFS/install/images/fcdsl/license.txt $LFS >> $LOGFILE 2>&1
785 touch $LFS/var/run/{need-depmod-$KVER,need-depmod-$KVER-smp}
786 cd $LFS && tar cvfz $LFS/install/images/$SNAME-fcdsl-$VERSION.$MACHINE.tgz \
787 lib/modules/$KVER/misc/fcdsl*.o.gz \
788 lib/modules/$KVER-smp/misc/fcdsl*.o.gz \
789 usr/lib/isdn/{fds?base.bin,fd?ubase.frm} \
790 etc/fcdsl/fcdsl*.conf \
791 etc/drdsl/{drdsl,drdsl.ini} \
792 license.txt \
793 var/run/{need-depmod-$KVER,need-depmod-$KVER-smp} >> $LOGFILE 2>&1
794 rm -f $LFS/license.txt >> $LOGFILE 2>&1
795 cd $BASEDIR
796 fi
797
798 # Generating list of packages used
799 echo "`date -u '+%b %e %T'`: Generating packages list from logs" | tee -a $LOGFILE
800 rm -f $BASEDIR/doc/packages-list
801 for i in `ls -1tr $BASEDIR/log/[^_]*`; do
802 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
803 echo " * `basename $i`" >>$BASEDIR/doc/packages-list
804 fi
805 done
806 echo "====== List of softwares used to build $NAME Version: $VERSION ======" > $BASEDIR/doc/packages-list.txt
807 grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|ipcop$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$' \
808 $BASEDIR/doc/packages-list | sort >> $BASEDIR/doc/packages-list.txt
809 rm -f $BASEDIR/doc/packages-list
810 # packages-list.txt is ready to be displayed for wiki page
811
812 # Create ISO for CDRom and USB-superfloppy
813 ipcopmake cdrom
814 rm -f $LFS/install/images/*usb*
815 cp $LFS/install/images/{*.iso,*.tgz} $BASEDIR >> $LOGFILE 2>&1
816
817 ipfirepackages
818
819 # Cleanup
820 stdumount
821 rm -rf $BASEDIR/build/tmp/*
822
823 # Generating total list of files
824 echo "`date -u '+%b %e %T'`: Generating files list from logs" | tee -a $LOGFILE
825 rm -f $BASEDIR/log/FILES
826 for i in `ls -1tr $BASEDIR/log/[^_]*`; do
827 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
828 echo "##" >>$BASEDIR/log/FILES
829 echo "## `basename $i`" >>$BASEDIR/log/FILES
830 echo "##" >>$BASEDIR/log/FILES
831 cat $i | sed "s%^\./%#%" | sort >> $BASEDIR/log/FILES
832 fi
833 done
834
835 cd $PWD
836
837 }
838
839 ipfirepackages() {
840 ipfiredist applejuice
841 ipfiredist asterisk
842 ipfiredist clamav
843 ipfiredist cyrusimap
844 ipfiredist fetchmail
845 ipfiredist gnump3d
846 ipfiredist java
847 ipfiredist lame
848 ipfiredist libtiff
849 ipfiredist libxml2
850 ipfiredist ntop
851 ipfiredist postfix
852 ipfiredist samba
853 ipfiredist xampp
854 ipfiredist xinetd
855 test -d $BASEDIR/packages || mkdir $BASEDIR/packages
856 mv -f $LFS/paks/*.tar.gz $LFS/paks/*.md5 $BASEDIR/packages >> $LOGFILE 2>&1
857 rm -rf $LFS/paks
858 rm -rf $BASEDIR/build/tmp/*
859 }
860
861 # See what we're supposed to do
862 case "$1" in
863 build)
864 BUILDMACHINE=`uname -m`
865 PACKAGE=`ls -v -r $BASEDIR/cache/$SNAME-1.4-toolchain-$BUILDMACHINE.tar.gz 2> /dev/null | head -n 1`
866 #only restore on a clean disk
867 if [ ! -f log/perl-*-tools ]; then
868 if [ ! -n "$PACKAGE" ]; then
869 echo "`date -u '+%b %e %T'`: Full toolchain compilation" | tee -a $LOGFILE
870 prepareenv
871 buildtoolchain
872 else
873 PACKAGENAME=${PACKAGE%.tar.gz}
874 echo "`date -u '+%b %e %T'`: Restore from $PACKAGE" | tee -a $LOGFILE
875 if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then
876 tar zxf $PACKAGE
877 prepareenv
878 else
879 exiterror "$PACKAGENAME md5 did not match, check downloaded package"
880 fi
881 fi
882 else
883 echo "`date -u '+%b %e %T'`: Using installed toolchain" | tee -a $LOGFILE
884 prepareenv
885 fi
886 buildbase
887 buildipcop
888 buildinstaller
889 buildpackages
890 ;;
891 shell)
892 # enter a shell inside LFS chroot
893 # may be used to changed kernel settings
894 prepareenv
895 entershell
896 ;;
897 changelog)
898 echo -n "Loading new Changelog from SVN: "
899 svn log http://svn.ipfire.eu/svn/ipfire > doc/ChangeLog
900 echo "Finished!"
901 ;;
902 check)
903 echo "Checking sources files availability on the web"
904 if [ ! -d $DIR_CHK ]; then
905 mkdir -p $DIR_CHK
906 fi
907 FINISHED=0
908 cd $BASEDIR/lfs
909 for c in `seq $MAX_RETRIES`; do
910 if (( FINISHED==1 )); then
911 break
912 fi
913 FINISHED=1
914 cd $BASEDIR/lfs
915 for i in *; do
916 if [ -f "$i" -a "$i" != "Config" ]; then
917 make -s -f $i MACHINE=$MACHINE LFS_BASEDIR=$BASEDIR ROOT=$BASEDIR/build \
918 MESSAGE="$i\t ($c/$MAX_RETRIES)" check
919 if [ $? -ne 0 ]; then
920 echo "Check : wget error in lfs/$i"
921 FINISHED=0
922 fi
923 fi
924 done
925 done
926 cd -
927 ;;
928 checkclean)
929 echo "Erasing sources files availability tags"
930 rm -rf $DIR_CHK/*
931 ;;
932 clean)
933 for i in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do
934 $LOSETUP -d $i 2>/dev/null
935 done
936 for i in `mount | grep $BASEDIR | cut -d " " -f 1`; do
937 umount $i
938 done
939 stdumount
940 for i in `seq 0 7`; do
941 if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
942 umount /dev/loop${i} 2>/dev/null;
943 losetup -d /dev/loop${i} 2>/dev/null;
944 fi;
945 done
946 rm -rf $BASEDIR/build
947 rm -rf $BASEDIR/cdrom
948 rm -rf $BASEDIR/packages
949 rm -rf $BASEDIR/log
950 if [ -h /tools ]; then
951 rm -f /tools
952 fi
953 ;;
954 dist)
955 echo -ne "Updating & building source package from SVN: "
956 svn up > /dev/null
957 svn export http://svn.ipfire.eu/svn/ipfire ipfire-source/ --force > /dev/null
958 tar cfz ipfire-source-`date +'%Y-%m-%d'`-r`svn info | grep Revision | cut -c 11-`.tar.gz ipfire-source
959 rm ipfire-source/ -r
960 echo "Finished!"
961 ;;
962 newpak)
963 # create structure for a new package
964 echo -e "Name of the new package: $2"
965 if [ ! -f "lfs/$2" ]; then
966 echo "`date -u '+%b %e %T'`: Creating directory src/paks/$2"
967 mkdir -p src/paks/$2
968 cd src/paks/$2
969 echo "`date -u '+%b %e %T'`: Creating files"
970 cp $BASEDIR/lfs/postfix $BASEDIR/lfs/$2
971
972 touch ROOTFILES
973 touch CONFFILES
974 touch {,un}install.sh
975 ## install.sh
976 echo '#!/bin/bash' > install.sh
977 echo '#' >> install.sh
978 echo '#################################################################' >> install.sh
979 echo '# #' >> install.sh
980 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> install.sh
981 echo '# #' >> install.sh
982 echo '#################################################################' >> install.sh
983 echo '#' >> install.sh
984 echo '# Extract the files' >> install.sh
985 echo 'tar xfz files.tgz -C /' >> install.sh
986 echo 'cp -f ROOTFILES /opt/pakfire/installed/ROOTFILES.$2' >> install.sh
987 ## uninstall.sh
988 echo '#!/bin/bash' > uninstall.sh
989 echo '#################################################################' >> uninstall.sh
990 echo '# #' >> uninstall.sh
991 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> uninstall.sh
992 echo '# #' >> uninstall.sh
993 echo '#################################################################' >> uninstall.sh
994 echo '#' >> uninstall.sh
995 echo '# Delete the files' >> uninstall.sh
996 echo '## Befehl fehlt noch' >> uninstall.sh
997 echo 'rm -f /opt/pakfire/installed/ROOTFILES.$2' >> uninstall.sh
998 echo "`date -u '+%b %e %T'`: Adding files to SVN"
999 cd - && svn add lfs/$2 && svn add src/paks/$2
1000
1001 echo -n "Do you want to remove the folders? [y/n]"
1002 read REM
1003 if [ "$REM" == "y" ]; then
1004 echo "Removing the folders..."
1005 svn del src/paks/$2 --force
1006 else
1007 echo "Folders are kept."
1008 fi
1009 else
1010 echo "$2 already exists"
1011 fi
1012 exit 0
1013 ;;
1014 prefetch)
1015 if [ ! -d $BASEDIR/cache ]; then
1016 mkdir $BASEDIR/cache
1017 fi
1018 mkdir -p $BASEDIR/log
1019 echo "`date -u '+%b %e %T'`:Preload all source files" | tee -a $LOGFILE
1020 FINISHED=0
1021 cd $BASEDIR/lfs
1022 for c in `seq $MAX_RETRIES`; do
1023 if (( FINISHED==1 )); then
1024 break
1025 fi
1026 FINISHED=1
1027 cd $BASEDIR/lfs
1028 for i in *; do
1029 if [ -f "$i" -a "$i" != "Config" ]; then
1030 make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t ($c/$MAX_RETRIES)" download >> $LOGFILE 2>&1
1031 if [ $? -ne 0 ]; then
1032 echo "Prefetch : wget error in lfs/$i"
1033 FINISHED=0
1034 else
1035 if [ $c -eq 1 ]; then
1036 echo "Prefetch : lfs/$i files loaded"
1037 fi
1038 fi
1039 fi
1040 done
1041 done
1042 echo "Prefetch : verifying md5sum"
1043 ERROR=0
1044 for i in *; do
1045 if [ -f "$i" -a "$i" != "Config" ]; then
1046 make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t " md5 >> $LOGFILE 2>&1
1047 if [ $? -ne 0 ]; then
1048 echo "md5 difference in lfs/$i"
1049 ERROR=1
1050 fi
1051 fi
1052 done
1053 if [ $ERROR -eq 0 ]; then
1054 echo "Prefetch : all files md5sum match"
1055 fi
1056 cd -
1057 ;;
1058 toolchain)
1059 prepareenv
1060 buildtoolchain
1061 BUILDMACHINE=`uname -m`
1062 echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for $BUILDMACHINE" | tee -a $LOGFILE
1063 cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \
1064 build/{bin,etc,usr/bin,usr/local} \
1065 build/tools/{bin,etc,*-linux-gnu,include,lib,libexec,sbin,share,var} \
1066 log >> $LOGFILE
1067 md5sum cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \
1068 > cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.md5
1069 stdumount
1070 ;;
1071 gettoolchain)
1072 BUILDMACHINE=`uname -m`
1073 # arbitrary name to be updated in case of new toolchain package upload
1074 PACKAGE=$SNAME-1.4-toolchain-$BUILDMACHINE
1075 URL_IPFIRE=`grep URL_IPFIRE lfs/Config | awk '{ print $3 }'`
1076 echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for $BUILDMACHINE" | tee -a $LOGFILE
1077 cd $BASEDIR/cache
1078 wget $URL_IPFIRE/toolchains/$PACKAGE.tar.gz $URL_IPFIRE/toolchains/$PACKAGE.md5 >& /dev/null
1079 if [ $? -ne 0 ]; then
1080 echo "`date -u '+%b %e %T'`: error downloading toolchain for $BUILDMACHINE machine" | tee -a $LOGFILE
1081 # else
1082 # if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then
1083 # echo "`date -u '+%b %e %T'`: toolchain md5 ok" | tee -a $LOGFILE
1084 # echo "`date -u '+%b %e %T'`: Uncompressing toolchain" | tee -a $LOGFILE
1085 # cd $BASEDIR && tar xfz cache/$PACKAGE.tar.gz -C .
1086 # rm -f $BASEDIR/cache/$PACKAGE.{tar.gz,md5}
1087 # else
1088 # exiterror "$PACKAGE.md5 did not match, check downloaded package"
1089 # fi
1090 fi
1091 ;;
1092 paks)
1093 prepareenv
1094 # buildpackages
1095 ipfirepackages
1096 ;;
1097 update)
1098 echo "Load the latest source-files:"
1099 svn update
1100 ;;
1101 commit)
1102 echo "Upload the changed files:"
1103 svn commit
1104 ./make.sh sync
1105 svn up > /dev/null
1106 ;;
1107 make)
1108 echo "Do a complete compile:"
1109 ./make.sh prefetch && ./make.sh gettoolchain && ./make.sh build
1110 ;;
1111 diff)
1112 echo -ne "Make a local diff to last SVN revision: "
1113 svn diff > ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff
1114 echo "Finished!"
1115 echo "Diff was successfully saved to ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff"
1116 ;;
1117 sync)
1118 echo -e "Syncing Cache to FTP:"
1119 if [ -f .pass ]; then
1120 PASS="`cat .pass`"
1121 else
1122 echo -ne "Password for mirror.ipfire.org: "; read PASS
1123 fi
1124 rm -f doc/packages-to-remove-from-ftp
1125 ncftpls -u web3 -p $PASS ftp://mirror.ipfire.org/html/source-packages/source/ > ftplist
1126 for i in `ls -w1 cache/`; do
1127 grep $i ftplist
1128 if [ "$?" -ne "0" ]; then
1129 ncftpput -u web3 -p $PASS mirror.ipfire.org /html/source-packages/source cache/$i
1130 if [ "$?" -eq "0" ]; then
1131 echo -e "$i was successfully uploaded to the ftp server."
1132 else
1133 echo -e "There was an error while uploading $i to the ftp server."
1134 fi
1135 fi
1136 done
1137 for i in `cat ftplist`; do
1138 ls -w1 cache/ | grep $i
1139 if [ "$?" -eq "1" ]; then
1140 echo $i | grep -v toolchain >> doc/packages-to-remove-from-ftp
1141 fi
1142 done
1143 rm -f ftplist
1144 ;;
1145 pub-iso)
1146 echo -e "Upload the ISO to the beta-mirror!"
1147 if [ -f .pass ]; then
1148 PASS="`cat .pass`"
1149 else
1150 echo -ne "Password for mirror.ipfire.org: "; read PASS
1151 fi
1152 ncftpls -u web3 -p $PASS ftp://mirror.ipfire.org/html/source-packages/beta/ | grep `svn info | grep Revision | cut -c 11-`
1153 if [ "$?" -eq "1" ]; then
1154 cp $BASEDIR/ipfire-install-1.4.i386.iso $BASEDIR/ipfire-install-1.4.i386-r`svn info | grep Revision | cut -c 11-`.iso
1155 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
1156 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
1157 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
1158 if [ "$?" -eq "0" ]; then
1159 echo -e "The ISO of Revision `svn info | grep Revision | cut -c 11-` was successfully uploaded to the ftp server."
1160 else
1161 echo -e "There was an error while uploading the ISO to the ftp server."
1162 fi
1163 else
1164 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!"
1165 fi
1166 rm -f ipfire-install-1.4.i386-r`svn info | grep Revision | cut -c 11-`.iso{,.md5}
1167 ;;
1168 pub-paks)
1169 echo -e "Upload the packages to the beta-mirror!"
1170 if [ -f .pass ]; then
1171 PASS="`cat .pass`"
1172 else
1173 echo -ne "Password for mirror.ipfire.org: "; read PASS
1174 fi
1175 ncftpput -z -u web3 -p $PASS mirror.ipfire.org /html/source-packages/packages/ packages/*
1176 if [ "$?" -eq "0" ]; then
1177 echo -e "The packages were successfully uploaded to the ftp server."
1178 else
1179 echo -e "There was an error while uploading the packages to the ftp server."
1180 fi
1181 ;;
1182 *)
1183 echo "Usage: $0 {build|changelog|check|checkclean|clean|commit|diff|dist|gettoolchain|make|newpak|prefetch|pub-iso|pub-paks|shell|sync|toolchain|update}"
1184 cat doc/make.sh-usage
1185 exit 1
1186 ;;
1187 esac