]> git.ipfire.org Git - ipfire-2.x.git/blame_incremental - make.sh
Mehrere Tippfehler in lfs/linux beseitigt.
[ipfire-2.x.git] / make.sh
... / ...
CommitLineData
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) 2006 IPFire-Team <info@ipfire.eu>. #
21# #
22############################################################################
23#
24
25NAME="IPFire" # Software name
26SNAME="ipfire" # Short name
27VERSION="2.0" # Version number
28SLOGAN="www.ipfire.eu" # Software slogan
29CONFIG_ROOT=/var/ipfire # Configuration rootdir
30NICE=10 # Nice level
31MAX_RETRIES=1 # prefetch/check loop
32KVER=`grep --max-count=1 VER lfs/linux | awk '{ print $3 }'`
33MACHINE=`uname -m`
34SVN_REVISION=`svn info | grep Revision | cut -c 11-`
35
36# Setzen des IPFire Builds
37if [ -e ./.svn ]; then
38 FIREBUILD=`cat .svn/entries |sed -n 's/^[ \t]*revision=\"// p' | sed -n 's/\".*$// p'`
39fi
40
41# Debian specific settings
42if [ ! -e /etc/debian_version ]; then
43 FULLPATH=`which $0`
44else
45 if [ -x /usr/bin/realpath ]; then
46 FULLPATH=`/usr/bin/realpath $0`
47 else
48 echo "ERROR: Need to do apt-get install realpath"
49 exit 1
50 fi
51fi
52
53PWD=`pwd`
54BASENAME=`basename $0`
55BASEDIR=`echo $FULLPATH | sed "s/\/$BASENAME//g"`
56LOGFILE=$BASEDIR/log/_build.preparation.log
57export BASEDIR LOGFILE
58DIR_CHK=$BASEDIR/cache/check
59mkdir $BASEDIR/log/ 2>/dev/null
60
61# Include funtions
62. tools/make-functions
63
64if [ -f .config ]; then
65 . .config
66else
67 make_config
68fi
69
70prepareenv() {
71 ############################################################################
72 # #
73 # Are we running the right shell? #
74 # #
75 ############################################################################
76 if [ ! "$BASH" ]; then
77 exiterror "BASH environment variable is not set. You're probably running the wrong shell."
78 fi
79
80 if [ -z "${BASH_VERSION}" ]; then
81 exiterror "Not running BASH shell."
82 fi
83
84
85 ############################################################################
86 # #
87 # Trap on emergency exit #
88 # #
89 ############################################################################
90 trap "exiterror 'Build process interrupted'" SIGINT SIGTERM SIGKILL SIGSTOP SIGQUIT
91
92
93 ############################################################################
94 # #
95 # Resetting our nice level #
96 # #
97 ############################################################################
98 echo -ne "Resetting our nice level to $NICE" | tee -a $LOGFILE
99 renice $NICE $$ > /dev/null
100 if [ `nice` != "$NICE" ]; then
101 beautify message FAIL
102 exiterror "Failed to set correct nice level"
103 else
104 beautify message DONE
105 fi
106
107
108 ############################################################################
109 # #
110 # Checking if running as root user #
111 # #
112 ############################################################################
113 echo -ne "Checking if we're running as root user" | tee -a $LOGFILE
114 if [ `id -u` != 0 ]; then
115 beautify message FAIL
116 exiterror "Not building as root"
117 else
118 beautify message DONE
119 fi
120
121
122 ############################################################################
123 # #
124 # Checking for necessary temporary space #
125 # #
126 ############################################################################
127 echo -ne "Checking for necessary space on disk $BASE_DEV" | tee -a $LOGFILE
128 BASE_DEV=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $1 }'`
129 BASE_ASPACE=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $4 }'`
130 if (( 2202000 > $BASE_ASPACE )); then
131 BASE_USPACE=`du -skx $BASEDIR | awk '{print $1}'`
132 if (( 2202000 - $BASE_USPACE > $BASE_ASPACE )); then
133 beautify message FAIL
134 exiterror "Not enough temporary space available, need at least 2.1GB on $BASE_DEV"
135 fi
136 else
137 beautify message DONE
138 fi
139
140 ############################################################################
141 # #
142 # Building Linux From Scratch system #
143 # #
144 ############################################################################
145 # Set umask
146 umask 022
147
148 # Set LFS Directory
149 LFS=$BASEDIR/build
150
151 # Check /tools symlink
152 if [ -h /tools ]; then
153 rm -f /tools
154 fi
155 if [ ! -a /tools ]; then
156 ln -s $BASEDIR/build/tools /
157 fi
158 if [ ! -h /tools ]; then
159 exiterror "Could not create /tools symbolic link."
160 fi
161
162 # Setup environment
163 set +h
164 LC_ALL=POSIX
165 MAKETUNING="-j8"
166 export LFS LC_ALL CFLAGS CXXFLAGS MAKETUNING
167 unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
168
169 # Make some extra directories
170 mkdir -p $BASEDIR/build/{tools,etc,usr/src} 2>/dev/null
171 mkdir -p $BASEDIR/build/{dev/{shm,pts},proc,sys}
172 mkdir -p $BASEDIR/{cache,ccache} 2>/dev/null
173 mkdir -p $BASEDIR/build/usr/src/{cache,config,doc,html,langs,lfs,log,src,ccache}
174
175 mknod -m 600 $BASEDIR/build/dev/console c 5 1 2>/dev/null
176 mknod -m 666 $BASEDIR/build/dev/null c 1 3 2>/dev/null
177
178 # Make all sources and proc available under lfs build
179 mount --bind /dev $BASEDIR/build/dev
180 mount --bind /dev/pts $BASEDIR/build/dev/pts
181 mount --bind /dev/shm $BASEDIR/build/dev/shm
182 mount --bind /proc $BASEDIR/build/proc
183 mount --bind /sys $BASEDIR/build/sys
184 mount --bind $BASEDIR/cache $BASEDIR/build/usr/src/cache
185 mount --bind $BASEDIR/ccache $BASEDIR/build/usr/src/ccache
186 mount --bind $BASEDIR/config $BASEDIR/build/usr/src/config
187 mount --bind $BASEDIR/doc $BASEDIR/build/usr/src/doc
188 mount --bind $BASEDIR/html $BASEDIR/build/usr/src/html
189 mount --bind $BASEDIR/langs $BASEDIR/build/usr/src/langs
190 mount --bind $BASEDIR/lfs $BASEDIR/build/usr/src/lfs
191 mount --bind $BASEDIR/log $BASEDIR/build/usr/src/log
192 mount --bind $BASEDIR/src $BASEDIR/build/usr/src/src
193
194 # This is a temporary hack!!!
195 cp -f /bin/hostname /tools/bin/hostname 2>/dev/null
196
197 # Run LFS static binary creation scripts one by one
198 export CCACHE_DIR=$BASEDIR/ccache
199 export CCACHE_HASHDIR=1
200
201 # Remove pre-install list of installed files in case user erase some files before rebuild
202 rm -f $BASEDIR/build/usr/src/lsalr 2>/dev/null
203}
204
205buildtoolchain() {
206 LOGFILE="$BASEDIR/log/_build.toolchain.log"
207 export LOGFILE
208 ORG_PATH=$PATH
209 NATIVEGCC=`gcc --version | grep GCC | awk {'print $3'}`
210 export NATIVEGCC GCCmajor=${NATIVEGCC:0:1} GCCminor=${NATIVEGCC:2:1} GCCrelease=${NATIVEGCC:4:1}
211 lfsmake1 ccache
212 lfsmake1 binutils PASS=1
213 lfsmake1 gcc PASS=1
214 export PATH=$BASEDIR/build/usr/local/bin:$BASEDIR/build/tools/bin:$PATH
215 lfsmake1 linux-libc-header
216 lfsmake1 glibc
217 lfsmake1 cleanup-toolchain PASS=1
218 lfsmake1 tcl
219 lfsmake1 expect
220 lfsmake1 dejagnu
221 lfsmake1 gcc PASS=2
222 lfsmake1 binutils PASS=2
223 lfsmake1 ncurses
224 lfsmake1 bash
225 lfsmake1 bzip2
226 lfsmake1 coreutils
227 lfsmake1 diffutils
228 lfsmake1 findutils
229 lfsmake1 gawk
230 lfsmake1 gettext
231 lfsmake1 grep
232 lfsmake1 gzip
233 lfsmake1 m4
234 lfsmake1 make
235 lfsmake1 patch
236 lfsmake1 perl
237 lfsmake1 sed
238 lfsmake1 tar
239 lfsmake1 texinfo
240 lfsmake1 util-linux
241 lfsmake1 cleanup-toolchain PASS=2
242 export PATH=$ORG_PATH
243}
244
245buildbase() {
246 LOGFILE="$BASEDIR/log/_build.base.log"
247 export LOGFILE
248 lfsmake2 stage2
249# lfsmake2 makedev
250 lfsmake2 linux-libc-header
251 lfsmake2 man-pages
252 lfsmake2 glibc
253 lfsmake2 cleanup-toolchain PASS=3
254 lfsmake2 binutils
255 lfsmake2 gcc
256 lfsmake2 berkeley
257 lfsmake2 coreutils
258 lfsmake2 iana-etc
259 lfsmake2 m4
260 lfsmake2 bison
261 lfsmake2 ncurses
262 lfsmake2 procps
263 lfsmake2 sed
264 lfsmake2 libtool
265 lfsmake2 perl
266 lfsmake2 readline
267 lfsmake2 zlib
268 lfsmake2 autoconf
269 lfsmake2 automake
270 lfsmake2 bash
271 lfsmake2 bzip2
272 lfsmake2 diffutils
273 lfsmake2 e2fsprogs
274 lfsmake2 file
275 lfsmake2 findutils
276 lfsmake2 flex
277 lfsmake2 grub
278 lfsmake2 gawk
279 lfsmake2 gettext
280 lfsmake2 grep
281 lfsmake2 groff
282 lfsmake2 gzip
283 lfsmake2 inetutils
284 lfsmake2 iproute2
285 lfsmake2 kbd
286 lfsmake2 less
287 lfsmake2 make
288 lfsmake2 man
289 lfsmake2 mktemp
290 lfsmake2 modutils
291 lfsmake2 patch
292 lfsmake2 psmisc
293 lfsmake2 shadow
294 lfsmake2 sysklogd
295 lfsmake2 sysvinit
296 lfsmake2 tar
297 lfsmake2 texinfo
298 lfsmake2 udev
299 lfsmake2 util-linux
300 lfsmake2 vim
301####
302# lfsmake2 net-tools
303# lfsmake2 inetutils
304# lfsmake2 ed
305# lfsmake2 procinfo
306}
307
308buildipfire() {
309 LOGFILE="$BASEDIR/log/_build.ipfire.log"
310 export LOGFILE
311 ipfiremake configroot
312 ipfiremake dhcp
313 ipfiremake dhcpcd
314 ipfiremake libusb
315 ipfiremake libpcap
316# Temporary disabled.
317# ipfiremake linux-atm
318 ipfiremake ppp
319 ipfiremake rp-pppoe
320 ipfiremake unzip
321 ipfiremake linux PASS=ipfire SMP=installer
322 ipfiremake linux PASS=ipfire SMP=1
323# ipfiremake 3cp4218 SMP=1
324# ipfiremake amedyn SMP=1
325# ipfiremake cxacru SMP=1
326# ipfiremake eagle SMP=1
327# ipfiremake cnx_pci SMP=1
328# ipfiremake fcdsl SMP=1
329# ipfiremake fcdsl2 SMP=1
330# ipfiremake fcdslsl SMP=1
331# ipfiremake fcdslusb SMP=1
332# ipfiremake fcdslslusb SMP=1
333# ipfiremake fcpci SMP=1
334# ipfiremake fcclassic SMP=1
335# ipfiremake pulsar SMP=1
336# ipfiremake unicorn SMP=1
337# ipfiremake promise-sata-300-tx SMP=1
338 ipfiremake linux PASS=ipfire
339# ipfiremake 3cp4218
340# ipfiremake amedyn
341# ipfiremake cxacru
342# ipfiremake eciadsl
343# ipfiremake eagle
344# ipfiremake speedtouch
345# ipfiremake cnx_pci
346# ipfiremake fcdsl
347# ipfiremake fcdsl2
348# ipfiremake fcdslsl
349# ipfiremake fcdslusb
350# ipfiremake fcdslslusb
351# ipfiremake fcpci
352# ipfiremake fcclassic
353# ipfiremake pulsar
354# ipfiremake unicorn
355# ipfiremake promise-sata-300-tx
356 ipfiremake pcmcia-cs
357 ipfiremake expat
358 ipfiremake gdbm
359 ipfiremake gmp
360 ipfiremake openssl
361 ipfiremake python
362 ipfiremake libnet
363 ipfiremake libpng
364 ipfiremake libtiff
365 ipfiremake libjpeg
366 ipfiremake lcms
367 ipfiremake libmng
368 ipfiremake freetype
369 ipfiremake gd
370 ipfiremake popt
371 ipfiremake slang
372 ipfiremake newt
373 ipfiremake libcap
374 ipfiremake pciutils
375 ipfiremake pcre
376 ipfiremake readline
377 ipfiremake libxml2
378 ipfiremake berkeley
379 ipfiremake BerkeleyDB ## The Perl module
380 ipfiremake mysql
381 ipfiremake saslauthd PASS=1
382 ipfiremake openldap
383 ipfiremake apache2
384 ipfiremake php
385 ipfiremake subversion
386 ipfiremake apache2 PASS=CONFIG
387 ipfiremake arping
388 ipfiremake beep
389 ipfiremake bind
390 ipfiremake capi4k-utils
391 ipfiremake cdrtools
392 ipfiremake dnsmasq
393 ipfiremake dosfstools
394 ipfiremake ethtool
395 ipfiremake ez-ipupdate
396 ipfiremake fcron
397 ipfiremake perl-GD
398 ipfiremake gnupg
399 ipfiremake hdparm
400 ipfiremake ibod
401 ipfiremake initscripts
402 ipfiremake iptables
403 ipfiremake ipac-ng
404 ipfiremake ipaddr
405 ipfiremake iproute2
406 ipfiremake iptstate
407 ipfiremake iputils
408 ipfiremake l7-protocols
409 ipfiremake isapnptools
410 ipfiremake isdn4k-utils
411 ipfiremake kudzu
412 ipfiremake logrotate
413 ipfiremake logwatch
414 ipfiremake mingetty
415 ipfiremake misc-progs
416 ipfiremake mtools
417 ipfiremake nano
418 ipfiremake nash
419 ipfiremake nasm
420 ipfiremake URI
421 ipfiremake HTML-Tagset
422 ipfiremake HTML-Parser
423 ipfiremake Compress-Zlib
424 ipfiremake Digest
425 ipfiremake Digest-SHA1
426 ipfiremake Digest-HMAC
427 ipfiremake libwww-perl
428 ipfiremake Net-DNS
429 ipfiremake Net-IPv4Addr
430 ipfiremake Net_SSLeay
431 ipfiremake IO-Stringy
432 ipfiremake Unix-Syslog
433 ipfiremake Mail-Tools
434 ipfiremake MIME-Tools
435 ipfiremake Net-Server
436 ipfiremake Convert-TNEF
437 ipfiremake Convert-UUlib
438 ipfiremake Archive-Tar
439 ipfiremake Archive-Zip
440 ipfiremake Text-Tabs+Wrap
441 ipfiremake Locale-Country
442 ipfiremake GeoIP
443 ipfiremake fwhits
444 ipfiremake noip_updater
445 ipfiremake ntp
446 ipfiremake oinkmaster
447 ipfiremake openssh
448 ipfiremake openswan
449 ipfiremake pptpclient
450 ipfiremake rrdtool
451 ipfiremake setserial
452 ipfiremake setup
453 ipfiremake snort
454 ipfiremake squid
455 ipfiremake squid-graph
456 ipfiremake squidguard
457 ipfiremake tcpdump
458 ipfiremake traceroute
459 ipfiremake vlan
460 ipfiremake wireless
461 ipfiremake libsafe
462 ipfiremake 3c5x9setup
463 ipfiremake pakfire
464 ipfiremake startscripts
465 ipfiremake java
466 ipfiremake bootsplash
467 ipfiremake spandsp
468 ipfiremake lzo
469 ipfiremake openvpn
470 ipfiremake pkg-config
471 ipfiremake glib
472 ipfiremake pam
473 ipfiremake pammysql
474 ipfiremake saslauthd PASS=2
475 ipfiremake xinetd
476 ipfiremake ghostscript
477 ipfiremake cups
478 ipfiremake samba
479 ipfiremake sudo
480 ipfiremake mc
481 ipfiremake wget
482 ipfiremake wput
483 ipfiremake bridge-utils
484 ipfiremake screen
485 ipfiremake hddtemp
486 ipfiremake smartmontools
487 ipfiremake htop
488 ipfiremake lynx
489 ipfiremake postfix
490 ipfiremake procmail
491 ipfiremake fetchmail
492 ipfiremake cyrusimap
493 ipfiremake webcyradm
494 ipfiremake mailx
495 ipfiremake clamav
496 ipfiremake razor
497 ipfiremake spamassassin
498# ipfiremake amavisd
499 ipfiremake stund
500 ipfiremake zaptel
501 ipfiremake libpri
502 ipfiremake bristuff
503 ipfiremake asterisk
504 ipfiremake mpg123
505 ipfiremake libmad
506 ipfiremake libogg
507 ipfiremake libvorbis
508 ipfiremake lame
509 ipfiremake xvid
510 ipfiremake mpeg2dec
511 ipfiremake ffmpeg
512 ipfiremake sox
513 ipfiremake gnump3d
514 ipfiremake videolan
515 ipfiremake applejuice
516 ipfiremake ocaml
517 ipfiremake mldonkey
518 ipfiremake ntop
519 ipfiremake rsync
520 ipfiremake tcpwrapper
521 ipfiremake portmap
522 ipfiremake nfs
523 ipfiremake nmap
524 ipfiremake mbmon
525 ipfiremake iftop
526 ipfiremake ncftp
527 ipfiremake cftp
528 ipfiremake etherwake
529 ipfiremake ethereal
530 ipfiremake tftp-hpa
531 ipfiremake iptraf
532 ipfiremake nagios
533 ipfiremake yasuc
534}
535
536buildinstaller() {
537 # Run installer scripts one by one
538 LOGFILE="$BASEDIR/log/_build.installer.log"
539 export LOGFILE
540 ipfiremake syslinux
541 ipfiremake as86
542 ipfiremake mbr
543 ipfiremake uClibc
544 installmake busybox
545 installmake sysvinit
546 installmake e2fsprogs
547 installmake misc-progs
548 installmake slang
549 installmake util-linux
550 installmake newt
551 installmake pciutils
552 installmake pcmcia-cs
553 installmake kbd
554 installmake installer
555 installmake scsi.img
556 installmake driver.img
557 installmake initrd
558 installmake boot.img
559}
560
561buildpackages() {
562 LOGFILE="$BASEDIR/log/_build.packages.log"
563 export LOGFILE
564 echo "... see detailed log in _build.*.log files" >> $LOGFILE
565 echo -ne "`date -u '+%b %e %T'`: Stage5 packages build \n" | tee -a $LOGFILE
566 # Strip files
567 echo "`date -u '+%b %e %T'`: Stripping files" | tee -a $LOGFILE
568 find $LFS/lib $LFS/usr/lib $LFS/usr/share/rrdtool-* $LFS/install ! -type l \( -name '*.so' -o -name '*.so[\.0-9]*' \) \
569 ! -name 'libc.so' ! -name 'libpthread.so' ! -name 'libcrypto.so.0.9.7.sha1' \
570 -exec $LFS/tools/bin/strip --strip-all {} \; >> $LOGFILE 2>&1
571 # add -ls before -exec if you want to verify what files are stripped
572
573 find $LFS/{,s}bin $LFS/usr/{,s}bin $LFS/usr/local/{,s}bin ! -type l \
574 -exec file {} \; | grep " ELF " | cut -f1 -d ':' | xargs $LFS/tools/bin/strip --strip-all >> $LOGFILE 2>&1
575 # there add -v to strip to verify
576
577 if [ 'i386' = $MACHINE ]; then
578 # Create fcdsl packages
579 echo "`date -u '+%b %e %T'`: Building fcdsl tgz" | tee -a $LOGFILE
580 cp $LFS/install/images/fcdsl/license.txt $LFS >> $LOGFILE 2>&1
581 touch $LFS/var/run/{need-depmod-$KVER,need-depmod-$KVER-smp}
582 cd $LFS && tar cvfz $LFS/install/images/$SNAME-fcdsl-$VERSION.$MACHINE.tgz \
583 lib/modules/$KVER/misc/fcdsl*.o.gz \
584 lib/modules/$KVER-smp/misc/fcdsl*.o.gz \
585 usr/lib/isdn/{fds?base.bin,fd?ubase.frm} \
586 etc/fcdsl/fcdsl*.conf \
587 etc/drdsl/{drdsl,drdsl.ini} \
588 license.txt \
589 var/run/{need-depmod-$KVER,need-depmod-$KVER-smp} >> $LOGFILE 2>&1
590 rm -f $LFS/license.txt >> $LOGFILE 2>&1
591 cd $BASEDIR
592 fi
593
594 # Generating list of packages used
595 echo "`date -u '+%b %e %T'`: Generating packages list from logs" | tee -a $LOGFILE
596 rm -f $BASEDIR/doc/packages-list
597 for i in `ls -1tr $BASEDIR/log/[^_]*`; do
598 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
599 echo "* `basename $i`" >>$BASEDIR/doc/packages-list
600 fi
601 done
602 echo "== List of softwares used to build $NAME Version: $VERSION ==" > $BASEDIR/doc/packages-list.txt
603 grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|ipfire$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$\|.tgz$\|-config$' \
604 $BASEDIR/doc/packages-list | sort >> $BASEDIR/doc/packages-list.txt
605 rm -f $BASEDIR/doc/packages-list
606 # packages-list.txt is ready to be displayed for wiki page
607
608 # Create ISO for CDROM
609 ipfiremake cdrom
610 rm -f $LFS/install/images/*usb*
611 cp $LFS/install/images/{*.iso,*.tgz} $BASEDIR >> $LOGFILE 2>&1
612
613 ipfirepackages
614
615 # Cleanup
616 stdumount
617 rm -rf $BASEDIR/build/tmp/*
618
619 # Generating total list of files
620 echo "`date -u '+%b %e %T'`: Generating files list from logs" | tee -a $LOGFILE
621 rm -f $BASEDIR/log/FILES
622 for i in `ls -1tr $BASEDIR/log/[^_]*`; do
623 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
624 echo "##" >>$BASEDIR/log/FILES
625 echo "## `basename $i`" >>$BASEDIR/log/FILES
626 echo "##" >>$BASEDIR/log/FILES
627 cat $i | sed "s%^\./%#%" | sort >> $BASEDIR/log/FILES
628 fi
629 done
630 cd $BASEDIR/packages; ls -w1 *.ipfire | awk -F ".ipfire" '{ print $1 }' > $BASEDIR/packages/packages_list.txt
631 echo -n "###EOF###" >> $BASEDIR/packages/packages_list.txt
632
633 cd $PWD
634
635}
636
637ipfirepackages() {
638 if [ -d "$BASEDIR/packages" ]; then
639 for i in `ls $BASEDIR/packages`; do
640 touch $BASEDIR/build/install/packages/$i.empty
641 done
642 fi
643# ipfiredist amavisd
644 ipfiredist applejuice
645 ipfiredist asterisk
646 ipfiredist clamav
647 ipfiredist cups
648 ipfiredist cyrusimap
649 ipfiredist fetchmail
650 ipfiredist ffmpeg
651 ipfiredist gnump3d
652 ipfiredist iptraf
653 ipfiredist java
654 ipfiredist lame
655 ipfiredist libmad
656 ipfiredist libogg
657 ipfiredist libtiff
658 ipfiredist libvorbis
659 ipfiredist mailx
660 ipfiredist mldonkey
661 ipfiredist mpeg2dec
662 ipfiredist nagios
663 ipfiredist nfs
664 ipfiredist nmap
665 ipfiredist ntop
666 ipfiredist portmap
667 ipfiredist postfix
668 ipfiredist procmail
669 ipfiredist samba
670 ipfiredist sox
671 ipfiredist spamassassin
672 ipfiredist subversion
673 ipfiredist videolan
674 ipfiredist webcyradm
675 ipfiredist xvid
676 ipfiredist yasuc
677 test -d $BASEDIR/packages || mkdir $BASEDIR/packages
678 mv -f $LFS/install/packages/*.{ipfire,md5} $BASEDIR/packages >> $LOGFILE 2>&1
679 rm -rf $BASEDIR/build/install/packages/*
680}
681
682# See what we're supposed to do
683case "$1" in
684build)
685 clear
686 BUILDMACHINE=`uname -m`
687 PACKAGE=`ls -v -r $BASEDIR/cache/toolchains/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz 2> /dev/null | head -n 1`
688 #only restore on a clean disk
689 if [ ! -f log/cleanup-toolchain-2-tools ]; then
690 if [ ! -n "$PACKAGE" ]; then
691 beautify build_stage "Full toolchain compilation - Native GCC: `gcc --version | grep GCC | awk {'print $3'}`"
692 prepareenv
693 buildtoolchain
694 else
695 PACKAGENAME=${PACKAGE%.tar.gz}
696 beautify build_stage "Packaged toolchain compilation"
697 if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then
698 tar zxf $PACKAGE
699 prepareenv
700 else
701 exiterror "$PACKAGENAME md5 did not match, check downloaded package"
702 fi
703 fi
704 else
705 echo -n "Using installed toolchain" | tee -a $LOGFILE
706 beautify message SKIP
707 prepareenv
708 fi
709
710 beautify build_stage "Building base"
711 buildbase
712
713 beautify build_stage "Building IPFire"
714 buildipfire
715
716 # Setzen des IPFire Builds
717 if [ "$FIREBUILD" ]; then
718 echo "$FIREBUILD" > $BASEDIR/build/var/ipfire/firebuild
719 else
720 echo "_(OvO)_" > $BASEDIR/build/var/ipfire/firebuild
721 fi
722
723 beautify build_stage "Building installer"
724 buildinstaller
725
726 beautify build_stage "Building packages"
727 buildpackages
728 ;;
729shell)
730 # enter a shell inside LFS chroot
731 # may be used to changed kernel settings
732 prepareenv
733 entershell
734 ;;
735changelog)
736 echo -n "Loading new Changelog from SVN: "
737 svn log http://svn.ipfire.eu/svn/ipfire > doc/ChangeLog
738 echo "Finished!"
739 ;;
740clean)
741 for i in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do
742 $LOSETUP -d $i 2>/dev/null
743 done
744 for i in `mount | grep $BASEDIR | cut -d " " -f 1`; do
745 umount $i
746 done
747 stdumount
748 for i in `seq 0 7`; do
749 if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
750 umount /dev/loop${i} 2>/dev/null;
751 losetup -d /dev/loop${i} 2>/dev/null;
752 fi;
753 done
754 rm -rf $BASEDIR/build
755 rm -rf $BASEDIR/cdrom
756 rm -rf $BASEDIR/packages
757 rm -rf $BASEDIR/log
758 if [ -h /tools ]; then
759 rm -f /tools
760 fi
761 ;;
762newpak)
763 # create structure for a new package
764 echo -e "Name of the new package: $2"
765 if [ ! -f "lfs/$2" ]; then
766 echo "`date -u '+%b %e %T'`: Creating directory src/paks/$2"
767 mkdir -p src/paks/$2
768 cd src/paks/$2
769 echo "`date -u '+%b %e %T'`: Creating files"
770 cp $BASEDIR/lfs/postfix $BASEDIR/lfs/$2
771
772 touch ROOTFILES
773 touch {,un}install.sh
774 ## install.sh
775 echo '#!/bin/bash' > install.sh
776 echo '#' >> install.sh
777 echo '#################################################################' >> install.sh
778 echo '# #' >> install.sh
779 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> install.sh
780 echo '# #' >> install.sh
781 echo '#################################################################' >> install.sh
782 echo '#' >> install.sh
783 echo '# Extract the files' >> install.sh
784 echo 'tar xfz files.tgz -C /' >> install.sh
785 echo 'cp -f ROOTFILES /opt/pakfire/installed/ROOTFILES.$2' >> install.sh
786 ## uninstall.sh
787 echo '#!/bin/bash' > uninstall.sh
788 echo '#################################################################' >> uninstall.sh
789 echo '# #' >> uninstall.sh
790 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> uninstall.sh
791 echo '# #' >> uninstall.sh
792 echo '#################################################################' >> uninstall.sh
793 echo '#' >> uninstall.sh
794 echo '# Delete the files' >> uninstall.sh
795 echo '## Befehl fehlt noch' >> uninstall.sh
796 echo 'rm -f /opt/pakfire/installed/ROOTFILES.$2' >> uninstall.sh
797 echo "`date -u '+%b %e %T'`: Adding files to SVN"
798 cd - && svn add lfs/$2 && svn add src/paks/$2
799
800 echo -n "Do you want to remove the folders? [y/n]"
801 read REM
802 if [ "$REM" == "y" ]; then
803 echo "Removing the folders..."
804 svn del src/paks/$2 --force
805 else
806 echo "Folders are kept."
807 fi
808 else
809 echo "$2 already exists"
810 fi
811 exit 0
812 ;;
813prefetch)
814 if [ ! -d $BASEDIR/cache ]; then
815 mkdir $BASEDIR/cache
816 fi
817 mkdir -p $BASEDIR/log
818 echo -e "${BOLD}Preload all source files${NORMAL}" | tee -a $LOGFILE
819 FINISHED=0
820 cd $BASEDIR/lfs
821 for c in `seq $MAX_RETRIES`; do
822 if (( FINISHED==1 )); then
823 break
824 fi
825 FINISHED=1
826 cd $BASEDIR/lfs
827 for i in *; do
828 if [ -f "$i" -a "$i" != "Config" ]; then
829 echo -ne "Loading $i"
830 make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t ($c/$MAX_RETRIES)" download >> $LOGFILE 2>&1
831 if [ $? -ne 0 ]; then
832 beautify message FAIL
833 FINISHED=0
834 else
835 if [ $c -eq 1 ]; then
836 beautify message DONE
837 fi
838 fi
839 fi
840 done
841 done
842 echo -e "${BOLD}***Verifying md5sums${NORMAL}"
843 ERROR=0
844 for i in *; do
845 if [ -f "$i" -a "$i" != "Config" ]; then
846 make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t " md5 >> $LOGFILE 2>&1
847 if [ $? -ne 0 ]; then
848 echo -ne "MD5 difference in lfs/$i"
849 beautify message FAIL
850 ERROR=1
851 fi
852 fi
853 done
854 if [ $ERROR -eq 0 ]; then
855 echo -ne "${BOLD}all files md5sum match${NORMAL}"
856 beautify message DONE
857 else
858 echo -ne "${BOLD}not all files were correctly download${NORMAL}"
859 beautify message FAIL
860 fi
861 cd - >/dev/null 2>&1
862 ;;
863toolchain)
864 clear
865 prepareenv
866 beautify build_stage "Toolchain compilation - Native GCC: `gcc --version | grep GCC | awk {'print $3'}`"
867 buildtoolchain
868 BUILDMACHINE=`uname -m`
869 echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for $BUILDMACHINE" | tee -a $LOGFILE
870 test -d $BASEDIR/cache/toolchains || mkdir $BASEDIR/cache/toolchains
871 cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache/toolchains/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \
872 build/{bin,etc,usr/bin,usr/local} \
873 build/tools/{bin,etc,*-linux-gnu,include,lib,libexec,sbin,share,var} \
874 log >> $LOGFILE
875 md5sum cache/toolchains/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \
876 > cache/toolchains/$SNAME-$VERSION-toolchain-$BUILDMACHINE.md5
877 stdumount
878 ;;
879gettoolchain)
880 BUILDMACHINE=`uname -m`
881 # arbitrary name to be updated in case of new toolchain package upload
882 PACKAGE=$SNAME-$VERSION-toolchain-$BUILDMACHINE
883 if [ ! -f $BASEDIR/cache/toolchains/$PACKAGE.tar.gz ]; then
884 URL_IPFIRE=`grep URL_IPFIRE lfs/Config | awk '{ print $3 }'`
885 test -d $BASEDIR/cache/toolchains || mkdir $BASEDIR/cache/toolchains
886 echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for $BUILDMACHINE" | tee -a $LOGFILE
887 cd $BASEDIR/cache/toolchains
888 wget $URL_IPFIRE/toolchains/$PACKAGE.tar.gz $URL_IPFIRE/toolchains/$PACKAGE.md5 >& /dev/null
889 if [ $? -ne 0 ]; then
890 echo "`date -u '+%b %e %T'`: error downloading toolchain for $BUILDMACHINE machine" | tee -a $LOGFILE
891 else
892 if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then
893 echo "`date -u '+%b %e %T'`: toolchain md5 ok" | tee -a $LOGFILE
894 else
895 exiterror "$PACKAGE.md5 did not match, check downloaded package"
896 fi
897 fi
898 else
899 echo "Toolchain is already downloaded. Exiting..."
900 fi
901 ;;
902othersrc)
903 prepareenv
904 echo -ne "`date -u '+%b %e %T'`: Build sources iso for $MACHINE" | tee -a $LOGFILE
905 chroot $LFS /tools/bin/env -i HOME=/root \
906 TERM=$TERM PS1='\u:\w\$ ' \
907 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \
908 VERSION=$VERSION NAME="$NAME" SNAME="$SNAME" MACHINE=$MACHINE \
909 /bin/bash -x -c "cd /usr/src/lfs && make -f sources-iso LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
910 mv $LFS/install/images/ipfire-* $BASEDIR >> $LOGFILE 2>&1
911 if [ $? -eq "0" ]; then
912 beautify message DONE
913 else
914 beautify message FAIL
915 fi
916 stdumount
917 ;;
918svn)
919 case "$2" in
920 update|up)
921 # clear
922 echo -ne "Loading the latest source files...\n"
923 if [ $3 ]; then
924 svn update -r $3 | tee -a $PWD/log/_build.svn.update.log
925 else
926 svn update | tee -a $PWD/log/_build.svn.update.log
927 fi
928 if [ $? -eq "0" ]; then
929 beautify message DONE
930 else
931 beautify message FAIL
932 exit 1
933 fi
934 echo -ne "Writing the svn-info to a file"
935 svn info > $PWD/svn_status
936 if [ $? -eq "0" ]; then
937 beautify message DONE
938 else
939 beautify message FAIL
940 exit 1
941 fi
942 chmod 755 $0
943 exit 0
944 ;;
945 commit|ci)
946 clear
947 if [ -e /sbin/yast ]; then
948 if [ "`echo $SVN_REVISION | cut -c 3`" -eq "0" ]; then
949 $0 changelog
950 fi
951 fi
952 echo "Upload the changed files..."
953 sleep 1
954 svn commit
955 $0 svn up
956 ;;
957 dist)
958 if [ $3 ]; then
959 SVN_REVISION=$3
960 fi
961 if [ -f ipfire-source-r$SVN_REVISION.tar.gz ]; then
962 echo -ne "REV $SVN_REVISION: SKIPPED!\n"
963 exit 0
964 fi
965 echo -en "REV $SVN_REVISION: Downloading..."
966 svn export http://svn.ipfire.eu/svn/ipfire/trunk ipfire-source/ --force > /dev/null
967 svn log http://svn.ipfire.eu/svn/ipfire/trunk -r 1:$SVN_REVISION > ipfire-source/Changelog
968 #svn info http://svn.ipfire.eu/svn/ipfire/trunk -r $SVN_REVISION > ipfire-source/svn_status
969 evaluate 1
970
971 echo -en "REV $SVN_REVISION: Compressing files..."
972 if [ -e ipfire-source/trunk/make.sh ]; then
973 chmod 755 ipfire-source/trunk/make.sh
974 fi
975 tar cfz ipfire-source-r$SVN_REVISION.tar.gz ipfire-source
976 evaluate 1
977 echo -en "REV $SVN_REVISION: Cleaning up..."
978 rm ipfire-source/ -r
979 evaluate 1
980 ;;
981 diff|di)
982 echo -ne "Make a local diff to last svn revision"
983 svn diff > ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff
984 evaluate 1
985 echo "Diff was successfully saved to ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff"
986 ;;
987 esac
988 ;;
989uploadsrc)
990 PWD=`pwd`
991 cd $BASEDIR/cache/
992 echo -e "Uploading cache to ftp server:"
993 ncftpls -u $IPFIRE_FTP_USER_INT -p $IPFIRE_FTP_PASS_INT ftp://$IPFIRE_FTP_URL_INT$IPFIRE_FTP_PATH_INT/ > /var/tmp/ftplist
994 for i in *; do
995 if [ "$i" == "toolchains" ]; then continue; fi
996 grep -q $i /var/tmp/ftplist
997 if [ "$?" -ne "0" ]; then
998 echo -ne "$i"
999 ncftpput -bb -u $IPFIRE_FTP_USER_INT -p $IPFIRE_FTP_PASS_INT $IPFIRE_FTP_URL_INT $IPFIRE_FTP_PATH_INT/ $i > /dev/null 2>&1
1000 if [ "$?" -eq "0" ]; then
1001 beautify message DONE
1002 else
1003 beautify message FAIL
1004 fi
1005 fi
1006 done
1007 rm -f /var/tmp/ftplist
1008 UL_TIME_START=`date +'%s'`
1009 ncftpbatch -d > /dev/null 2>&1
1010 while ps acx | grep -q ncftpbatch
1011 do
1012 UL_TIME=$(expr `date +'%s'` - $UL_TIME_START)
1013 echo -ne "\r ${UL_TIME}s : Upload is running..."
1014 sleep 1
1015 done
1016 beautify message DONE
1017 cd $PWD
1018 exit 0
1019 ;;
1020upload)
1021 case "$2" in
1022 iso)
1023 echo -e "Uploading the iso to $IPFIRE_FTP_URL_EXT."
1024 cat <<EOF > .ftp-commands
1025mkdir $IPFIRE_FTP_PATH_EXT
1026ls -lah
1027quit
1028EOF
1029 ncftp -u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT < .ftp-commands
1030 rm -f .ftp-commands
1031 md5sum ipfire-install-$VERSION.i386.iso > ipfire-install-$VERSION.i386.iso.md5
1032 ncftpput -u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT $IPFIRE_FTP_PATH_EXT/ ipfire-install-$VERSION.i386.iso
1033 ncftpput -u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT $IPFIRE_FTP_PATH_EXT/ ipfire-install-$VERSION.i386.iso.md5
1034 ncftpput -u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT $IPFIRE_FTP_PATH_EXT/ ipfire-source-r$SVN_REVISION.tar.gz
1035 ncftpput -u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT $IPFIRE_FTP_PATH_EXT/ svn_status
1036 if [ "$?" -eq "0" ]; then
1037 echo -e "The iso of Revision $SVN_REVISION was successfully uploaded to $IPFIRE_FTP_URL_EXT$IPFIRE_FTP_PATH_EXT/."
1038 else
1039 echo -e "There was an error while uploading the iso to the ftp server."
1040 exit 1
1041 fi
1042 if [ "$3" = "--with-sources-cd" ]; then
1043 ncftpput -u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT $IPFIRE_FTP_PATH_EXT/ ipfire-sources-cd-$VERSION.$MACHINE.iso
1044 fi
1045 ;;
1046 paks)
1047 cat <<EOF > .ftp-commands
1048mkdir $IPFIRE_FTP_PATH_PAK
1049ls -lah
1050quit
1051EOF
1052 ncftp -u $IPFIRE_FTP_USER_PAK -p $IPFIRE_FTP_PASS_PAK $IPFIRE_FTP_URL_PAK < .ftp-commands
1053 rm -f .ftp-commands
1054 ncftpput -z -u $IPFIRE_FTP_USER_PAK -p $IPFIRE_FTP_PASS_PAK $IPFIRE_FTP_URL_PAK $IPFIRE_FTP_PATH_PAK/ packages/*
1055 if [ "$?" -eq "0" ]; then
1056 echo -e "The packages were successfully uploaded to $IPFIRE_FTP_URL_PAK$IPFIRE_FTP_PATH_PAK/."
1057 else
1058 echo -e "There was an error while uploading the packages to the ftp server."
1059 exit 1
1060 fi
1061 ;;
1062 esac
1063 ;;
1064batch)
1065 if [ "$2" -eq "--background" ]; then
1066 batch_script
1067 exit $?
1068 fi
1069 if [ `screen -ls | grep -q ipfire` ]; then
1070 echo "Build is already running, sorry!"
1071 exit 1
1072 else
1073 if [ "$2" = "--rebuild" ]; then
1074 export IPFIRE_REBUILD=1
1075 echo "REBUILD!"
1076 else
1077 export IPFIRE_REBUILD=0
1078 fi
1079 echo -en "${BOLD}***IPFire-Batch-Build is starting...${NORMAL}"
1080 screen -dmS ipfire $0 batch --background
1081 evaluate 1
1082 exit 0
1083 fi
1084 ;;
1085watch)
1086 watch_screen
1087 ;;
1088*)
1089 clear
1090 svn info
1091 select name in "Exit" "IPFIRE: Prefetch" "IPFIRE: Build (silent)" "IPFIRE: Watch Build" "IPFIRE: Batch" "IPFIRE: Clean" "SVN: Commit" "SVN: Update" "SVN: Status" "SVN: Diff" "LOG: Tail" "Help"
1092 do
1093 case $name in
1094 "IPFIRE: Prefetch")
1095 $0 prefetch
1096 ;;
1097 "IPFIRE: Build (silent)")
1098 $0 build-silent
1099 ;;
1100 "IPFIRE: Watch Build")
1101 $0 watch
1102 ;;
1103 "IPFIRE: Batch")
1104 $0 batch
1105 ;;
1106 "IPFIRE: Clean")
1107 $0 clean
1108 ;;
1109 "SVN: Commit")
1110 if [ -f /usr/bin/mcedit ]; then
1111 export EDITOR=/usr/bin/mcedit
1112 fi
1113 if [ -f /usr/bin/nano ]; then
1114 export EDITOR=/usr/bin/nano
1115 fi
1116 $0 svn commit
1117 $0 uploadsrc
1118 ;;
1119 "SVN: Update")
1120 $0 svn update
1121 ;;
1122 "SVN: Status")
1123 svn status # | grep -v ^?
1124 ;;
1125 "SVN: Diff")
1126 $0 svn diff
1127 ;;
1128 "Help")
1129 echo "Usage: $0 {build|changelog|clean|gettoolchain|newpak|prefetch|shell|sync|toolchain}"
1130 cat doc/make.sh-usage
1131 ;;
1132 "LOG: Tail")
1133 tail -f log/_*
1134 ;;
1135 "Exit")
1136 break
1137 ;;
1138 esac
1139 done
1140 ;;
1141esac