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