]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blob - make.sh
Added StrongSwan for testing purposes.
[people/ms/ipfire-3.x.git] / make.sh
1 #!/bin/bash
2 ############################################################################
3 # #
4 # This file is part of the IPFire Firewall. #
5 # #
6 # IPFire is free software; you can redistribute it and/or modify #
7 # it under the terms of the GNU General Public License as published by #
8 # the Free Software Foundation; either version 2 of the License, or #
9 # (at your option) any later version. #
10 # #
11 # IPFire is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
15 # #
16 # You should have received a copy of the GNU General Public License #
17 # along with IPFire; if not, write to the Free Software #
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
19 # #
20 # Copyright (C) 2007 IPFire-Team <info@ipfire.org>. #
21 # #
22 ############################################################################
23 #
24
25 NAME="IPFire" # Software name
26 SNAME="ipfire" # Short name
27 VERSION="2.9" # Version number
28 TOOLCHAINVERSION="${VERSION}" # Toolchain
29 SLOGAN="www.ipfire.org" # Software slogan
30
31 # Include funtions
32 . tools/make-include
33
34
35 ################################################################################
36 # This builds the entire stage "toolchain" #
37 ################################################################################
38 toolchain_build() {
39
40 ORG_PATH=$PATH
41 export PATH=$BASEDIR/build_${MACHINE}/usr/local/ccache/bin:$BASEDIR/build_${MACHINE}/usr/local/distcc/bin:$BASEDIR/build_${MACHINE}/$TOOLS_DIR/bin:$PATH
42 STAGE_ORDER=01
43 STAGE=toolchain
44
45 LOGFILE="$BASEDIR/log_${MACHINE}/_build.toolchain.log"
46 export LOGFILE
47
48 NATIVEGCC=`gcc --version | grep GCC | awk {'print $3'}`
49 export NATIVEGCC GCCmajor=${NATIVEGCC:0:1} GCCminor=${NATIVEGCC:2:1} GCCrelease=${NATIVEGCC:4:1}
50
51 # make distcc first so that CCACHE_PREFIX works immediately
52 [ -z "$DISTCC_HOSTS" ] || toolchain_make distcc
53 toolchain_make ccache
54
55 toolchain_make binutils PASS=1
56 toolchain_make gcc PASS=1
57 toolchain_make linux
58 toolchain_make glibc
59 toolchain_make adjust-toolchain
60 toolchain_make tcl
61 toolchain_make expect
62 toolchain_make dejagnu
63 toolchain_make gcc PASS=2
64 toolchain_make binutils PASS=2
65 toolchain_make ncurses
66 toolchain_make bash
67 toolchain_make bzip2
68 toolchain_make coreutils
69 toolchain_make diffutils
70 toolchain_make findutils
71 toolchain_make gawk
72 toolchain_make gettext
73 toolchain_make grep
74 toolchain_make gzip
75 toolchain_make make
76 toolchain_make patch
77 toolchain_make perl
78 toolchain_make sed
79 toolchain_make tar
80 toolchain_make texinfo
81 toolchain_make util-linux
82 toolchain_make strip
83 export PATH=$ORG_PATH
84 }
85
86 ################################################################################
87 # This builds the entire stage "base" #
88 ################################################################################
89 base_build() {
90
91 PATH=/usr/local/ccache/bin:/usr/local/distcc/bin:/bin:/usr/bin:/sbin:/usr/sbin:$TOOLS_DIR/bin
92 STAGE_ORDER=02
93 STAGE=base
94
95 LOGFILE="$BASEDIR/log_${MACHINE}/_build.base.log"
96 export LOGFILE
97
98 ipfire_make stage2
99 ipfire_make linux
100 ipfire_make man-pages
101 ipfire_make glibc
102 ipfire_make adjust-toolchain
103 ipfire_make binutils
104 ipfire_make gcc
105 ipfire_make berkeley
106 ipfire_make sed
107 ipfire_make e2fsprogs
108 ipfire_make coreutils
109 ipfire_make iana-etc
110 ipfire_make m4
111 ipfire_make bison
112 ipfire_make ncurses
113 ipfire_make procps
114 ipfire_make libtool
115 ipfire_make perl
116 ipfire_make readline
117 ipfire_make zlib
118 ipfire_make autoconf
119 ipfire_make automake
120 ipfire_make bash
121 ipfire_make bzip2
122 ipfire_make diffutils
123 ipfire_make file
124 ipfire_make findutils
125 ipfire_make flex
126 ipfire_make grub
127 ipfire_make gawk
128 ipfire_make gettext
129 ipfire_make grep
130 ipfire_make groff
131 ipfire_make gzip
132 ipfire_make inetutils
133 ipfire_make iproute2
134 ipfire_make kbd
135 ipfire_make less
136 ipfire_make make
137 ipfire_make man-db
138 ipfire_make mktemp
139 ipfire_make module-init-tools
140 ipfire_make patch
141 ipfire_make psmisc
142 ipfire_make shadow
143 ipfire_make sysklogd
144 ipfire_make sysvinit
145 ipfire_make tar
146 ipfire_make texinfo
147 ipfire_make udev ## NEED TO INSTALL CONFIG
148 ipfire_make util-linux
149 ipfire_make vim
150 }
151
152 ################################################################################
153 # This builds the entire stage "ipfire" #
154 ################################################################################
155 ipfire_build() {
156 PATH=/usr/local/ccache/bin:/usr/local/distcc/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/${MACHINE_REAL}-linux/bin
157 STAGE_ORDER=03
158 STAGE=ipfire
159
160 LOGFILE="$BASEDIR/log_${MACHINE}/_build.ipfire.log"
161 export LOGFILE
162
163 ### Building the configuration dirs and files
164 #
165 ipfire_make stage3
166
167 ### Building the kernel stuff
168 #
169 ipfire_make linux
170
171 ### Building pkg-config
172 #
173 ipfire_make pkg-config
174
175 ### Building some network stuff
176 #
177 ipfire_make libpcap
178 ipfire_make linux-atm
179 ipfire_make ppp
180 ipfire_make rp-pppoe
181 ipfire_make dhcp
182 ipfire_make iptables
183 ipfire_make libnfnetlink
184 ipfire_make libnetfilter_queue
185 ipfire_make libnetfilter_conntrack
186 ipfire_make dnsmasq
187 ipfire_make l7-protocols
188 ipfire_make iptstate
189 ipfire_make bridge-utils
190 ipfire_make vlan
191 ipfire_make bind
192
193 ### Building some general stuff
194 #
195 ipfire_make openssl
196 ipfire_make pam PASS=1
197 ipfire_make shadow
198 ipfire_make pam PASS=2
199 ipfire_make gmp
200 #ipfire_make libidn ### Do we need this?
201 ipfire_make pcre
202 ipfire_make popt
203 ipfire_make python
204 ipfire_make pyfire
205 ipfire_make libxml2
206 ipfire_make libxslt
207 ipfire_make slang
208 ipfire_make newt
209 ipfire_make cyrus-sasl
210 ipfire_make openldap
211 ipfire_make sqlite
212 ipfire_make curl
213 ipfire_make libusb
214 ipfire_make gnupg
215 ipfire_make sudo
216 #ipfire_make libjpeg ### Do we need this?
217 ipfire_make libpng
218 ipfire_make libtiff
219 ipfire_make libart
220 ipfire_make freetype
221 ipfire_make lzo
222 ipfire_make lsof
223 ipfire_make br2684ctl
224 ipfire_make etherwake
225 ipfire_make htop
226 ipfire_make beep
227
228 ### Building vpn stuff
229 #
230 ipfire_make strongswan
231
232 ### Building filesystem stuff
233 #
234 ipfire_make reiserfsprogs
235 ipfire_make libaal
236 ipfire_make reiser4progs
237 ipfire_make xfsprogs
238 ipfire_make sysfsutils
239
240 ### Building hardware utils
241 #
242 ipfire_make pciutils
243 ipfire_make usbutils
244 ipfire_make hdparm
245 ipfire_make kudzu
246 ipfire_make smartmontools
247 ipfire_make lm-sensors
248
249 ### Building some important tools
250 #
251 ipfire_make fcron
252 ipfire_make which
253 ipfire_make nano
254 ipfire_make screen
255 ipfire_make rrdtool
256 ipfire_make ntp ### Needs config.
257 ipfire_make openssh
258 ipfire_make ez-ipupdate
259 ipfire_make noip
260 ipfire_make lighttpd
261 ipfire_make lzma
262 ipfire_make collectd
263 #ipfire_make logrotate
264 #ipfire_make logwatch
265 ipfire_make cpio
266 ipfire_make cdrtools
267 ipfire_make parted
268 ipfire_make memtest86+
269 #ipfire_make pakfire
270 #ipfire_make initscripts
271
272 ### -------------------------------------------------------------------------
273 ### Tools that maybe not needed
274 #
275 #ipfire_make expat
276 #ipfire_make gd
277 #ipfire_make libcap
278 #ipfire_make mtools
279 #ipfire_make mISDN
280
281 #ipfire_make nasm
282 #ipfire_make wireless
283 #ipfire_make libsafe
284 }
285
286 ################################################################################
287 # This builds the entire stage "misc" #
288 ################################################################################
289 misc_build() {
290
291 PATH=/usr/local/ccache/bin:/usr/local/distcc/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/${MACHINE_REAL}-linux/bin
292 STAGE_ORDER=04
293 STAGE=misc
294
295 LOGFILE="$BASEDIR/log_${MACHINE}/_build.misc.log"
296 export LOGFILE
297
298 ipfire_make stage4
299
300 ### Console tools
301 #
302 ipfire_make glib
303 ipfire_make mc
304 #ipfire_make traceroute
305 #ipfire_make nmap
306 #ipfire_make rsync
307 #ipfire_make tcpdump
308
309 #ipfire_make squid
310 #ipfire_make squidguard ## CAN THIS BE BANISHED BY ANYTHING BETTER?
311 #ipfire_make calamaris ## CAN THIS BE BANISHED BY ANYTHING BETTER?
312 #ipfire_make vsftpd
313
314 ### Programs that are still for discussion
315 # package or in the standard system
316 #
317 ## NTFS
318 #ipfire_make fuse
319 #ipfire_make ntfs-3g
320 #
321 ## Net tools
322 #ipfire_make bwm-ng
323 #ipfire_make openvpn
324 #
325 ## UPNP
326 #ipfire_make libupnp
327 #ipfire_make linux-igd
328
329 ### These will become addons as usual but will be integrated later
330 #
331 #ipfire_make snort
332 #ipfire_make oinkmaster
333 #ipfire_make centerim
334 #ipfire_make tripwire
335 #ipfire_make java
336 #ipfire_make cups
337 #ipfire_make ghostscript
338 #ipfire_make foomatic
339 #ipfire_make hplip
340 #ipfire_make samba
341 #ipfire_make postfix
342 #ipfire_make fetchmail
343 #ipfire_make cyrus-imapd
344 #ipfire_make clamav
345 #ipfire_make alsa
346 #ipfire_make mpg123
347 #ipfire_make mpfire
348 #ipfire_make guardian
349 #ipfire_make libid3tag
350 #ipfire_make libmad
351 #ipfire_make libogg
352 #ipfire_make libvorbis
353 #ipfire_make lame
354 #ipfire_make sox
355 #ipfire_make libshout
356 #ipfire_make icecast
357 #ipfire_make icegenerator
358 #ipfire_make mpd
359 #ipfire_make mpc
360 #ipfire_make xvid
361 #ipfire_make libmpeg2
362 #ipfire_make videolan
363 #ipfire_make libpri
364 #ipfire_make asterisk
365 #ipfire_make libsigc++
366 #ipfire_make applejuice
367 #ipfire_make libtorrent
368 #ipfire_make rtorrent
369 #ipfire_make ipfireseeder
370 #ipfire_make nfs
371
372 # ---------------------------------------------------------------------------
373 #ipfire_make as86
374 #ipfire_make mbr
375 }
376
377 ################################################################################
378 # This builds the entire stage "installer" #
379 ################################################################################
380 installer_build() {
381
382 PATH=/usr/local/ccache/bin:/usr/local/distcc/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/${MACHINE_REAL}-linux/bin
383 STAGE_ORDER=05
384 STAGE=installer
385
386 LOGFILE="$BASEDIR/log_${MACHINE}/_build.installer.log"
387 export LOGFILE
388
389 ipfire_make stage5
390 ipfire_make busybox
391 ipfire_make installer
392 ipfire_make initramfs
393 }
394
395 ################################################################################
396 # This builds the entire stage "packages" #
397 ################################################################################
398 packages_build() {
399
400 PATH=/usr/local/ccache/bin:/usr/local/distcc/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/${MACHINE_REAL}-linux/bin
401 STAGE_ORDER=06
402 STAGE=packages
403
404 LOGFILE="$BASEDIR/log_${MACHINE}/_build.packages.log"
405 export LOGFILE
406
407 toolchain_make strip
408
409 # Generating list of packages used
410 ### MISSING ATM
411
412 ipfire_make cdrom
413
414 # Check if there is a loop device for building in virtual environments
415 #if [ -e /dev/loop/0 ] || [ -e /dev/loop0 ]; then
416 # ipfire_make usb-stick
417 #fi
418 mv $LFS/$IMAGES_DIR/{*.iso,*.tgz,*.img.gz} $BASEDIR >> $LOGFILE 2>&1
419
420 #ipfire_make core-updates
421 ### DISABLED ATM
422
423 for i in $(ls -1 $BASEDIR/src/rootfiles/extras); do
424 if [ -e $BASEDIR/lfs/$i ]; then
425 echo -n
426 ### Do nothing at the moment, we are gonna use a new packager
427 else
428 echo -n $i
429 beautify message SKIP
430 fi
431 done
432
433 # Cleanup
434 stdumount
435 rm -rf $LFS/tmp/*
436
437 cd $PWD
438 }
439
440 # See what we're supposed to do
441 case "$1" in
442 build)
443 clear
444 #a prebuilt toolchain package is only used if found in cache
445 if [ ! -d $BASEDIR/cache ]; then
446 exiterror "Use make.sh downloadsrc first!"
447 fi
448 cd $BASEDIR/cache/toolchains
449 PACKAGE=`ls -v -r $TOOLCHAINNAME.tar.bz2 2> /dev/null | head -n 1`
450 #only restore on a clean disk
451
452 echo -ne "Building for ${BOLD}${MACHINE} on ${MACHINE_REAL}${NORMAL}\n"
453
454 if [ -f $BASEDIR/log_${MACHINE}/02_base/stage2-LFS ]; then
455 prepareenv
456 echo "Using installed toolchain" >> $LOGFILE
457 beautify message DONE "Stage toolchain already built or extracted"
458 else
459 if [ -z "$PACKAGE" ]; then
460 echo "Full toolchain compilation" | tee -a $LOGFILE
461 prepareenv
462
463 # Check if host can build the toolchain
464 check_toolchain_prerequisites
465
466 beautify build_stage "Building toolchain"
467 toolchain_build
468 else
469 echo "Restore from $PACKAGE" | tee -a $LOGFILE
470 if [ `md5sum $BASEDIR/cache/toolchains/$PACKAGE | awk '{print $1}'` == `cat $BASEDIR/cache/toolchains/$TOOLCHAINNAME.md5 | awk '{print $1}'` ]; then
471 cd $BASEDIR && tar jxf $BASEDIR/cache/toolchains/$PACKAGE
472 prepareenv
473 else
474 exiterror "$TOOLCHAINNAME md5 did not match, check downloaded package"
475 fi
476 fi
477 fi
478
479 beautify build_stage "Building base"
480 base_build
481
482 beautify build_stage "Building $NAME"
483 ipfire_build
484
485 beautify build_stage "Building miscellaneous"
486 misc_build
487
488 beautify build_stage "Building installer"
489 installer_build
490
491 beautify build_stage "Building packages"
492 packages_build
493
494 echo ""
495 echo "... and all this hard work for this:"
496 du -bsh $BASEDIR/${SNAME}-${VERSION}.${MACHINE}.iso
497 ;;
498
499 shell)
500 # enter a shell inside LFS chroot
501 # may be used to changed kernel settings
502 prepareenv
503 entershell
504 ;;
505
506 changelog)
507 echo -n "Loading new Changelog from SVN: "
508 svn log http://svn.ipfire.org/svn/ipfire > doc/ChangeLog
509 beautify message DONE
510 ;;
511
512 clean)
513 echo -ne "Cleaning ${BOLD}$MACHINE${NORMAL} buildtree"
514 for i in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`
515 do
516 $LOSETUP -d $i 2>/dev/null
517 done
518
519 for i in `mount | grep $BASEDIR | cut -d " " -f 1`
520 do
521 umount $i
522 done
523
524 stdumount
525
526 for i in `seq 0 7`
527 do
528 if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
529 umount /dev/loop${i} 2>/dev/null;
530 losetup -d /dev/loop${i} 2>/dev/null;
531 fi;
532 done
533
534 rm -rf $BASEDIR/build_${MACHINE}
535 rm -rf $BASEDIR/log_${MACHINE}
536 rm -rf $BASEDIR/packages
537
538 if [ -h $TOOLS_DIR ]; then
539 rm -f $TOOLS_DIR
540 fi
541 beautify message DONE
542 ;;
543
544 downloadsrc)
545 LOGFILE=$BASEDIR/log_${MACHINE}/_build.preparation.log
546
547 if [ ! -d $BASEDIR/cache ]; then
548 mkdir $BASEDIR/cache
549 fi
550 mkdir -p $BASEDIR/log_${MACHINE}
551 echo -e "${BOLD}Preload all source files${NORMAL}" | tee -a $LOGFILE
552 FINISHED=0
553 cd $BASEDIR/lfs
554 for c in `seq $MAX_RETRIES`; do
555 if (( FINISHED==1 )); then
556 break
557 fi
558 FINISHED=1
559 cd $BASEDIR/lfs
560 for i in *; do
561 if [ -f "$i" -a "$i" != "Config" ]; then
562 echo -ne "Loading $i"
563 make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t ($c/$MAX_RETRIES)" download >> $LOGFILE 2>&1
564 if [ $? -ne 0 ]; then
565 beautify message FAIL
566 FINISHED=0
567 else
568 if [ $c -eq 1 ]; then
569 beautify message DONE
570 fi
571 fi
572 fi
573 done
574 done
575 cd - >/dev/null 2>&1
576 ;;
577
578 toolchain)
579 prepareenv
580 # Check if host can build the toolchain
581 check_toolchain_prerequisites
582 toolchain_build
583 echo "Create toolchain tar.bz for $MACHINE" | tee -a $LOGFILE
584 # Safer inside the chroot
585 echo -ne "Stripping lib"
586 chroot $LFS $TOOLS_DIR/bin/find $TOOLS_DIR/lib \
587 -type f \( -name '*.so' -o -name '*.so[\.0-9]*' \) \
588 -exec $TOOLS_DIR/bin/strip --strip-debug {} \; 2>/dev/null
589 beautify message DONE
590 echo -ne "Stripping binaries"
591 chroot $LFS $TOOLS_DIR/bin/find /usr/local /usr/src/binutils-build $TOOLS_DIR/bin $TOOLS_DIR/sbin \
592 -type f \
593 -exec $TOOLS_DIR/bin/strip --strip-all {} \; 2> /dev/null
594 beautify message DONE
595 stdumount
596 echo -ne "Tar creation "
597 [ -d cache/toolchains ] || mkdir cache/toolchains
598 cd $BASEDIR && tar cj \
599 --exclude='log_${MACHINE}/_build.*.log' \
600 --file=cache/toolchains/$TOOLCHAINNAME.tar.bz2 \
601 build_${MACHINE} \
602 log_${MACHINE} >> $LOGFILE
603 beautify message DONE
604 echo `ls -sh cache/toolchains/$TOOLCHAINNAME.tar.bz2`
605 md5sum cache/toolchains/$TOOLCHAINNAME.tar.bz2 \
606 > cache/toolchains/$TOOLCHAINNAME.md5
607
608 stdumount
609 ;;
610
611 gettoolchain)
612 if [ ! -f $BASEDIR/cache/toolchains/$TOOLCHAINNAME.tar.bz2 ]; then
613 URL_TOOLCHAIN=`grep URL_TOOLCHAIN lfs/Config | awk '{ print $3 }'`
614 test -d $BASEDIR/cache/toolchains || mkdir $BASEDIR/cache/toolchains
615 echo "Loading toolchain for $MACHINE"
616 cd $BASEDIR/cache/toolchains
617 wget -c -nv $URL_TOOLCHAIN/$TOOLCHAINNAME.tar.bz2 $URL_TOOLCHAIN/$TOOLCHAINNAME.md5
618 if [ $? -ne 0 ]; then
619 echo -n "ERROR: Downloading toolchain for $MACHINE machine"
620 beautify message FAIL
621 echo "Precompiled toolchain not always available for every machine"
622 else
623 if [ "`md5sum $TOOLCHAINNAME.tar.bz2 | awk '{print $1}'`" = "`cat $TOOLCHAINNAME.md5 | awk '{print $1}'`" ]; then
624 beautify message DONE
625 echo "Toolchain md5 ok"
626 else
627 exiterror "$TOOLCHAINNAME.md5 did not match, check downloaded package"
628 fi
629 fi
630 else
631 echo -n "Toolchain for $MACHINE is already existing"
632 beautify message SKIP
633 fi
634 ;;
635
636 othersrc)
637 prepareenv
638 echo -ne "`date -u '+%b %e %T'`: Build sources iso for $MACHINE" | tee -a $LOGFILE
639 chroot $LFS /tools/bin/env -i HOME=/root \
640 TERM=$TERM PS1='\u:\w\$ ' \
641 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \
642 VERSION=$VERSION NAME="$NAME" SNAME="$SNAME" MACHINE=$MACHINE \
643 /bin/bash -x -c "cd /usr/src/lfs && make -f sources-iso LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
644 mv $LFS/install/images/ipfire-* $BASEDIR >> $LOGFILE 2>&1
645 if [ $? -eq "0" ]; then
646 beautify message DONE
647 else
648 beautify message FAIL
649 fi
650 stdumount
651 ;;
652
653 svn)
654 . $BASEDIR/tools/make-subversion
655 case "$2" in
656 update|up)
657 svn_up
658 ;;
659 commit|ci)
660 clear
661 svn_commit
662 svn_up
663 ;;
664 dist)
665 svn_dist
666 ;;
667 diff|di)
668 svn_diff
669 ;;
670 esac
671 ;;
672
673 uploadsrc)
674 PWD=`pwd`
675 cd $BASEDIR/cache/
676 echo -e "Uploading cache to ftp server:"
677 for i in *; do
678 echo "${i}" | fgrep -q .md5 && continue
679 [ -e ${i}.md5 ] && continue
680 md5sum ${i} | tee ${i}.md5
681 done
682 ncftpls -u $FTP_CACHE_USER -p $FTP_CACHE_PASS ftp://$FTP_CACHE_URL/$FTP_CACHE_PATH/ > /tmp/ftplist
683 for i in *; do
684 if [ "$(basename $i)" == "toolchains" ]; then continue; fi
685 grep -q $(basename $i) /tmp/ftplist
686 if [ "$?" -ne "0" ]; then
687 echo -ne "$(basename $i)"
688 ncftpput -u $FTP_CACHE_USER -p $FTP_CACHE_PASS $FTP_CACHE_URL $FTP_CACHE_PATH/ $(basename $i)
689 if [ "$?" -ne "0" ]; then
690 beautify message FAIL
691 fi
692 fi
693 done
694 rm -f /tmp/ftplist
695 cd $PWD
696 exit 0
697 ;;
698
699 upload)
700 FTP_ISO_PORT=`echo "$FTP_ISO_URL" | awk -F: '{ print $2 }'`
701 FTP_ISO_URL=`echo "$FTP_ISO_URL" | awk -F: '{ print $1 }'`
702 if [ -z $FTP_ISO_PORT ]; then
703 FTP_ISO_PORT=21
704 fi
705 cat <<EOF > .ftp-commands
706 mkdir -p $FTP_ISO_PATH$SVN_REVISION
707 mkdir -p $FTP_ISO_PATH$SVN_REVISION/paks
708 quit
709 EOF
710 ncftp -u $FTP_ISO_USER -p $FTP_ISO_PASS -P $FTP_ISO_PORT $FTP_ISO_URL < .ftp-commands
711 rm -f .ftp-commands
712
713 case "$2" in
714 iso)
715 echo -e "Uploading the iso to $FTP_ISO_PATH/$SVN_REVISION."
716
717 md5sum ipfire-$VERSION.$MACHINE-full.iso > ipfire-$VERSION.$MACHINE-full.iso.md5
718 for i in svn_status ipfire-source-r$SVN_REVISION.tar.gz ipfire-$VERSION.$MACHINE-full.iso ipfire-$VERSION.$MACHINE-full.iso.md5 ipfire-$VERSION.$MACHINE-devel.iso ipfire-$VERSION.$MACHINE-devel.iso.md5; do
719 if [ -e "$i" ]; then
720 ncftpput -u $FTP_ISO_USER -p $FTP_ISO_PASS -P $FTP_ISO_PORT $FTP_ISO_URL $FTP_ISO_PATH$SVN_REVISION/ $i
721 if [ "$?" -eq "0" ]; then
722 echo "The file with name $i was successfully uploaded to $FTP_ISO_URL$FTP_ISO_PATH$SVN_REVISION/."
723 else
724 echo "There was an error while uploading the file $i to the ftp server."
725 exit 1
726 fi
727 fi
728 done
729 rm -f ipfire-$VERSION.$MACHINE-full.iso.md5
730 if [ "$3" = "--with-sources-cd" ]; then
731 ncftpput -u $FTP_ISO_USER -p $FTP_ISO_PASS -P $FTP_ISO_PORT $FTP_ISO_URL $FTP_ISO_PATH/$SVN_REVISION/ ipfire-sources-cd-$VERSION.$MACHINE.iso
732 fi
733 ;;
734 paks)
735 ncftpput -u $FTP_ISO_USER -p $FTP_ISO_PASS -P $FTP_ISO_PORT $FTP_ISO_URL $FTP_ISO_PATH$SVN_REVISION/paks packages/*
736 if [ "$?" -eq "0" ]; then
737 echo -e "The packages were successfully uploaded to $FTP_ISO_URL$FTP_ISO_PATH$SVN_REVISION/."
738 else
739 echo -e "There was an error while uploading the packages to the ftp server."
740 exit 1
741 fi
742 ;;
743 esac
744 ;;
745
746 batch)
747 if [ "$2" = "--background" ]; then
748 batch_script
749 exit $?
750 fi
751 if [ `screen -ls | grep -q ipfire` ]; then
752 echo "Build is already running, sorry!"
753 exit 1
754 else
755 if [ "$2" = "--rebuild" ]; then
756 export IPFIRE_REBUILD=1
757 echo "REBUILD!"
758 else
759 export IPFIRE_REBUILD=0
760 fi
761 echo -en "${BOLD}***IPFire-Batch-Build is starting...${NORMAL}"
762 screen -dmS ipfire $0 batch --background
763 evaluate 1
764 exit 0
765 fi
766 ;;
767
768 watch|attach)
769 watch_screen
770 ;;
771
772 *)
773 cat doc/make.sh-usage
774 ;;
775
776 esac