Update:
[ipfire-2.x.git] / make.sh
CommitLineData
df5e82b3
MT
1#!/bin/bash
2#
3############################################################################
4# #
f8e5510c 5# This file is part of the IPFire Firewall. #
df5e82b3 6# #
f8e5510c 7# IPFire is free software; you can redistribute it and/or modify #
df5e82b3
MT
8# it under the terms of the GNU General Public License as published by #
9# the Free Software Foundation; either version 2 of the License, or #
10# (at your option) any later version. #
11# #
f8e5510c 12# IPFire is distributed in the hope that it will be useful, #
df5e82b3
MT
13# but WITHOUT ANY WARRANTY; without even the implied warranty of #
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15# GNU General Public License for more details. #
16# #
17# You should have received a copy of the GNU General Public License #
f8e5510c 18# along with IPFire; if not, write to the Free Software #
df5e82b3
MT
19# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
20# #
f8e5510c 21# Copyright (C) 2006 IPFire-Team <entwickler@ipfire.org>. #
df5e82b3
MT
22# #
23############################################################################
df5e82b3
MT
24#
25
f8e5510c 26 NAME="IPFire" # Software name
3ea75603 27 SNAME="ipfire" # Short name
e3a8510a 28 VERSION="2.0" # Version number
0deae25a 29 SLOGAN="www.ipfire.org" # Software slogan
3ea75603 30 CONFIG_ROOT=/var/ipfire # Configuration rootdir
df5e82b3 31 NICE=10
0eab8e84 32 MAX_RETRIES=3 # prefetch/check loop
df5e82b3
MT
33 KVER=`grep --max-count=1 VER lfs/linux | awk '{ print $3 }'`
34 MACHINE=`uname -m`
cc0e56be 35 SVN_REVISION=`svn info | grep Revision | cut -c 11-`
df5e82b3 36
7476f476
HS
37 # Setzen des IPFire Builds
38 if [ -e ./.svn ]; then
39 FIREBUILD=`cat .svn/entries |sed -n 's/^[ \t]*revision=\"// p' | sed -n 's/\".*$// p'`
7476f476
HS
40 fi
41
df5e82b3
MT
42 # Debian specific settings
43 if [ ! -e /etc/debian_version ]; then
44 FULLPATH=`which $0`
45 else
46 if [ -x /usr/bin/realpath ]; then
47 FULLPATH=`/usr/bin/realpath $0`
48 else
49 echo "ERROR: Need to do apt-get install realpath"
50 exit 1
51 fi
52 fi
53
df5e82b3
MT
54 PWD=`pwd`
55 BASENAME=`basename $0`
56 BASEDIR=`echo $FULLPATH | sed "s/\/$BASENAME//g"`
57 LOGFILE=$BASEDIR/log/_build.preparation.log
58 export BASEDIR LOGFILE
59 DIR_CHK=$BASEDIR/cache/check
60 mkdir $BASEDIR/log/ 2>/dev/null
61
cc0e56be
MT
62 if [ -f .config ]; then
63 . .config
64 fi
65
df5e82b3 66 if [ 'x86_64' = $MACHINE -o 'i686' = $MACHINE -o 'i586' = $MACHINE -o 'i486' = $MACHINE -o 'i386' = $MACHINE ]; then
c6cb9d25 67 echo "`date -u '+%b %e %T'`: Machine is ix86 (or equivalent)" >> $LOGFILE
df5e82b3
MT
68 MACHINE=i386
69 BUILDTARGET=i386-pc-linux-gnu
70 CFLAGS="-O2 -mcpu=i386 -march=i386 -pipe -fomit-frame-pointer"
71 CXXFLAGS="-O2 -mcpu=i386 -march=i386 -pipe -fomit-frame-pointer"
72 elif [ 'alpha' = $MACHINE ]; then
c6cb9d25 73 echo "`date -u '+%b %e %T'`: Machine is Alpha AXP" >> $LOGFILE
df5e82b3
MT
74 BUILDTARGET=alpha-unknown-linux-gnu
75 CFLAGS="-O2 -mcpu=ev4 -mieee -pipe"
76 CXXFLAGS="-O2 -mcpu=ev4 -mieee -pipe"
77 else
c6cb9d25 78 echo "`date -u '+%b %e %T'`: Can't determine your architecture - $MACHINE" >> $LOGFILE
df5e82b3
MT
79 exit 1
80 fi
81
82# Define immediately
83stdumount() {
84 umount $BASEDIR/build/dev/pts 2>/dev/null;
94025eea
MT
85 umount $BASEDIR/build/proc 2>/dev/null;
86 umount $BASEDIR/build/install/mnt 2>/dev/null;
df5e82b3
MT
87 umount $BASEDIR/build/usr/src/cache 2>/dev/null;
88 umount $BASEDIR/build/usr/src/ccache 2>/dev/null;
89 umount $BASEDIR/build/usr/src/config 2>/dev/null;
94025eea
MT
90 umount $BASEDIR/build/usr/src/doc 2>/dev/null;
91 umount $BASEDIR/build/usr/src/html 2>/dev/null;
df5e82b3 92 umount $BASEDIR/build/usr/src/langs 2>/dev/null;
94025eea
MT
93 umount $BASEDIR/build/usr/src/lfs 2>/dev/null;
94 umount $BASEDIR/build/usr/src/log 2>/dev/null;
95 umount $BASEDIR/build/usr/src/src 2>/dev/null;
df5e82b3
MT
96}
97
98exiterror() {
99 stdumount
100 for i in `seq 0 7`; do
101 if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
102 losetup -d /dev/loop${i} 2>/dev/null
103 fi;
104 done
105 echo "ERROR: $*"
106 echo " Check $LOGFILE for errors if applicable"
107 exit 1
108}
109
110entershell() {
111 if [ ! -e $BASEDIR/build/usr/src/lfs/ ]; then
112 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/"
113 fi
114 echo "Entering to a shell inside LFS chroot, go out with exit"
115 chroot $LFS /tools/bin/env -i HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
116 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
117 VERSION=$VERSION CONFIG_ROOT=$CONFIG_ROOT \
118 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
119 CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" \
120 CCACHE_DIR=/usr/src/ccache \
121 CCACHE_HASHDIR=1 \
122 KVER=$KVER \
123 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
124 KGCC="ccache /usr/bin/gcc" \
125 /tools/bin/bash
126 if [ $? -ne 0 ]; then
127 exiterror "chroot error"
128 else
129 stdumount
130 fi
131}
132
133prepareenv() {
134 ############################################################################
135 # #
136 # Are we running the right shell? #
137 # #
138 ############################################################################
139 if [ ! "$BASH" ]; then
140 exiterror "BASH environment variable is not set. You're probably running the wrong shell."
141 fi
142
143 if [ -z "${BASH_VERSION}" ]; then
144 exiterror "Not running BASH shell."
145 fi
146
147
148 ############################################################################
149 # #
150 # Trap on emergency exit #
151 # #
152 ############################################################################
153 trap "exiterror 'Build process interrupted'" SIGINT SIGTERM SIGKILL SIGSTOP SIGQUIT
154
155
156 ############################################################################
157 # #
158 # Resetting our nice level #
159 # #
160 ############################################################################
161 echo "`date -u '+%b %e %T'`: Resetting our nice level to $NICE" | tee -a $LOGFILE
162 renice $NICE $$ > /dev/null
163 if [ `nice` != "$NICE" ]; then
164 exiterror "Failed to set correct nice level"
165 fi
166
167 ############################################################################
168 # #
169 # Checking if running as root user #
170 # #
171 ############################################################################
172 echo "`date -u '+%b %e %T'`: Checking if we're running as root user" | tee -a $LOGFILE
173 if [ `id -u` != 0 ]; then
174 exiterror "Not building as root"
175 fi
176
177
178 ############################################################################
179 # #
180 # Checking for necessary temporary space #
181 # #
182 ############################################################################
183 echo "`date -u '+%b %e %T'`: Checking for necessary space on disk $BASE_DEV" | tee -a $LOGFILE
184 BASE_DEV=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $1 }'`
185 BASE_ASPACE=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $4 }'`
186 if (( 2202000 > $BASE_ASPACE )); then
187 BASE_USPACE=`du -skx $BASEDIR | awk '{print $1}'`
188 if (( 2202000 - $BASE_USPACE > $BASE_ASPACE )); then
189 exiterror "Not enough temporary space available, need at least 2.1GB on $BASE_DEV"
190 fi
191 fi
192
193 ############################################################################
194 # #
195 # Building Linux From Scratch system #
196 # #
197 ############################################################################
198 echo "`date -u '+%b %e %T'`: Building Linux From Scratch system" | tee -a $LOGFILE
199
200 # Set umask
201 umask 022
202
203 # Set LFS Directory
204 LFS=$BASEDIR/build
205
206 # Check /tools symlink
207 if [ -h /tools ]; then
208 rm -f /tools
209 fi
210 if [ ! -a /tools ]; then
211 ln -s $BASEDIR/build/tools /
212 fi
213 if [ ! -h /tools ]; then
214 exiterror "Could not create /tools symbolic link."
215 fi
216
217 # Setup environment
218 set +h
219 LC_ALL=POSIX
220 export LFS LC_ALL CFLAGS CXXFLAGS
221 unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
222
223 # Make some extra directories
224 mkdir -p $BASEDIR/build/{tools,etc,usr/src} 2>/dev/null
225 mkdir -p $BASEDIR/{cache,ccache} 2>/dev/null
226 mkdir -p $BASEDIR/build/dev/pts $BASEDIR/build/proc $BASEDIR/build/usr/src/{cache,config,doc,html,langs,lfs,log,src,ccache}
227
228 # Make all sources and proc available under lfs build
229 mount --bind /dev/pts $BASEDIR/build/dev/pts
230 mount --bind /proc $BASEDIR/build/proc
231 mount --bind $BASEDIR/cache $BASEDIR/build/usr/src/cache
232 mount --bind $BASEDIR/ccache $BASEDIR/build/usr/src/ccache
233 mount --bind $BASEDIR/config $BASEDIR/build/usr/src/config
234 mount --bind $BASEDIR/doc $BASEDIR/build/usr/src/doc
235 mount --bind $BASEDIR/html $BASEDIR/build/usr/src/html
236 mount --bind $BASEDIR/langs $BASEDIR/build/usr/src/langs
237 mount --bind $BASEDIR/lfs $BASEDIR/build/usr/src/lfs
238 mount --bind $BASEDIR/log $BASEDIR/build/usr/src/log
239 mount --bind $BASEDIR/src $BASEDIR/build/usr/src/src
240
241 # Run LFS static binary creation scripts one by one
242 export CCACHE_DIR=$BASEDIR/ccache
243 export CCACHE_HASHDIR=1
244
245 # Remove pre-install list of installed files in case user erase some files before rebuild
246 rm -f $BASEDIR/build/usr/src/lsalr 2>/dev/null
247}
248
249
250############################################################################
251# #
252# Necessary shell functions #
253# #
254############################################################################
255lfsmake1() {
256 if [ -f $BASEDIR/lfs/$1 ]; then
257 echo "`date -u '+%b %e %T'`: Building $*" | tee -a $LOGFILE
258 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t " download >> $LOGFILE 2>&1
259 if [ $? -ne 0 ]; then
260 exiterror "Download error in $1"
261 fi
262 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1
263 if [ $? -ne 0 ]; then
264 exiterror "md5sum error in $1, check file in cache or signature"
265 fi
266 cd $BASEDIR/lfs && make -f $* BUILDTARGET=$BUILDTARGET \
267 MACHINE=$MACHINE \
268 LFS_BASEDIR=$BASEDIR \
269 ROOT=$LFS \
270 KVER=$KVER \
271 install >> $LOGFILE 2>&1
272 if [ $? -ne 0 ]; then
273 exiterror "Building $*";
274 fi
275 else
276 exiterror "No such file or directory: $BASEDIR/$1"
277 fi
278 return 0
279}
280
281lfsmake2() {
282 if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then
283 echo "`date -u '+%b %e %T'`: Building $*" | tee -a $LOGFILE
284 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t " download >> $LOGFILE 2>&1
285 if [ $? -ne 0 ]; then
286 exiterror "Download error in $1"
287 fi
288 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1
289 if [ $? -ne 0 ]; then
290 exiterror "md5sum error in $1, check file in cache or signature"
291 fi
292 chroot $LFS /tools/bin/env -i HOME=/root \
293 TERM=$TERM PS1='\u:\w\$ ' \
294 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
295 VERSION=$VERSION \
296 CONFIG_ROOT=$CONFIG_ROOT \
297 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
298 CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" \
299 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
300 KVER=$KVER \
301 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
302 /tools/bin/bash -x -c "cd /usr/src/lfs && \
303 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
304 if [ $? -ne 0 ]; then
305 exiterror "Building $*"
306 fi
307 else
308 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
309 fi
310 return 0
311}
312
313ipcopmake() {
314 if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then
315 echo "`date -u '+%b %e %T'`: Building $*" | tee -a $LOGFILE
316 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t " download >> $LOGFILE 2>&1
317 if [ $? -ne 0 ]; then
318 exiterror "Download error in $1"
319 fi
320 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1
321 if [ $? -ne 0 ]; then
322 exiterror "md5sum error in $1, check file in cache or signature"
323 fi
324 chroot $LFS /tools/bin/env -i HOME=/root \
325 TERM=$TERM PS1='\u:\w\$ ' \
326 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \
327 VERSION=$VERSION \
328 CONFIG_ROOT=$CONFIG_ROOT \
329 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
330 CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" \
331 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
332 KVER=$KVER \
333 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
334 /bin/bash -x -c "cd /usr/src/lfs && \
335 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
336 if [ $? -ne 0 ]; then
337 exiterror "Building $*"
338 fi
339 else
340 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
341 fi
342 return 0
343}
344
e7164bb4
MT
345ipfiredist() {
346 if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then
a68fedca 347# if [ ! `ls -w1 $BASEDIR/packages/*.tar.gz | grep $1` ]; then
e7164bb4 348 echo "`date -u '+%b %e %T'`: Packaging $1" | tee -a $LOGFILE
e7164bb4
MT
349 chroot $LFS /tools/bin/env -i HOME=/root \
350 TERM=$TERM PS1='\u:\w\$ ' \
351 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \
352 VERSION=$VERSION \
353 CONFIG_ROOT=$CONFIG_ROOT \
354 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
355 CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" \
356 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
357 KVER=$KVER \
358 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
359 /bin/bash -x -c "cd /usr/src/lfs && \
360 make -f $1 LFS_BASEDIR=/usr/src dist" >>$LOGFILE 2>&1
361 if [ $? -ne 0 ]; then
362 exiterror "Packaging $1"
363 fi
a68fedca
MT
364# else
365# echo "`date -u '+%b %e %T'`: Packaging: The package $1 already exists"
366# fi
e7164bb4
MT
367 else
368 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
369 fi
e7164bb4
MT
370 return 0
371}
372
df5e82b3
MT
373
374installmake() {
375 if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then
376 echo "`date -u '+%b %e %T'`: Building $*" | tee -a $LOGFILE
377 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t " download >> $LOGFILE 2>&1
378 if [ $? -ne 0 ]; then
379 exiterror "Download error in $1"
380 fi
381 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1
382 if [ $? -ne 0 ]; then
383 exiterror "md5sum error in $1, check file in cache or signature"
384 fi
385 chroot $LFS /tools/bin/env -i HOME=/root \
386 TERM=$TERM PS1='\u:\w\$ ' \
387 PATH=/usr/local/bin:/opt/$MACHINE-uClibc/usr/bin:/bin:/usr/bin:/sbin:/usr/sbin \
388 VERSION=$VERSION \
389 CONFIG_ROOT=$CONFIG_ROOT \
390 LFS_PASS="install" \
391 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
392 CFLAGS="-Os" CXXFLAGS="-Os" \
393 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
394 KVER=$KVER \
395 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
396 /bin/bash -x -c "cd /usr/src/lfs && \
397 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
398 if [ $? -ne 0 ]; then
399 exiterror "Building $*"
400 fi
401 else
402 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
403 fi
404 return 0
405}
406
407buildtoolchain() {
408 LOGFILE="$BASEDIR/log/_build.toolchain.log"
409 export LOGFILE
410 echo -ne "`date -u '+%b %e %T'`: Stage1 toolchain build \n" | tee -a $LOGFILE
411 # Build sed now, as we use some extensions
412 ORG_PATH=$PATH
413 NATIVEGCC=`gcc --version | grep GCC | awk {'print $3'}`
414 export NATIVEGCC GCCmajor=${NATIVEGCC:0:1} GCCminor=${NATIVEGCC:2:1} GCCrelease=${NATIVEGCC:4:1}
415 lfsmake1 ccache
416 lfsmake1 sed LFS_PASS=1
417 lfsmake1 m4 LFS_PASS=1
418 lfsmake1 bison LFS_PASS=1
419 lfsmake1 flex LFS_PASS=1
420 lfsmake1 binutils LFS_PASS=1
421 lfsmake1 gcc LFS_PASS=1
422 export PATH=$BASEDIR/build/usr/local/bin:$BASEDIR/build/tools/bin:$PATH
423
424 lfsmake1 linux
425 lfsmake1 tcl
426 lfsmake1 expect
427 lfsmake1 glibc
428 lfsmake1 dejagnu
429 lfsmake1 gcc LFS_PASS=2
430 lfsmake1 binutils LFS_PASS=2
431 lfsmake1 gawk
432 lfsmake1 coreutils
433 lfsmake1 bzip2
434 lfsmake1 gzip
435 lfsmake1 diffutils
436 lfsmake1 findutils
437 lfsmake1 make
438 lfsmake1 grep
439 lfsmake1 sed LFS_PASS=2
440 lfsmake1 m4 LFS_PASS=2
441 lfsmake1 bison LFS_PASS=2
442 lfsmake1 flex LFS_PASS=2
443 lfsmake1 gettext
444 lfsmake1 ncurses
445 lfsmake1 patch
446 lfsmake1 tar
447 lfsmake1 texinfo
448 lfsmake1 bash
449 lfsmake1 util-linux
450 lfsmake1 perl
451 export PATH=$ORG_PATH
452}
453
454buildbase() {
455 LOGFILE="$BASEDIR/log/_build.base.log"
456 export LOGFILE
457 echo -ne "`date -u '+%b %e %T'`: Stage2 linux base build \n" | tee -a $LOGFILE
458 # Run LFS dynamic binary creation scripts one by one
459 lfsmake2 stage2
460 lfsmake2 makedev
461 lfsmake2 linux
462 lfsmake2 man-pages
463 lfsmake2 glibc
464 lfsmake2 binutils
465 lfsmake2 gcc
466 lfsmake2 coreutils
467 lfsmake2 zlib
468 lfsmake2 mktemp
469 lfsmake2 iana-etc
470 lfsmake2 findutils
471 lfsmake2 gawk
472 lfsmake2 ncurses
473 lfsmake2 vim
474 lfsmake2 m4
475 lfsmake2 bison
476 lfsmake2 less
477 lfsmake2 groff
478 lfsmake2 sed
479 lfsmake2 flex
480 lfsmake2 gettext
481 lfsmake2 net-tools
482 lfsmake2 inetutils
483 lfsmake2 perl
484 lfsmake2 texinfo
485 lfsmake2 autoconf
486 lfsmake2 automake
487 lfsmake2 bash
488 lfsmake2 file
489 lfsmake2 libtool
490 lfsmake2 bzip2
491 lfsmake2 diffutils
492 lfsmake2 ed
493 lfsmake2 kbd
494 lfsmake2 e2fsprogs
495 lfsmake2 grep
496 if [ 'i386' = $MACHINE ]; then
497 lfsmake2 grub
498 elif [ 'alpha' = $MACHINE ]; then
499 lfsmake2 aboot
500 fi
501 lfsmake2 gzip
502 lfsmake2 man
503 lfsmake2 make
504 lfsmake2 modutils
505 lfsmake2 patch
506 lfsmake2 procinfo
507 lfsmake2 procps
508 lfsmake2 psmisc
509 lfsmake2 shadow
510 lfsmake2 sysklogd
511 lfsmake2 sysvinit
512 lfsmake2 tar
513 lfsmake2 util-linux
514}
515
516buildipcop() {
907cd036
MT
517 # Run IPFire make scripts one by one
518 LOGFILE="$BASEDIR/log/_build.ipfire.log"
df5e82b3
MT
519 export LOGFILE
520 echo -ne "`date -u '+%b %e %T'`: Stage3 $NAME build \n" | tee -a $LOGFILE
521
522 # Build these first as some of the kernel packages below rely on
523 # these for some of their client program functionality
524 ipcopmake configroot
525 ipcopmake dhcp
526 ipcopmake dhcpcd
527 ipcopmake libusb
528 ipcopmake libpcap
529 ipcopmake linux-atm
530 ipcopmake ppp
531 ipcopmake rp-pppoe
532 ipcopmake unzip
533 # Do SMP now
534 if [ 'i386' = $MACHINE ]; then
535 # abuse the SMP flag, and make an minimal installer kernel first
536 # so that the boot floppy always works.....
3e45cc09
MT
537 ipcopmake linux LFS_PASS=ipfire SMP=installer
538 ipcopmake linux LFS_PASS=ipfire SMP=1
df5e82b3
MT
539 ipcopmake 3cp4218 SMP=1
540 ipcopmake amedyn SMP=1
541 ipcopmake cxacru SMP=1
542 ipcopmake eagle SMP=1
543
544 # These are here because they have i386 only binary libraries
545 # included in the package.
546 ipcopmake cnx_pci SMP=1
547 ipcopmake fcdsl SMP=1
548 ipcopmake fcdsl2 SMP=1
549 ipcopmake fcdslsl SMP=1
550 ipcopmake fcdslusb SMP=1
551 ipcopmake fcdslslusb SMP=1
6ca65b88 552 ipcopmake fcpci SMP=1
ff7df9d4 553 ipcopmake fcclassic SMP=1
df5e82b3
MT
554 ipcopmake pulsar SMP=1
555 ipcopmake unicorn SMP=1
1fde937c 556 ipcopmake promise-sata-300-tx SMP=1
df5e82b3
MT
557 fi
558
3e45cc09 559 ipcopmake linux LFS_PASS=ipfire
df5e82b3
MT
560 ipcopmake 3cp4218
561 ipcopmake amedyn
562 ipcopmake cxacru
563 ipcopmake eciadsl
564 ipcopmake eagle
565 ipcopmake speedtouch
566 if [ 'i386' = $MACHINE ]; then
567 # These are here because they have i386 only binary libraries
568 # included in the package.
569 ipcopmake cnx_pci
570 ipcopmake fcdsl
571 ipcopmake fcdsl2
572 ipcopmake fcdslsl
573 ipcopmake fcdslusb
6ca65b88 574 ipcopmake fcdslslusb
ff7df9d4
MT
575 ipcopmake fcpci
576 ipcopmake fcclassic
1fde937c
MT
577 ipcopmake pulsar
578 ipcopmake unicorn
579 ipcopmake promise-sata-300-tx
df5e82b3
MT
580 fi
581
582 ipcopmake pcmcia-cs
583 ipcopmake expat
584 ipcopmake gdbm
585 ipcopmake gmp
586 ipcopmake openssl
587 ipcopmake python
588 ipcopmake libnet
589 ipcopmake libpng
590 ipcopmake gd
591 ipcopmake popt
592 ipcopmake slang
593 ipcopmake newt
594 ipcopmake libcap
595 ipcopmake pciutils
596 ipcopmake pcre
597 ipcopmake apache
598 ipcopmake arping
599 ipcopmake beep
600 ipcopmake bind
601 ipcopmake capi4k-utils
602 ipcopmake cdrtools
603 ipcopmake dnsmasq
604 ipcopmake dosfstools
605 ipcopmake ethtool
606 ipcopmake ez-ipupdate
607 ipcopmake fcron
608 ipcopmake perl-GD
609 ipcopmake gnupg
610 ipcopmake hdparm
611 ipcopmake ibod
612 ipcopmake initscripts
613 ipcopmake iptables
614 ipcopmake ipac-ng
615 ipcopmake ipaddr
616 ipcopmake iproute2
617 ipcopmake iptstate
618 ipcopmake iputils
78331e30 619 ipcopmake l7-protocols
df5e82b3
MT
620 ipcopmake isapnptools
621 ipcopmake isdn4k-utils
622 ipcopmake kudzu
623 ipcopmake logrotate
624 ipcopmake logwatch
625 ipcopmake mingetty
626 ipcopmake misc-progs
627 ipcopmake mtools
628 ipcopmake nano
629 ipcopmake nash
630 ipcopmake nasm
631 ipcopmake URI
632 ipcopmake HTML-Tagset
633 ipcopmake HTML-Parser
634 ipcopmake Compress-Zlib
635 ipcopmake Digest
636 ipcopmake Digest-SHA1
637 ipcopmake Digest-HMAC
638 ipcopmake libwww-perl
639 ipcopmake Net-DNS
640 ipcopmake Net-IPv4Addr
641 ipcopmake Net_SSLeay
4f8b6695
MT
642 ipcopmake IO-Stringy
643 ipcopmake Unix-Syslog
644 ipcopmake Mail-Tools
645 ipcopmake MIME-Tools
646 ipcopmake Net-Server
647 ipcopmake Convert-TNEF
648 ipcopmake Convert-UUlib
649 ipcopmake Archive-Tar
650 ipcopmake Archive-Zip
f28d0ddc 651 ipcopmake Text-Tabs+Wrap
90350ff3 652 ipcopmake Locale-Country
dace10b5 653 ipcopmake GeoIP
df8c7810 654 ipcopmake fwhits
6d4147d2
MT
655 ipcopmake berkeley
656 ipcopmake BerkeleyDB ## The Perl module
df5e82b3
MT
657 ipcopmake noip_updater
658 ipcopmake ntp
659 ipcopmake oinkmaster
660 ipcopmake openssh
661 ipcopmake openswan
662 ipcopmake pptpclient
663 ipcopmake rrdtool
664 ipcopmake setserial
665 ipcopmake setup
666 ipcopmake snort
667 #ipcopmake speedycgi
6d4147d2
MT
668 ipcopmake saslauthd PASS=1
669 ipcopmake openldap
df5e82b3
MT
670 ipcopmake squid
671 ipcopmake squid-graph
60cbd6e7 672 ipcopmake squidguard
df5e82b3
MT
673 ipcopmake tcpdump
674 ipcopmake traceroute
675 ipcopmake vlan
5fcb6d5a 676 #ipcopmake wireless
df5e82b3
MT
677 ipcopmake libsafe
678 ipcopmake 3c5x9setup
894c6feb 679# echo -ne "`date -u '+%b %e %T'`: Building ### IPFire modules ### \n" | tee -a $LOGFILE
b34fd95d 680 ipcopmake pakfire
6ef0bff8 681 ipcopmake startscripts
5e69ef1a 682## Zuerst die Libs und dann die Programme. Ordnung muss sein!
6ef0bff8 683 ipcopmake java
5e69ef1a 684 ipcopmake libtiff
c3defe9b 685 ipcopmake libjpeg
a7b1824c
MT
686 ipcopmake lcms
687 ipcopmake libmng
688 ipcopmake freetype
689 ipcopmake bootsplash
5e69ef1a
MT
690 ipcopmake libxml2
691 ipcopmake spandsp
692 ipcopmake lzo
6ef0bff8 693 ipcopmake openvpn
f8e5510c
MT
694 ipcopmake pkg-config
695 ipcopmake glib
180cd3be 696 ipcopmake xampp
5e69ef1a
MT
697 ipcopmake pam
698 ipcopmake pammysql
371d9df0 699 ipcopmake saslauthd PASS=2
a31b2bc4 700 ipcopmake xinetd
316160b0
MT
701 ipcopmake ghostscript
702 ipcopmake cups
b34fd95d 703# ipcopmake lpd ## Im Moment aus, da CUPS vorhanden ist.
98d413ac 704 ipcopmake samba
5e69ef1a
MT
705 ipcopmake sudo
706 ipcopmake mc
40a4ea4c
MT
707# ipcopmake pwlib
708# ipcopmake openh323
1fe6c87b 709 ipcopmake wget
60cbd6e7 710 ipcopmake wput
1fe6c87b 711 ipcopmake bridge-utils
3e45cc09
MT
712 ipcopmake screen
713 ipcopmake hddtemp
1fde937c 714 ipcopmake smartmontools
3e45cc09
MT
715 ipcopmake htop
716 ipcopmake lynx
b34fd95d 717 echo -ne "`date -u '+%b %e %T'`: Building ### Mailserver ### \n" | tee -a $LOGFILE
94025eea 718 ipcopmake postfix
6c666a3b 719 ipcopmake procmail
93dc5548
MT
720 ipcopmake fetchmail
721 ipcopmake cyrusimap
f28d0ddc 722 ipcopmake web-cyradm
33a31f1a 723 ipcopmake mailx
f9315063
MT
724 ipcopmake clamav
725 ipcopmake razor
4f8b6695 726 ipcopmake spamassassin
f28d0ddc 727# ipcopmake amavisd
b34fd95d 728 echo -ne "`date -u '+%b %e %T'`: Building ### VoIP-Server ### \n" | tee -a $LOGFILE
94025eea 729 ipcopmake stund
b684b13b
MT
730 ipcopmake zaptel
731 ipcopmake libpri
732 ipcopmake bristuff
40a4ea4c 733 ipcopmake asterisk
894c6feb 734 ipcopmake mpg123
b34fd95d 735 echo -ne "`date -u '+%b %e %T'`: Building ### MP3-Server ### \n" | tee -a $LOGFILE
5ac2da9f
MT
736 ipcopmake libogg
737 ipcopmake libvorbis
316160b0 738 ipcopmake lame
5ac2da9f 739 ipcopmake sox
316160b0 740 ipcopmake gnump3d
6ef0bff8
MT
741 echo -ne "`date -u '+%b %e %T'`: Building ### P2P-Clients ### \n" | tee -a $LOGFILE
742 ipcopmake applejuice
02dc0a76
MT
743 ipcopmake ocaml
744 ipcopmake mldonkey
745# ipcopmake edonkeyclc
894c6feb 746# ipcopmake sane
3e45cc09
MT
747 echo -ne "`date -u '+%b %e %T'`: Building ### Net-Tools ### \n" | tee -a $LOGFILE
748 ipcopmake ntop
894c6feb 749# ipcopmake rsync
3b9f6349 750 ipcopmake tcpwrapper
769a61c5 751 ipcopmake portmap
894c6feb 752 ipcopmake nfs
907cd036 753 ipcopmake nmap
52345790 754 ipcopmake mbmon
3e45cc09 755 ipcopmake iftop
ef05c8bb 756 ipcopmake ncftp
ca35618d 757 ipcopmake cftp
60cbd6e7 758 ipcopmake etherwake
33a31f1a 759 ipcopmake ethereal
712d859c 760 ipcopmake tftp-hpa
0eab8e84 761# ipcopmake stunnel # Ausgeschaltet, weil wir es doch nicht nutzen
df5e82b3
MT
762}
763
764buildinstaller() {
765 # Run installer scripts one by one
766 LOGFILE="$BASEDIR/log/_build.installer.log"
767 export LOGFILE
768 echo -ne "`date -u '+%b %e %T'`: Stage4 installer build \n" | tee -a $LOGFILE
769 if [ 'i386' = $MACHINE ]; then
770 ipcopmake syslinux
771 ipcopmake as86
772 ipcopmake mbr
773 ipcopmake uClibc
774 fi
775 installmake busybox
776 installmake sysvinit
777 installmake e2fsprogs
778 installmake misc-progs
779 installmake slang
780 installmake util-linux
781 installmake newt
782 installmake pciutils
783 installmake pcmcia-cs
784 installmake kbd
785 installmake installer
786 installmake scsi.img
787 installmake driver.img
788 installmake initrd
789 installmake boot.img
790}
791
792buildpackages() {
793 LOGFILE="$BASEDIR/log/_build.packages.log"
794 export LOGFILE
795 echo "... see detailed log in _build.*.log files" >> $LOGFILE
796 echo -ne "`date -u '+%b %e %T'`: Stage5 packages build \n" | tee -a $LOGFILE
797 # Strip files
798 echo "`date -u '+%b %e %T'`: Stripping files" | tee -a $LOGFILE
799 find $LFS/lib $LFS/usr/lib $LFS/usr/share/rrdtool-* $LFS/install ! -type l \( -name '*.so' -o -name '*.so[\.0-9]*' \) \
800 ! -name 'libc.so' ! -name 'libpthread.so' ! -name 'libcrypto.so.0.9.7.sha1' \
90350ff3 801 -exec $LFS/tools/bin/strip --strip-all {} \; >> $LOGFILE 2>&1
df5e82b3
MT
802 # add -ls before -exec if you want to verify what files are stripped
803
804 find $LFS/{,s}bin $LFS/usr/{,s}bin $LFS/usr/local/{,s}bin ! -type l \
805 -exec file {} \; | grep " ELF " | cut -f1 -d ':' | xargs $LFS/tools/bin/strip --strip-all >> $LOGFILE 2>&1
806 # there add -v to strip to verify
807
808 if [ 'i386' = $MACHINE ]; then
809 # Create fcdsl packages
810 echo "`date -u '+%b %e %T'`: Building fcdsl tgz" | tee -a $LOGFILE
811 cp $LFS/install/images/fcdsl/license.txt $LFS >> $LOGFILE 2>&1
812 touch $LFS/var/run/{need-depmod-$KVER,need-depmod-$KVER-smp}
813 cd $LFS && tar cvfz $LFS/install/images/$SNAME-fcdsl-$VERSION.$MACHINE.tgz \
814 lib/modules/$KVER/misc/fcdsl*.o.gz \
815 lib/modules/$KVER-smp/misc/fcdsl*.o.gz \
816 usr/lib/isdn/{fds?base.bin,fd?ubase.frm} \
817 etc/fcdsl/fcdsl*.conf \
818 etc/drdsl/{drdsl,drdsl.ini} \
819 license.txt \
820 var/run/{need-depmod-$KVER,need-depmod-$KVER-smp} >> $LOGFILE 2>&1
821 rm -f $LFS/license.txt >> $LOGFILE 2>&1
822 cd $BASEDIR
823 fi
df5e82b3
MT
824
825 # Generating list of packages used
826 echo "`date -u '+%b %e %T'`: Generating packages list from logs" | tee -a $LOGFILE
827 rm -f $BASEDIR/doc/packages-list
828 for i in `ls -1tr $BASEDIR/log/[^_]*`; do
829 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
3ea75603 830 echo " * `basename $i`" >>$BASEDIR/doc/packages-list
df5e82b3
MT
831 fi
832 done
3ea75603 833 echo "====== List of softwares used to build $NAME Version: $VERSION ======" > $BASEDIR/doc/packages-list.txt
712d859c 834 grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|ipfire$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$\|^ipfire-logs' \
df5e82b3
MT
835 $BASEDIR/doc/packages-list | sort >> $BASEDIR/doc/packages-list.txt
836 rm -f $BASEDIR/doc/packages-list
c9673262 837 # packages-list.txt is ready to be displayed for wiki page
df5e82b3
MT
838
839 # Create ISO for CDRom and USB-superfloppy
c3defe9b 840 ipcopmake cdrom
e67a57fe 841 rm -f $LFS/install/images/*usb*
c3defe9b 842 cp $LFS/install/images/{*.iso,*.tgz} $BASEDIR >> $LOGFILE 2>&1
c9673262 843
e67a57fe
MT
844 ipfirepackages
845
846 # Cleanup
847 stdumount
848 rm -rf $BASEDIR/build/tmp/*
849
850 # Generating total list of files
851 echo "`date -u '+%b %e %T'`: Generating files list from logs" | tee -a $LOGFILE
852 rm -f $BASEDIR/log/FILES
853 for i in `ls -1tr $BASEDIR/log/[^_]*`; do
854 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
855 echo "##" >>$BASEDIR/log/FILES
856 echo "## `basename $i`" >>$BASEDIR/log/FILES
857 echo "##" >>$BASEDIR/log/FILES
858 cat $i | sed "s%^\./%#%" | sort >> $BASEDIR/log/FILES
859 fi
860 done
861
862 cd $PWD
863
864}
865
866ipfirepackages() {
013a23e2
MT
867 if [ -d "$BASEDIR/packages" ]; then
868 for i in `ls $BASEDIR/packages`; do
869 touch $BASEDIR/build/install/packages/$i.empty
870 done
871 fi
f0ca8c34 872 ipfiredist amavisd
78331e30 873 ipfiredist applejuice
5ac2da9f 874 ipfiredist asterisk
c7acba4a 875 ipfiredist clamav
483f59cd 876 ipfiredist cups
78331e30
MT
877 ipfiredist cyrusimap
878 ipfiredist fetchmail
879 ipfiredist gnump3d
0d0521b6 880 ipfiredist java
78331e30 881 ipfiredist lame
ae179f6e 882 ipfiredist libogg
78331e30 883 ipfiredist libtiff
ae179f6e 884 ipfiredist libvorbis
78331e30 885 ipfiredist libxml2
f0ca8c34 886 ipfiredist mailx
3ab910dd 887 ipfiredist mldonkey
f0ca8c34
MT
888 ipfiredist nfs
889 ipfiredist nmap
3e45cc09 890 ipfiredist ntop
78331e30 891 ipfiredist postfix
371d9df0 892 ipfiredist procmail
90350ff3 893 ipfiredist samba
ae179f6e 894 ipfiredist sox
f0ca8c34 895 ipfiredist spamassassin
f28d0ddc 896 ipfiredist web-cyradm
483f59cd 897 ipfiredist xampp
43f8b5f1 898# ipfiredist xinetd
78331e30 899 test -d $BASEDIR/packages || mkdir $BASEDIR/packages
a8b159e7 900 mv -f $LFS/install/packages/*.{tar.gz,md5} $BASEDIR/packages >> $LOGFILE 2>&1
483f59cd 901 rm -rf $BASEDIR/build/install/packages/*
df5e82b3
MT
902}
903
cc0e56be
MT
904update_logs() {
905 tar cfz log/ipfire-logs-`date +'%Y-%m-%d-%H:%M'`.tgz log/_build.*
906 rm -f log/_build.*
907}
908
df5e82b3
MT
909# See what we're supposed to do
910case "$1" in
911build)
912 BUILDMACHINE=`uname -m`
712d859c 913 PACKAGE=`ls -v -r $BASEDIR/cache/toolchains/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz 2> /dev/null | head -n 1`
df5e82b3
MT
914 #only restore on a clean disk
915 if [ ! -f log/perl-*-tools ]; then
916 if [ ! -n "$PACKAGE" ]; then
917 echo "`date -u '+%b %e %T'`: Full toolchain compilation" | tee -a $LOGFILE
918 prepareenv
919 buildtoolchain
920 else
921 PACKAGENAME=${PACKAGE%.tar.gz}
922 echo "`date -u '+%b %e %T'`: Restore from $PACKAGE" | tee -a $LOGFILE
923 if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then
924 tar zxf $PACKAGE
925 prepareenv
926 else
927 exiterror "$PACKAGENAME md5 did not match, check downloaded package"
928 fi
929 fi
930 else
931 echo "`date -u '+%b %e %T'`: Using installed toolchain" | tee -a $LOGFILE
932 prepareenv
933 fi
5cfe86e6 934
df5e82b3
MT
935 buildbase
936 buildipcop
5cfe86e6
HS
937
938 # Setzen des IPFire Builds
8af06406 939 if [ "$FIREBUILD" ]; then
e57bc1fd 940 echo "$FIREBUILD" > $BASEDIR/build/var/ipfire/firebuild
5cfe86e6 941 else
e57bc1fd 942 echo "_(OvO)_" > $BASEDIR/build/var/ipfire/firebuild
5cfe86e6
HS
943 fi
944
df5e82b3
MT
945 buildinstaller
946 buildpackages
947 ;;
948shell)
949 # enter a shell inside LFS chroot
950 # may be used to changed kernel settings
951 prepareenv
952 entershell
953 ;;
954changelog)
d1dd6669 955 echo -n "Loading new Changelog from SVN: "
f9315063 956 svn log http://svn.ipfire.eu/svn/ipfire > doc/ChangeLog
d1dd6669 957 echo "Finished!"
df5e82b3
MT
958 ;;
959check)
960 echo "Checking sources files availability on the web"
961 if [ ! -d $DIR_CHK ]; then
962 mkdir -p $DIR_CHK
963 fi
964 FINISHED=0
965 cd $BASEDIR/lfs
966 for c in `seq $MAX_RETRIES`; do
967 if (( FINISHED==1 )); then
968 break
969 fi
970 FINISHED=1
971 cd $BASEDIR/lfs
972 for i in *; do
973 if [ -f "$i" -a "$i" != "Config" ]; then
974 make -s -f $i MACHINE=$MACHINE LFS_BASEDIR=$BASEDIR ROOT=$BASEDIR/build \
975 MESSAGE="$i\t ($c/$MAX_RETRIES)" check
976 if [ $? -ne 0 ]; then
977 echo "Check : wget error in lfs/$i"
978 FINISHED=0
979 fi
980 fi
981 done
982 done
983 cd -
984 ;;
985checkclean)
986 echo "Erasing sources files availability tags"
987 rm -rf $DIR_CHK/*
988 ;;
989clean)
990 for i in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do
991 $LOSETUP -d $i 2>/dev/null
992 done
993 for i in `mount | grep $BASEDIR | cut -d " " -f 1`; do
994 umount $i
995 done
996 stdumount
997 for i in `seq 0 7`; do
998 if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
999 umount /dev/loop${i} 2>/dev/null;
1000 losetup -d /dev/loop${i} 2>/dev/null;
1001 fi;
1002 done
1003 rm -rf $BASEDIR/build
1004 rm -rf $BASEDIR/cdrom
f9315063 1005 rm -rf $BASEDIR/packages
df5e82b3 1006 rm -rf $BASEDIR/log
df5e82b3
MT
1007 if [ -h /tools ]; then
1008 rm -f /tools
1009 fi
1010 ;;
f8e5510c 1011newpak)
a9b17001
MT
1012 # create structure for a new package
1013 echo -e "Name of the new package: $2"
1014 if [ ! -f "lfs/$2" ]; then
1015 echo "`date -u '+%b %e %T'`: Creating directory src/paks/$2"
1016 mkdir -p src/paks/$2
1017 cd src/paks/$2
f8e5510c 1018 echo "`date -u '+%b %e %T'`: Creating files"
a9b17001
MT
1019 cp $BASEDIR/lfs/postfix $BASEDIR/lfs/$2
1020
f8e5510c 1021 touch ROOTFILES
f8e5510c 1022 touch {,un}install.sh
a9b17001 1023 ## install.sh
f8e5510c
MT
1024 echo '#!/bin/bash' > install.sh
1025 echo '#' >> install.sh
1026 echo '#################################################################' >> install.sh
1027 echo '# #' >> install.sh
1028 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> install.sh
1029 echo '# #' >> install.sh
1030 echo '#################################################################' >> install.sh
1031 echo '#' >> install.sh
1032 echo '# Extract the files' >> install.sh
1033 echo 'tar xfz files.tgz -C /' >> install.sh
a9b17001
MT
1034 echo 'cp -f ROOTFILES /opt/pakfire/installed/ROOTFILES.$2' >> install.sh
1035 ## uninstall.sh
f8e5510c
MT
1036 echo '#!/bin/bash' > uninstall.sh
1037 echo '#################################################################' >> uninstall.sh
1038 echo '# #' >> uninstall.sh
1039 echo '# This file belongs to IPFire Firewall - GPLv2 - www.ipfire.org #' >> uninstall.sh
1040 echo '# #' >> uninstall.sh
1041 echo '#################################################################' >> uninstall.sh
1042 echo '#' >> uninstall.sh
1043 echo '# Delete the files' >> uninstall.sh
1044 echo '## Befehl fehlt noch' >> uninstall.sh
a9b17001 1045 echo 'rm -f /opt/pakfire/installed/ROOTFILES.$2' >> uninstall.sh
f8e5510c 1046 echo "`date -u '+%b %e %T'`: Adding files to SVN"
a9b17001
MT
1047 cd - && svn add lfs/$2 && svn add src/paks/$2
1048
1049 echo -n "Do you want to remove the folders? [y/n]"
1050 read REM
1051 if [ "$REM" == "y" ]; then
1052 echo "Removing the folders..."
1053 svn del src/paks/$2 --force
1054 else
1055 echo "Folders are kept."
1056 fi
df5e82b3 1057 else
a9b17001 1058 echo "$2 already exists"
df5e82b3 1059 fi
df5e82b3
MT
1060 exit 0
1061 ;;
1062prefetch)
1063 if [ ! -d $BASEDIR/cache ]; then
1064 mkdir $BASEDIR/cache
1065 fi
1066 mkdir -p $BASEDIR/log
1067 echo "`date -u '+%b %e %T'`:Preload all source files" | tee -a $LOGFILE
1068 FINISHED=0
1069 cd $BASEDIR/lfs
1070 for c in `seq $MAX_RETRIES`; do
1071 if (( FINISHED==1 )); then
1072 break
1073 fi
1074 FINISHED=1
1075 cd $BASEDIR/lfs
1076 for i in *; do
1077 if [ -f "$i" -a "$i" != "Config" ]; then
1078 make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t ($c/$MAX_RETRIES)" download >> $LOGFILE 2>&1
1079 if [ $? -ne 0 ]; then
1080 echo "Prefetch : wget error in lfs/$i"
1081 FINISHED=0
1082 else
1083 if [ $c -eq 1 ]; then
1084 echo "Prefetch : lfs/$i files loaded"
1085 fi
1086 fi
1087 fi
1088 done
1089 done
1090 echo "Prefetch : verifying md5sum"
1091 ERROR=0
1092 for i in *; do
1093 if [ -f "$i" -a "$i" != "Config" ]; then
1094 make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t " md5 >> $LOGFILE 2>&1
1095 if [ $? -ne 0 ]; then
1096 echo "md5 difference in lfs/$i"
1097 ERROR=1
1098 fi
1099 fi
1100 done
1101 if [ $ERROR -eq 0 ]; then
1102 echo "Prefetch : all files md5sum match"
1103 fi
1104 cd -
1105 ;;
df5e82b3
MT
1106toolchain)
1107 prepareenv
1108 buildtoolchain
1109 BUILDMACHINE=`uname -m`
1110 echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for $BUILDMACHINE" | tee -a $LOGFILE
712d859c
MT
1111 test -d $BASEDIR/cache/toolchains || mkdir $BASEDIR/cache/toolchains
1112 cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache/toolchains/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \
df5e82b3
MT
1113 build/{bin,etc,usr/bin,usr/local} \
1114 build/tools/{bin,etc,*-linux-gnu,include,lib,libexec,sbin,share,var} \
1115 log >> $LOGFILE
712d859c
MT
1116 md5sum cache/toolchains/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \
1117 > cache/toolchains/$SNAME-$VERSION-toolchain-$BUILDMACHINE.md5
df5e82b3
MT
1118 stdumount
1119 ;;
1120gettoolchain)
1121 BUILDMACHINE=`uname -m`
1122 # arbitrary name to be updated in case of new toolchain package upload
c6cb9d25 1123 PACKAGE=$SNAME-$VERSION-toolchain-$BUILDMACHINE
712d859c
MT
1124 if [ ! -f $BASEDIR/cache/toolchains/$PACKAGE.tar.gz ]; then
1125 URL_IPFIRE=`grep URL_IPFIRE lfs/Config | awk '{ print $3 }'`
1126 test -d $BASEDIR/cache/toolchains || mkdir $BASEDIR/cache/toolchains
1127 echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for $BUILDMACHINE" | tee -a $LOGFILE
1128 cd $BASEDIR/cache/toolchains
1129 wget $URL_IPFIRE/toolchains/$PACKAGE.tar.gz $URL_IPFIRE/toolchains/$PACKAGE.md5 >& /dev/null
1130 if [ $? -ne 0 ]; then
1131 echo "`date -u '+%b %e %T'`: error downloading toolchain for $BUILDMACHINE machine" | tee -a $LOGFILE
40a4ea4c 1132 else
712d859c
MT
1133 if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then
1134 echo "`date -u '+%b %e %T'`: toolchain md5 ok" | tee -a $LOGFILE
1135 else
1136 exiterror "$PACKAGE.md5 did not match, check downloaded package"
1137 fi
40a4ea4c 1138 fi
712d859c
MT
1139 else
1140 echo "Toolchain is already downloaded. Exiting..."
df5e82b3
MT
1141 fi
1142 ;;
ce56e927
MT
1143sources-iso)
1144 prepareenv
1145 echo "`date -u '+%b %e %T'`: Build sources iso for $MACHINE" | tee -a $LOGFILE
1146 chroot $LFS /tools/bin/env -i HOME=/root \
1147 TERM=$TERM PS1='\u:\w\$ ' \
1148 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \
1149 VERSION=$VERSION NAME="$NAME" SNAME="$SNAME" MACHINE=$MACHINE \
1150 /bin/bash -x -c "cd /usr/src/lfs && make -f sources-iso LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
1151 mv $LFS/install/images/ipfire-* $BASEDIR >> $LOGFILE 2>&1
1152 stdumount
1153 ;;
c6cb9d25
MT
1154svn)
1155 case "$2" in
1156 update|up)
cc0e56be 1157 # clear
c6cb9d25
MT
1158 echo -n "Load the latest source files..."
1159 svn update >> $PWD/log/_build.svn.update.log
1160 if [ $? -eq 0 ]; then
1161 echo ".Done!"
1162 else
1163 echo ".Fail!"
1164 exit 1
1165 fi
1166 echo -n "Write the svn info to a file..."
1167 svn info > $PWD/svn_status
1168 if [ "$?" -eq "0" ]; then
1169 echo ".Done!"
1170 else
1171 echo ".Fail!"
1172 exit 1
1173 fi
712d859c 1174 chmod 755 $0
cc0e56be 1175 exit 0
c6cb9d25
MT
1176 ;;
1177 commit|ci)
1178 clear
5ac2da9f
MT
1179 #$0 changelog
1180 #echo "Upload the changed files..."
c6cb9d25
MT
1181 sleep 1
1182 svn commit
1183 $0 svn up
1184 ;;
1185 dist)
1186 $0 svn up
1187 echo -ne "Download source package from svn..."
1188 svn export http://svn.ipfire.eu/svn/ipfire ipfire-source/ --force > /dev/null
1189 if [ "$?" -eq "0" ]; then
1190 echo ".Done!"
1191 else
1192 echo ".Fail!"
1193 exit 1
1194 fi
1195 echo -n "Compress files..."
9dc02b38 1196 tar cfz ipfire-source-r$SVN_REVISION.tar.gz ipfire-source
c6cb9d25
MT
1197 if [ "$?" -eq "0" ]; then
1198 echo ".Done!"
1199 else
1200 echo ".Fail!"
1201 exit 1
1202 fi
1203 echo -n "Cleanup..."
1204 rm ipfire-source/ -r
1205 if [ "$?" -eq "0" ]; then
1206 echo ".Done!"
1207 else
1208 echo ".Fail!"
1209 exit 1
1210 fi
1211 ;;
1212 diff)
1213 echo -ne "Make a local diff to last svn revision..."
1214 svn diff > ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff
1215 if [ "$?" -eq "0" ]; then
1216 echo ".Done!"
1217 else
1218 echo ".Fail!"
1219 exit 1
1220 fi
1221 echo "Diff was successfully saved to ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff"
1222 ;;
1223 esac
f9315063 1224 ;;
cc0e56be
MT
1225make-config)
1226 echo -e "This is for creating your configuration..."
cc0e56be
MT
1227 echo -e "We will need some input:"
1228 echo -e ""
1229 echo -n "FTP-DOMAIN FOR THE ISO: "
1230 read IPFIRE_FTP_URL_EXT
1231 echo -n "PATH FOR $IPFIRE_FTP_URL_EXT: "
1232 read IPFIRE_FTP_PATH_EXT
1233 echo -n "USERNAME FOR $IPFIRE_FTP_URL_EXT: "
1234 read IPFIRE_FTP_USER_EXT
1235 echo -n "PASSWORD FOR $IPFIRE_FTP_URL_EXT: "
712d859c 1236 read -s IPFIRE_FTP_PASS_EXT
cc0e56be
MT
1237 echo ""
1238 echo "(You can leave this empty if the cache-server is the same as your iso-server.)"
1239 echo -n "FTP-DOMAIN FOR THE CACHE: "
1240 read IPFIRE_FTP_URL_INT
1241 echo -n "PATH FOR $IPFIRE_FTP_URL_INT: "
1242 read IPFIRE_FTP_PATH_INT
1243 if [ $IPFIRE_FTP_URL_INT ]; then
1244 echo -n "USERNAME FOR $IPFIRE_FTP_URL_INT: "
1245 read IPFIRE_FTP_USER_INT
1246 echo -n "PASSWORD FOR $IPFIRE_FTP_URL_INT: "
712d859c 1247 read -s IPFIRE_FTP_PASS_INT
cc0e56be
MT
1248 else
1249 IPFIRE_FTP_URL_INT=$IPFIRE_FTP_URL_EXT
1250 IPFIRE_FTP_USER_INT=$IPFIRE_FTP_USER_EXT
1251 IPFIRE_FTP_PASS_INT=$IPFIRE_FTP_PASS_EXT
1252 echo "USERNAME FOR $IPFIRE_FTP_URL_INT: $IPFIRE_FTP_USER_INT"
712d859c 1253 echo "PASSWORD FOR $IPFIRE_FTP_URL_INT: !HIDDEN!"
cc0e56be
MT
1254 fi
1255 echo ""
1256 echo "(You can leave this empty if the pak-server is the same as your iso-server.)"
1257 echo -n "FTP-DOMAIN FOR THE PAKS: "
1258 read IPFIRE_FTP_URL_PAK
1259 echo -n "PATH FOR $IPFIRE_FTP_URL_PAK: "
1260 read IPFIRE_FTP_PATH_PAK
1261 if [ $IPFIRE_FTP_URL_PAK ]; then
1262 echo -n "USERNAME FOR $IPFIRE_FTP_URL_PAK: "
1263 read IPFIRE_FTP_USER_PAK
1264 echo -n "PASSWORD FOR $IPFIRE_FTP_URL_PAK: "
712d859c 1265 read -s IPFIRE_FTP_PASS_PAK
a68fedca 1266 else
cc0e56be
MT
1267 IPFIRE_FTP_URL_PAK=$IPFIRE_FTP_URL_EXT
1268 IPFIRE_FTP_USER_PAK=$IPFIRE_FTP_USER_EXT
1269 IPFIRE_FTP_PASS_PAK=$IPFIRE_FTP_PASS_EXT
1270 echo "USERNAME FOR $IPFIRE_FTP_URL_PAK: $IPFIRE_FTP_USER_PAK"
712d859c 1271 echo "PASSWORD FOR $IPFIRE_FTP_URL_PAK: !HIDDEN!"
a68fedca 1272 fi
cc0e56be
MT
1273 echo ""
1274 echo -e "ONE OR MORE EMAIL ADDRESS(ES) TO WHICH THE REPORTS WILL BE SENT"
1275 echo -e "(seperated by comma)"
1276 read IPFIRE_MAIL_REPORT
1277 echo -n "EMAIL FROM: "
1278 read IPFIRE_MAIL_FROM
1279 echo -n "EMAIL SERVER: "
1280 read IPFIRE_MAIL_SERVER
1281 echo -n "LOGIN TO MAIL SERVER: "
1282 read IPFIRE_MAIL_USER
1283 echo -n "MAIL PASSWORD: "
712d859c 1284 read -s IPFIRE_MAIL_PASS
cc0e56be
MT
1285 echo -n "Saving..."
1286 for i in `seq 20`; do
1287 sleep 0.1; echo -n "."
1288 done
1289 echo ".Finished!"
1290 cat <<END > .config
1291### ISO server
1292IPFIRE_FTP_URL_EXT=$IPFIRE_FTP_URL_EXT
1293IPFIRE_FTP_PATH_EXT=$IPFIRE_FTP_PATH_EXT
1294IPFIRE_FTP_USER_EXT=$IPFIRE_FTP_USER_EXT
1295IPFIRE_FTP_PASS_EXT=$IPFIRE_FTP_PASS_EXT
1296### cache server
1297IPFIRE_FTP_URL_INT=$IPFIRE_FTP_URL_INT
1298IPFIRE_FTP_PATH_INT=$IPFIRE_FTP_PATH_INT
1299IPFIRE_FTP_USER_INT=$IPFIRE_FTP_USER_INT
1300IPFIRE_FTP_PASS_INT=$IPFIRE_FTP_PASS_INT
1301### paks server
1302IPFIRE_FTP_URL_PAK=$IPFIRE_FTP_URL_PAK
1303IPFIRE_FTP_PATH_PAK=$IPFIRE_FTP_PATH_PAK
1304IPFIRE_FTP_USER_PAK=$IPFIRE_FTP_USER_PAK
1305IPFIRE_FTP_PASS_PAK=$IPFIRE_FTP_PASS_PAK
1306### mail reports
1307IPFIRE_MAIL_REPORT=$IPFIRE_MAIL_REPORT
1308IPFIRE_MAIL_FROM=$IPFIRE_MAIL_FROM
1309IPFIRE_MAIL_SERVER=$IPFIRE_MAIL_SERVER
1310IPFIRE_MAIL_USER=$IPFIRE_MAIL_USER
1311IPFIRE_MAIL_PASS=$IPFIRE_MAIL_PASS
1312END
1313 ;;
1314sync)
1315 echo -e "Syncing cache to ftp:"
ce56e927 1316# rm -f doc/packages-to-remove-from-ftp
cc0e56be 1317 ncftpls -u $IPFIRE_FTP_USER_INT -p $IPFIRE_FTP_PASS_INT ftp://$IPFIRE_FTP_URL_INT$IPFIRE_FTP_PATH_INT/ > ftplist
0eab8e84
MT
1318 for i in `ls -w1 cache/`; do
1319 grep $i ftplist
1320 if [ "$?" -ne "0" ]; then
cc0e56be 1321 ncftpput -u $IPFIRE_FTP_USER_INT -p $IPFIRE_FTP_PASS_INT $IPFIRE_FTP_URL_INT $IPFIRE_FTP_PATH_INT/ cache/$i
0eab8e84
MT
1322 if [ "$?" -eq "0" ]; then
1323 echo -e "$i was successfully uploaded to the ftp server."
1324 else
1325 echo -e "There was an error while uploading $i to the ftp server."
1326 fi
1327 fi
1328 done
ce56e927
MT
1329# for i in `cat ftplist`; do
1330# ls -w1 cache/ | grep $i
1331# if [ "$?" -eq "1" ]; then
1332# echo $i | grep -v toolchain >> doc/packages-to-remove-from-ftp
1333# fi
1334# done
0eab8e84
MT
1335 rm -f ftplist
1336 ;;
cc0e56be
MT
1337upload)
1338 case "$2" in
1339 iso)
1340 echo -e "Uploading the iso to $IPFIRE_FTP_URL_EXT."
9dc02b38
MT
1341 cat <<EOF > .ftp-commands
1342mkdir $IPFIRE_FTP_PATH_EXT
1343ls -lah
1344quit
1345EOF
1346 ncftp -u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT < .ftp-commands
1347 rm -f .ftp-commands
1348 md5sum ipfire-install-$VERSION.i386.iso > ipfire-install-$VERSION.i386.iso.md5
1349 ncftpput -u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT $IPFIRE_FTP_PATH_EXT/ ipfire-install-$VERSION.i386.iso
1350 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
1351 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
1352 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
1353 if [ "$?" -eq "0" ]; then
1354 echo -e "The iso of Revision $SVN_REVISION was successfully uploaded to $IPFIRE_FTP_URL_EXT$IPFIRE_FTP_PATH_EXT/."
cc0e56be 1355 else
9dc02b38
MT
1356 echo -e "There was an error while uploading the iso to the ftp server."
1357 exit 1
cc0e56be 1358 fi
cc0e56be
MT
1359 ;;
1360 paks)
9dc02b38
MT
1361 cat <<EOF > .ftp-commands
1362mkdir $IPFIRE_FTP_PATH_PAK
1363ls -lah
1364quit
1365EOF
1366 ncftp -u $IPFIRE_FTP_USER_PAK -p $IPFIRE_FTP_PASS_PAK $IPFIRE_FTP_URL_PAK < .ftp-commands
1367 rm -f .ftp-commands
cc0e56be
MT
1368 ncftpput -z -u $IPFIRE_FTP_USER_PAK -p $IPFIRE_FTP_PASS_PAK $IPFIRE_FTP_URL_PAK $IPFIRE_FTP_PATH_PAK/ packages/*
1369 if [ "$?" -eq "0" ]; then
9dc02b38 1370 echo -e "The packages were successfully uploaded to $IPFIRE_FTP_URL_PAK$IPFIRE_FTP_PATH_PAK/."
cc0e56be
MT
1371 else
1372 echo -e "There was an error while uploading the packages to the ftp server."
712d859c 1373 exit 1
cc0e56be
MT
1374 fi
1375 ;;
1376 esac
0d0521b6 1377 ;;
52345790
MT
1378build-only)
1379 rm -f $BASEDIR/log/$2*
1380 BUILDMACHINE=`uname -m`
1381 prepareenv
1382 ipcopmake $2
1383 ;;
c6cb9d25
MT
1384build-silent)
1385 screen -dmS ipfire $0 build
1386 echo "Build started... This will take a while!"
1387 echo "You can see the status with 'screen -x ipfire'."
1388 ;;
cc0e56be
MT
1389mail)
1390 chmod 755 tools/sendEmail
1391 ATTACHMENT=/tmp/ipfire-build-logs-R$SVN_REVISION.tar.gz
1392 if [ "$2" = "ERROR" ]; then
1393 SUBJECT="ERROR: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
1394 echo "ERROR: $0 build!"
1395 cat <<END > /tmp/ipfire_mail_body
1396When I was building IPFire on `hostname`, I have found an ERROR!
1397Here you can see the logs and detect the reason for this error.
1398
1399Best Regards
1400Your IPFire-Build-Script
1401END
1402 fi
1403 if [ "$2" = "SUCCESS" ]; then
1404 SUBJECT="SUCCESS: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
1405 cat <<END > /tmp/ipfire_mail_body
1406Building IPFire on `hostname` in Revision $SVN_REVISION was successfull!
1407You can find the ISO on your ftp server.
1408
1409Statistics:
1410-----------
1411Started: $IPFIRE_START_TIME
1412Finished: `date`
1413
1414Best Regards
1415Your IPFire-Build-Script
1416END
1417 fi
1418 if [ "$2" = "SVNUPDATE" ]; then
1419 SUBJECT="SVNUPDATE: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
1420 echo "ERROR: $0 svn up!"
1421 cat <<END > /tmp/ipfire_mail_body
1422When I was downloading the latest svn source,
1423I have found an ERROR!
1424Here you can see the logs and detect the reason for this error.
1425
1426Best Regards
1427Your IPFire-Build-Script
1428END
1429 fi
712d859c
MT
1430
1431 if [ "$2" = "SVNDIST" ]; then
1432 SUBJECT="SVNDIST: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
1433 echo "ERROR: $0 svn dist!"
1434 cat <<END > /tmp/ipfire_mail_body
1435When I was exporting the latest svn source,
1436I have found an ERROR!
1437Here you can see the logs and detect the reason for this error.
1438
1439Best Regards
1440Your IPFire-Build-Script
1441END
1442 fi
1443
cc0e56be
MT
1444 if [ "$2" = "PREFETCH" ]; then
1445 SUBJECT="PREFETCH: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
1446 echo "ERROR: $0 prefetch!"
1447 cat <<END > /tmp/ipfire_mail_body
1448When I was downloading the source packages,
1449I have found an ERROR!
1450Here you can see the logs and detect the reason for this error.
1451
1452Best Regards
1453Your IPFire-Build-Script
1454END
1455 fi
1456
1457 if [ "$2" = "ISO" ]; then
1458 SUBJECT="ISO: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
1459 echo "ERROR: $0 upload iso!"
1460 cat <<END > /tmp/ipfire_mail_body
1461When I was uploading the iso image,
1462I have found an ERROR!
1463Here you can see the logs and detect the reason for this error.
1464
1465Best Regards
1466Your IPFire-Build-Script
1467END
1468 fi
1469
1470 if [ "$2" = "PAKS" ]; then
1471 SUBJECT="PAKS: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
1472 echo "ERROR: $0 upload paks!"
1473 cat <<END > /tmp/ipfire_mail_body
1474When I was uploading the packages,
1475I have found an ERROR!
1476Here you can see the logs and detect the reason for this error.
1477
1478Best Regards
1479Your IPFire-Build-Script
1480END
1481 fi
1482
1483 tar cfz $ATTACHMENT log/_build*
1484 cat <<END >> /tmp/ipfire_mail_body
1485
1486Here is a summary... The full logs are in the attachment.
1487---------------------------------------------------------
1488
1489`tail log/_*`
1490END
1491 cat /tmp/ipfire_mail_body | tools/sendEmail -q \
1492 -f $IPFIRE_MAIL_FROM \
1493 -t $IPFIRE_MAIL_REPORT \
1494 -u $SUBJECT \
1495 -s $IPFIRE_MAIL_SERVER:25 \
1496 -xu $IPFIRE_MAIL_USER \
1497 -xp $IPFIRE_MAIL_PASS \
1498 -l log/_build.mail.log \
1499 -a $ATTACHMENT # -v
1500 rm -f /tmp/ipfire_mail_body $ATTACHMENT
1501 ;;
1502unattended)
712d859c
MT
1503 if [ ! -f .config ]; then
1504 echo "No configuration found. Try ./make.sh make-config."
1505 fi
cc0e56be
MT
1506 ### This is our procedure that will compile the IPFire by herself...
1507 echo "### UPDATE LOGS"
1508 update_logs
1509 echo "### SAVING TIME"
1510 export IPFIRE_START_TIME=`date`
1511
ce56e927
MT
1512 echo "### GETTING TOOLCHAIN"
1513 $0 gettoolchain
1514
cc0e56be 1515 echo "### RUNNING SVN-UPDATE"
712d859c 1516 $0 svn update
cc0e56be
MT
1517 if [ $? -ne 0 ]; then
1518 $0 mail SVNUPDATE
1519 exit 1
1520 fi
712d859c
MT
1521
1522 echo "### EXPORT SOURCES"
1523 $0 svn dist
1524 if [ $? -ne 0 ]; then
1525 $0 mail SVNDIST
1526 exit 1
1527 fi
cc0e56be
MT
1528
1529 echo "### RUNNING PREFETCH"
1530 $0 prefetch | grep -q "md5 difference"
1531 if [ $? -eq 0 ]; then
1532 $0 mail PREFETCH
1533 exit 1
1534 fi
1535
1536 echo "### RUNNING BUILD"
1537 $0 build
1538 if [ $? -ne 0 ]; then
1539 $0 mail ERROR
1540 exit 1
1541 fi
1542
ce56e927
MT
1543 echo "### MAKING SOURCES-ISO"
1544 $0 sources-iso
1545
cc0e56be
MT
1546 echo "### UPLOADING ISO"
1547 $0 upload iso
1548 if [ $? -ne 0 ]; then
1549 $0 mail ISO
1550 exit 1
1551 fi
1552
1553 echo "### UPLOADING PAKS"
1554 $0 upload paks
1555 if [ $? -ne 0 ]; then
1556 $0 mail PAKS
1557 exit 1
1558 fi
1559
1560 echo "### SUCCESS!"
1561 $0 mail SUCCESS
712d859c 1562 exit 0
cc0e56be
MT
1563 ;;
1564batch)
712d859c
MT
1565 if [ `screen -ls | grep batch` ]; then
1566 echo "Build is already running, sorry!"
1567 exit 1
1568 else
1569 echo -n "IPFire-Batch-Build is starting..."
1570 screen -dmS ipfire $0 unattended
1571 if [ "$?" -eq "0" ]; then
1572 echo ".Done!"
1573 else
1574 echo ".ERROR!"
1575 exit 1
1576 fi
1577 #if [ "$2" -eq "-v" ]; then
1578 # screen -x ipfire
1579 #else
1580 # echo "You may attach you with '-v'."
1581 #fi
1582 exit 0
1583 fi
cc0e56be 1584 ;;
df5e82b3 1585*)
24a4a744
MT
1586 clear
1587 svn info
712d859c 1588 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
1589 do
1590 case $name in
c6cb9d25
MT
1591 "IPFIRE: Prefetch")
1592 $0 prefetch
1593 ;;
1594 "IPFIRE: Build (silent)")
1595 $0 build-silent
1596 ;;
1597 "IPFIRE: Watch Build")
1598 echo "Exit with Ctrl+A, Ctrl+D."
1599 echo -n "Preparing..."
1600 for i in `seq 10`; do
1601 sleep 0.1; echo -n "."
1602 done
1603 echo ".Ready!"
cc0e56be 1604 sleep 0.3
c6cb9d25
MT
1605 screen -x ipfire
1606 ;;
712d859c
MT
1607 "IPFIRE: Batch")
1608 $0 batch
1609 ;;
c6cb9d25
MT
1610 "IPFIRE: Clean")
1611 $0 clean
1612 ;;
1613 "SVN: Commit")
d63e8889
RZ
1614 echo "Are your sure to Update all Files to the Server (write: yes)?"; read input
1615 if [ "$input" == "yes" ]; then
1616 $0 svn commit
1617 fi
c6cb9d25
MT
1618 ;;
1619 "SVN: Update")
1620 $0 svn update
1621 ;;
1622 "SVN: Status")
1623 svn status # | grep -v ^?
1624 ;;
1625 "SVN: Diff")
1626 $0 svn diff
1627 ;;
1628 "Help")
1629 echo "Usage: $0 {build|changelog|check|checkclean|clean|gettoolchain|newpak|prefetch|shell|sync|toolchain}"
1630 cat doc/make.sh-usage
1631 ;;
712d859c
MT
1632 "LOG: Tail")
1633 tail -f log/_*
1634 ;;
c6cb9d25
MT
1635 "Exit")
1636 break
1637 ;;
24a4a744
MT
1638 esac
1639 done
df5e82b3 1640 ;;
3ea75603 1641esac