Habe IPFire auf LFS 6.2 gebracht.
[people/pmueller/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
028698e8 29 SLOGAN="www.ipfire.eu" # 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
dd714b8a
MT
67 echo "`date -u '+%b %e %T'`: Machine is i486 (or equivalent)" >> $LOGFILE
68 MACHINE=i486
69 BUILDTARGET=i486-pc-linux-gnu
70 CFLAGS="-O2 -mcpu=i486 -march=i486 -pipe -fomit-frame-pointer"
71 CXXFLAGS="-O2 -mcpu=i486 -march=i486 -pipe -fomit-frame-pointer"
df5e82b3 72 else
c6cb9d25 73 echo "`date -u '+%b %e %T'`: Can't determine your architecture - $MACHINE" >> $LOGFILE
df5e82b3
MT
74 exit 1
75 fi
76
77# Define immediately
78stdumount() {
79 umount $BASEDIR/build/dev/pts 2>/dev/null;
94025eea
MT
80 umount $BASEDIR/build/proc 2>/dev/null;
81 umount $BASEDIR/build/install/mnt 2>/dev/null;
df5e82b3
MT
82 umount $BASEDIR/build/usr/src/cache 2>/dev/null;
83 umount $BASEDIR/build/usr/src/ccache 2>/dev/null;
84 umount $BASEDIR/build/usr/src/config 2>/dev/null;
94025eea
MT
85 umount $BASEDIR/build/usr/src/doc 2>/dev/null;
86 umount $BASEDIR/build/usr/src/html 2>/dev/null;
df5e82b3 87 umount $BASEDIR/build/usr/src/langs 2>/dev/null;
94025eea
MT
88 umount $BASEDIR/build/usr/src/lfs 2>/dev/null;
89 umount $BASEDIR/build/usr/src/log 2>/dev/null;
90 umount $BASEDIR/build/usr/src/src 2>/dev/null;
df5e82b3
MT
91}
92
93exiterror() {
94 stdumount
95 for i in `seq 0 7`; do
96 if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
97 losetup -d /dev/loop${i} 2>/dev/null
98 fi;
99 done
100 echo "ERROR: $*"
101 echo " Check $LOGFILE for errors if applicable"
102 exit 1
103}
104
105entershell() {
106 if [ ! -e $BASEDIR/build/usr/src/lfs/ ]; then
107 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/"
108 fi
109 echo "Entering to a shell inside LFS chroot, go out with exit"
110 chroot $LFS /tools/bin/env -i HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
111 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
112 VERSION=$VERSION CONFIG_ROOT=$CONFIG_ROOT \
113 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
114 CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" \
115 CCACHE_DIR=/usr/src/ccache \
116 CCACHE_HASHDIR=1 \
117 KVER=$KVER \
118 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
119 KGCC="ccache /usr/bin/gcc" \
120 /tools/bin/bash
121 if [ $? -ne 0 ]; then
122 exiterror "chroot error"
123 else
124 stdumount
125 fi
126}
127
128prepareenv() {
129 ############################################################################
130 # #
131 # Are we running the right shell? #
132 # #
133 ############################################################################
134 if [ ! "$BASH" ]; then
135 exiterror "BASH environment variable is not set. You're probably running the wrong shell."
136 fi
137
138 if [ -z "${BASH_VERSION}" ]; then
139 exiterror "Not running BASH shell."
140 fi
141
142
143 ############################################################################
144 # #
145 # Trap on emergency exit #
146 # #
147 ############################################################################
148 trap "exiterror 'Build process interrupted'" SIGINT SIGTERM SIGKILL SIGSTOP SIGQUIT
149
150
151 ############################################################################
152 # #
153 # Resetting our nice level #
154 # #
155 ############################################################################
156 echo "`date -u '+%b %e %T'`: Resetting our nice level to $NICE" | tee -a $LOGFILE
157 renice $NICE $$ > /dev/null
158 if [ `nice` != "$NICE" ]; then
159 exiterror "Failed to set correct nice level"
160 fi
161
162 ############################################################################
163 # #
164 # Checking if running as root user #
165 # #
166 ############################################################################
167 echo "`date -u '+%b %e %T'`: Checking if we're running as root user" | tee -a $LOGFILE
168 if [ `id -u` != 0 ]; then
169 exiterror "Not building as root"
170 fi
171
172
173 ############################################################################
174 # #
175 # Checking for necessary temporary space #
176 # #
177 ############################################################################
178 echo "`date -u '+%b %e %T'`: Checking for necessary space on disk $BASE_DEV" | tee -a $LOGFILE
179 BASE_DEV=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $1 }'`
180 BASE_ASPACE=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $4 }'`
181 if (( 2202000 > $BASE_ASPACE )); then
182 BASE_USPACE=`du -skx $BASEDIR | awk '{print $1}'`
183 if (( 2202000 - $BASE_USPACE > $BASE_ASPACE )); then
184 exiterror "Not enough temporary space available, need at least 2.1GB on $BASE_DEV"
185 fi
186 fi
187
188 ############################################################################
189 # #
190 # Building Linux From Scratch system #
191 # #
192 ############################################################################
193 echo "`date -u '+%b %e %T'`: Building Linux From Scratch system" | tee -a $LOGFILE
194
195 # Set umask
196 umask 022
197
198 # Set LFS Directory
199 LFS=$BASEDIR/build
200
201 # Check /tools symlink
202 if [ -h /tools ]; then
203 rm -f /tools
204 fi
205 if [ ! -a /tools ]; then
206 ln -s $BASEDIR/build/tools /
207 fi
208 if [ ! -h /tools ]; then
209 exiterror "Could not create /tools symbolic link."
210 fi
211
212 # Setup environment
213 set +h
214 LC_ALL=POSIX
dd714b8a
MT
215 MAKETUNING="-j8"
216 export LFS LC_ALL CFLAGS CXXFLAGS MAKETUNING
df5e82b3
MT
217 unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
218
219 # Make some extra directories
220 mkdir -p $BASEDIR/build/{tools,etc,usr/src} 2>/dev/null
221 mkdir -p $BASEDIR/{cache,ccache} 2>/dev/null
222 mkdir -p $BASEDIR/build/dev/pts $BASEDIR/build/proc $BASEDIR/build/usr/src/{cache,config,doc,html,langs,lfs,log,src,ccache}
223
224 # Make all sources and proc available under lfs build
225 mount --bind /dev/pts $BASEDIR/build/dev/pts
226 mount --bind /proc $BASEDIR/build/proc
227 mount --bind $BASEDIR/cache $BASEDIR/build/usr/src/cache
228 mount --bind $BASEDIR/ccache $BASEDIR/build/usr/src/ccache
229 mount --bind $BASEDIR/config $BASEDIR/build/usr/src/config
230 mount --bind $BASEDIR/doc $BASEDIR/build/usr/src/doc
231 mount --bind $BASEDIR/html $BASEDIR/build/usr/src/html
232 mount --bind $BASEDIR/langs $BASEDIR/build/usr/src/langs
233 mount --bind $BASEDIR/lfs $BASEDIR/build/usr/src/lfs
234 mount --bind $BASEDIR/log $BASEDIR/build/usr/src/log
235 mount --bind $BASEDIR/src $BASEDIR/build/usr/src/src
236
237 # Run LFS static binary creation scripts one by one
238 export CCACHE_DIR=$BASEDIR/ccache
239 export CCACHE_HASHDIR=1
240
241 # Remove pre-install list of installed files in case user erase some files before rebuild
242 rm -f $BASEDIR/build/usr/src/lsalr 2>/dev/null
243}
244
245
246############################################################################
247# #
248# Necessary shell functions #
249# #
250############################################################################
251lfsmake1() {
252 if [ -f $BASEDIR/lfs/$1 ]; then
253 echo "`date -u '+%b %e %T'`: Building $*" | tee -a $LOGFILE
254 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t " download >> $LOGFILE 2>&1
255 if [ $? -ne 0 ]; then
256 exiterror "Download error in $1"
257 fi
258 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1
259 if [ $? -ne 0 ]; then
260 exiterror "md5sum error in $1, check file in cache or signature"
261 fi
262 cd $BASEDIR/lfs && make -f $* BUILDTARGET=$BUILDTARGET \
263 MACHINE=$MACHINE \
264 LFS_BASEDIR=$BASEDIR \
265 ROOT=$LFS \
266 KVER=$KVER \
dd714b8a 267 MAKETUNING=$MAKETUNING \
df5e82b3
MT
268 install >> $LOGFILE 2>&1
269 if [ $? -ne 0 ]; then
270 exiterror "Building $*";
271 fi
272 else
273 exiterror "No such file or directory: $BASEDIR/$1"
274 fi
275 return 0
276}
277
278lfsmake2() {
279 if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then
280 echo "`date -u '+%b %e %T'`: Building $*" | tee -a $LOGFILE
281 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t " download >> $LOGFILE 2>&1
282 if [ $? -ne 0 ]; then
283 exiterror "Download error in $1"
284 fi
285 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1
286 if [ $? -ne 0 ]; then
287 exiterror "md5sum error in $1, check file in cache or signature"
288 fi
289 chroot $LFS /tools/bin/env -i HOME=/root \
290 TERM=$TERM PS1='\u:\w\$ ' \
291 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
292 VERSION=$VERSION \
293 CONFIG_ROOT=$CONFIG_ROOT \
294 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
295 CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" \
296 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
dd714b8a 297 KVER=$KVER MAKETUNING=$MAKETUNING \
df5e82b3
MT
298 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
299 /tools/bin/bash -x -c "cd /usr/src/lfs && \
300 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
301 if [ $? -ne 0 ]; then
302 exiterror "Building $*"
303 fi
304 else
305 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
306 fi
307 return 0
308}
309
310ipcopmake() {
311 if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then
312 echo "`date -u '+%b %e %T'`: Building $*" | tee -a $LOGFILE
313 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t " download >> $LOGFILE 2>&1
314 if [ $? -ne 0 ]; then
315 exiterror "Download error in $1"
316 fi
317 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1
318 if [ $? -ne 0 ]; then
319 exiterror "md5sum error in $1, check file in cache or signature"
320 fi
321 chroot $LFS /tools/bin/env -i HOME=/root \
322 TERM=$TERM PS1='\u:\w\$ ' \
323 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \
324 VERSION=$VERSION \
325 CONFIG_ROOT=$CONFIG_ROOT \
326 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
327 CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" \
328 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
dd714b8a 329 KVER=$KVER MAKETUNING=$MAKETUNING \
df5e82b3
MT
330 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
331 /bin/bash -x -c "cd /usr/src/lfs && \
332 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
333 if [ $? -ne 0 ]; then
334 exiterror "Building $*"
335 fi
336 else
337 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
338 fi
339 return 0
340}
341
e7164bb4
MT
342ipfiredist() {
343 if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then
344 echo "`date -u '+%b %e %T'`: Packaging $1" | tee -a $LOGFILE
e7164bb4
MT
345 chroot $LFS /tools/bin/env -i HOME=/root \
346 TERM=$TERM PS1='\u:\w\$ ' \
347 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \
348 VERSION=$VERSION \
349 CONFIG_ROOT=$CONFIG_ROOT \
350 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
351 CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" \
352 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
353 KVER=$KVER \
354 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
355 /bin/bash -x -c "cd /usr/src/lfs && \
356 make -f $1 LFS_BASEDIR=/usr/src dist" >>$LOGFILE 2>&1
357 if [ $? -ne 0 ]; then
358 exiterror "Packaging $1"
359 fi
360 else
361 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
362 fi
e7164bb4
MT
363 return 0
364}
365
df5e82b3
MT
366
367installmake() {
368 if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then
369 echo "`date -u '+%b %e %T'`: Building $*" | tee -a $LOGFILE
370 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t " download >> $LOGFILE 2>&1
371 if [ $? -ne 0 ]; then
372 exiterror "Download error in $1"
373 fi
374 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1
375 if [ $? -ne 0 ]; then
376 exiterror "md5sum error in $1, check file in cache or signature"
377 fi
378 chroot $LFS /tools/bin/env -i HOME=/root \
379 TERM=$TERM PS1='\u:\w\$ ' \
380 PATH=/usr/local/bin:/opt/$MACHINE-uClibc/usr/bin:/bin:/usr/bin:/sbin:/usr/sbin \
381 VERSION=$VERSION \
382 CONFIG_ROOT=$CONFIG_ROOT \
383 LFS_PASS="install" \
384 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
385 CFLAGS="-Os" CXXFLAGS="-Os" \
386 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
387 KVER=$KVER \
388 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
389 /bin/bash -x -c "cd /usr/src/lfs && \
390 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
391 if [ $? -ne 0 ]; then
392 exiterror "Building $*"
393 fi
394 else
395 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
396 fi
397 return 0
398}
399
400buildtoolchain() {
401 LOGFILE="$BASEDIR/log/_build.toolchain.log"
402 export LOGFILE
403 echo -ne "`date -u '+%b %e %T'`: Stage1 toolchain build \n" | tee -a $LOGFILE
404 # Build sed now, as we use some extensions
405 ORG_PATH=$PATH
406 NATIVEGCC=`gcc --version | grep GCC | awk {'print $3'}`
407 export NATIVEGCC GCCmajor=${NATIVEGCC:0:1} GCCminor=${NATIVEGCC:2:1} GCCrelease=${NATIVEGCC:4:1}
dd714b8a 408 echo -ne "`date -u '+%b %e %T'`: Native GCC: $NATIVEGCC\n"
df5e82b3 409 lfsmake1 ccache
dd714b8a
MT
410 lfsmake1 binutils LFS_PASS=1
411 lfsmake1 gcc LFS_PASS=1
df5e82b3 412 export PATH=$BASEDIR/build/usr/local/bin:$BASEDIR/build/tools/bin:$PATH
dd714b8a
MT
413 lfsmake1 linux-libc-header
414 lfsmake1 glibc
df5e82b3
MT
415 lfsmake1 tcl
416 lfsmake1 expect
df5e82b3 417 lfsmake1 dejagnu
dd714b8a
MT
418 lfsmake1 gcc LFS_PASS=2
419 lfsmake1 binutils LFS_PASS=2
420 lfsmake1 ncurses
421 lfsmake1 bash
df5e82b3 422 lfsmake1 bzip2
dd714b8a 423 lfsmake1 coreutils
df5e82b3
MT
424 lfsmake1 diffutils
425 lfsmake1 findutils
dd714b8a 426 lfsmake1 gawk
df5e82b3 427 lfsmake1 gettext
dd714b8a
MT
428 lfsmake1 grep
429 lfsmake1 gzip
430 lfsmake1 m4
431 lfsmake1 make
df5e82b3 432 lfsmake1 patch
dd714b8a
MT
433 lfsmake1 perl
434 lfsmake1 sed
df5e82b3
MT
435 lfsmake1 tar
436 lfsmake1 texinfo
df5e82b3 437 lfsmake1 util-linux
dd714b8a 438 lfsmake1 cleanup-toolchain
df5e82b3
MT
439 export PATH=$ORG_PATH
440}
441
442buildbase() {
443 LOGFILE="$BASEDIR/log/_build.base.log"
444 export LOGFILE
445 echo -ne "`date -u '+%b %e %T'`: Stage2 linux base build \n" | tee -a $LOGFILE
446 # Run LFS dynamic binary creation scripts one by one
447 lfsmake2 stage2
448 lfsmake2 makedev
449 lfsmake2 linux
450 lfsmake2 man-pages
451 lfsmake2 glibc
452 lfsmake2 binutils
453 lfsmake2 gcc
454 lfsmake2 coreutils
455 lfsmake2 zlib
456 lfsmake2 mktemp
457 lfsmake2 iana-etc
458 lfsmake2 findutils
459 lfsmake2 gawk
460 lfsmake2 ncurses
461 lfsmake2 vim
462 lfsmake2 m4
463 lfsmake2 bison
464 lfsmake2 less
465 lfsmake2 groff
466 lfsmake2 sed
467 lfsmake2 flex
468 lfsmake2 gettext
469 lfsmake2 net-tools
470 lfsmake2 inetutils
471 lfsmake2 perl
472 lfsmake2 texinfo
473 lfsmake2 autoconf
474 lfsmake2 automake
475 lfsmake2 bash
476 lfsmake2 file
477 lfsmake2 libtool
478 lfsmake2 bzip2
479 lfsmake2 diffutils
480 lfsmake2 ed
481 lfsmake2 kbd
482 lfsmake2 e2fsprogs
483 lfsmake2 grep
484 if [ 'i386' = $MACHINE ]; then
485 lfsmake2 grub
486 elif [ 'alpha' = $MACHINE ]; then
487 lfsmake2 aboot
488 fi
489 lfsmake2 gzip
490 lfsmake2 man
491 lfsmake2 make
492 lfsmake2 modutils
493 lfsmake2 patch
494 lfsmake2 procinfo
495 lfsmake2 procps
496 lfsmake2 psmisc
497 lfsmake2 shadow
498 lfsmake2 sysklogd
499 lfsmake2 sysvinit
500 lfsmake2 tar
501 lfsmake2 util-linux
502}
503
504buildipcop() {
907cd036
MT
505 # Run IPFire make scripts one by one
506 LOGFILE="$BASEDIR/log/_build.ipfire.log"
df5e82b3
MT
507 export LOGFILE
508 echo -ne "`date -u '+%b %e %T'`: Stage3 $NAME build \n" | tee -a $LOGFILE
509
510 # Build these first as some of the kernel packages below rely on
511 # these for some of their client program functionality
512 ipcopmake configroot
513 ipcopmake dhcp
514 ipcopmake dhcpcd
515 ipcopmake libusb
516 ipcopmake libpcap
517 ipcopmake linux-atm
518 ipcopmake ppp
519 ipcopmake rp-pppoe
520 ipcopmake unzip
521 # Do SMP now
522 if [ 'i386' = $MACHINE ]; then
523 # abuse the SMP flag, and make an minimal installer kernel first
524 # so that the boot floppy always works.....
3e45cc09
MT
525 ipcopmake linux LFS_PASS=ipfire SMP=installer
526 ipcopmake linux LFS_PASS=ipfire SMP=1
df5e82b3
MT
527 ipcopmake 3cp4218 SMP=1
528 ipcopmake amedyn SMP=1
529 ipcopmake cxacru SMP=1
530 ipcopmake eagle SMP=1
531
532 # These are here because they have i386 only binary libraries
533 # included in the package.
534 ipcopmake cnx_pci SMP=1
535 ipcopmake fcdsl SMP=1
536 ipcopmake fcdsl2 SMP=1
537 ipcopmake fcdslsl SMP=1
538 ipcopmake fcdslusb SMP=1
539 ipcopmake fcdslslusb SMP=1
6ca65b88 540 ipcopmake fcpci SMP=1
ff7df9d4 541 ipcopmake fcclassic SMP=1
df5e82b3
MT
542 ipcopmake pulsar SMP=1
543 ipcopmake unicorn SMP=1
1fde937c 544 ipcopmake promise-sata-300-tx SMP=1
df5e82b3
MT
545 fi
546
3e45cc09 547 ipcopmake linux LFS_PASS=ipfire
df5e82b3
MT
548 ipcopmake 3cp4218
549 ipcopmake amedyn
550 ipcopmake cxacru
551 ipcopmake eciadsl
552 ipcopmake eagle
553 ipcopmake speedtouch
554 if [ 'i386' = $MACHINE ]; then
555 # These are here because they have i386 only binary libraries
556 # included in the package.
557 ipcopmake cnx_pci
558 ipcopmake fcdsl
559 ipcopmake fcdsl2
560 ipcopmake fcdslsl
561 ipcopmake fcdslusb
6ca65b88 562 ipcopmake fcdslslusb
ff7df9d4
MT
563 ipcopmake fcpci
564 ipcopmake fcclassic
1fde937c
MT
565 ipcopmake pulsar
566 ipcopmake unicorn
567 ipcopmake promise-sata-300-tx
df5e82b3
MT
568 fi
569
570 ipcopmake pcmcia-cs
571 ipcopmake expat
572 ipcopmake gdbm
573 ipcopmake gmp
574 ipcopmake openssl
575 ipcopmake python
576 ipcopmake libnet
577 ipcopmake libpng
2ae94d2d
MT
578 ipcopmake libtiff
579 ipcopmake libjpeg
580 ipcopmake lcms
581 ipcopmake libmng
582 ipcopmake freetype
df5e82b3
MT
583 ipcopmake gd
584 ipcopmake popt
585 ipcopmake slang
586 ipcopmake newt
587 ipcopmake libcap
588 ipcopmake pciutils
589 ipcopmake pcre
7b6b8153 590 ipcopmake readline
048123a8 591 ipcopmake libxml2
f4509bca
MT
592 ipcopmake berkeley
593 ipcopmake BerkeleyDB ## The Perl module
594 ipcopmake mysql
7b6b8153
MT
595 ipcopmake saslauthd PASS=1
596 ipcopmake openldap
7b6b8153
MT
597 ipcopmake apache2
598 ipcopmake php
e8babc92
MT
599 ipcopmake subversion
600 ipcopmake apache2 PASS=CONFIG
df5e82b3
MT
601 ipcopmake arping
602 ipcopmake beep
603 ipcopmake bind
604 ipcopmake capi4k-utils
605 ipcopmake cdrtools
606 ipcopmake dnsmasq
607 ipcopmake dosfstools
608 ipcopmake ethtool
609 ipcopmake ez-ipupdate
610 ipcopmake fcron
611 ipcopmake perl-GD
612 ipcopmake gnupg
613 ipcopmake hdparm
614 ipcopmake ibod
615 ipcopmake initscripts
616 ipcopmake iptables
617 ipcopmake ipac-ng
618 ipcopmake ipaddr
619 ipcopmake iproute2
620 ipcopmake iptstate
621 ipcopmake iputils
78331e30 622 ipcopmake l7-protocols
df5e82b3
MT
623 ipcopmake isapnptools
624 ipcopmake isdn4k-utils
625 ipcopmake kudzu
626 ipcopmake logrotate
627 ipcopmake logwatch
628 ipcopmake mingetty
629 ipcopmake misc-progs
630 ipcopmake mtools
631 ipcopmake nano
632 ipcopmake nash
633 ipcopmake nasm
634 ipcopmake URI
635 ipcopmake HTML-Tagset
636 ipcopmake HTML-Parser
637 ipcopmake Compress-Zlib
638 ipcopmake Digest
639 ipcopmake Digest-SHA1
640 ipcopmake Digest-HMAC
641 ipcopmake libwww-perl
642 ipcopmake Net-DNS
643 ipcopmake Net-IPv4Addr
644 ipcopmake Net_SSLeay
4f8b6695
MT
645 ipcopmake IO-Stringy
646 ipcopmake Unix-Syslog
647 ipcopmake Mail-Tools
648 ipcopmake MIME-Tools
649 ipcopmake Net-Server
650 ipcopmake Convert-TNEF
651 ipcopmake Convert-UUlib
652 ipcopmake Archive-Tar
653 ipcopmake Archive-Zip
f28d0ddc 654 ipcopmake Text-Tabs+Wrap
90350ff3 655 ipcopmake Locale-Country
dace10b5 656 ipcopmake GeoIP
df8c7810 657 ipcopmake fwhits
df5e82b3
MT
658 ipcopmake noip_updater
659 ipcopmake ntp
660 ipcopmake oinkmaster
661 ipcopmake openssh
662 ipcopmake openswan
663 ipcopmake pptpclient
664 ipcopmake rrdtool
665 ipcopmake setserial
666 ipcopmake setup
667 ipcopmake snort
df5e82b3
MT
668 ipcopmake squid
669 ipcopmake squid-graph
60cbd6e7 670 ipcopmake squidguard
df5e82b3
MT
671 ipcopmake tcpdump
672 ipcopmake traceroute
673 ipcopmake vlan
0145f271 674 ipcopmake wireless
df5e82b3
MT
675 ipcopmake libsafe
676 ipcopmake 3c5x9setup
b34fd95d 677 ipcopmake pakfire
6ef0bff8 678 ipcopmake startscripts
6ef0bff8 679 ipcopmake java
a7b1824c 680 ipcopmake bootsplash
5e69ef1a
MT
681 ipcopmake spandsp
682 ipcopmake lzo
6ef0bff8 683 ipcopmake openvpn
f8e5510c
MT
684 ipcopmake pkg-config
685 ipcopmake glib
5e69ef1a
MT
686 ipcopmake pam
687 ipcopmake pammysql
371d9df0 688 ipcopmake saslauthd PASS=2
a31b2bc4 689 ipcopmake xinetd
316160b0
MT
690 ipcopmake ghostscript
691 ipcopmake cups
98d413ac 692 ipcopmake samba
5e69ef1a
MT
693 ipcopmake sudo
694 ipcopmake mc
1fe6c87b 695 ipcopmake wget
60cbd6e7 696 ipcopmake wput
1fe6c87b 697 ipcopmake bridge-utils
3e45cc09
MT
698 ipcopmake screen
699 ipcopmake hddtemp
1fde937c 700 ipcopmake smartmontools
3e45cc09
MT
701 ipcopmake htop
702 ipcopmake lynx
b34fd95d 703 echo -ne "`date -u '+%b %e %T'`: Building ### Mailserver ### \n" | tee -a $LOGFILE
94025eea 704 ipcopmake postfix
6c666a3b 705 ipcopmake procmail
93dc5548
MT
706 ipcopmake fetchmail
707 ipcopmake cyrusimap
f1baee3e 708 ipcopmake webcyradm
33a31f1a 709 ipcopmake mailx
f9315063
MT
710 ipcopmake clamav
711 ipcopmake razor
4f8b6695 712 ipcopmake spamassassin
f28d0ddc 713# ipcopmake amavisd
b34fd95d 714 echo -ne "`date -u '+%b %e %T'`: Building ### VoIP-Server ### \n" | tee -a $LOGFILE
94025eea 715 ipcopmake stund
b684b13b
MT
716 ipcopmake zaptel
717 ipcopmake libpri
718 ipcopmake bristuff
40a4ea4c 719 ipcopmake asterisk
894c6feb 720 ipcopmake mpg123
d1b6aa72 721 echo -ne "`date -u '+%b %e %T'`: Building ### Multimedia-Server ### \n" | tee -a $LOGFILE
8a7ededb 722 ipcopmake libmad
5ac2da9f
MT
723 ipcopmake libogg
724 ipcopmake libvorbis
316160b0 725 ipcopmake lame
d1b6aa72
MT
726 ipcopmake xvid
727 ipcopmake mpeg2dec
728 ipcopmake ffmpeg
5ac2da9f 729 ipcopmake sox
316160b0 730 ipcopmake gnump3d
d1b6aa72 731 ipcopmake videolan
6ef0bff8
MT
732 echo -ne "`date -u '+%b %e %T'`: Building ### P2P-Clients ### \n" | tee -a $LOGFILE
733 ipcopmake applejuice
02dc0a76
MT
734 ipcopmake ocaml
735 ipcopmake mldonkey
3e45cc09
MT
736 echo -ne "`date -u '+%b %e %T'`: Building ### Net-Tools ### \n" | tee -a $LOGFILE
737 ipcopmake ntop
f1baee3e 738 ipcopmake rsync
3b9f6349 739 ipcopmake tcpwrapper
769a61c5 740 ipcopmake portmap
894c6feb 741 ipcopmake nfs
907cd036 742 ipcopmake nmap
52345790 743 ipcopmake mbmon
3e45cc09 744 ipcopmake iftop
ef05c8bb 745 ipcopmake ncftp
ca35618d 746 ipcopmake cftp
60cbd6e7 747 ipcopmake etherwake
33a31f1a 748 ipcopmake ethereal
712d859c 749 ipcopmake tftp-hpa
7a98bae5 750 ipcopmake iptraf
2ae94d2d 751 ipcopmake nagios
0145f271 752 ipcopmake yasuc
df5e82b3
MT
753}
754
755buildinstaller() {
756 # Run installer scripts one by one
757 LOGFILE="$BASEDIR/log/_build.installer.log"
758 export LOGFILE
759 echo -ne "`date -u '+%b %e %T'`: Stage4 installer build \n" | tee -a $LOGFILE
760 if [ 'i386' = $MACHINE ]; then
761 ipcopmake syslinux
762 ipcopmake as86
763 ipcopmake mbr
764 ipcopmake uClibc
765 fi
766 installmake busybox
767 installmake sysvinit
768 installmake e2fsprogs
769 installmake misc-progs
770 installmake slang
771 installmake util-linux
772 installmake newt
773 installmake pciutils
774 installmake pcmcia-cs
775 installmake kbd
776 installmake installer
777 installmake scsi.img
778 installmake driver.img
779 installmake initrd
780 installmake boot.img
781}
782
783buildpackages() {
784 LOGFILE="$BASEDIR/log/_build.packages.log"
785 export LOGFILE
786 echo "... see detailed log in _build.*.log files" >> $LOGFILE
787 echo -ne "`date -u '+%b %e %T'`: Stage5 packages build \n" | tee -a $LOGFILE
788 # Strip files
789 echo "`date -u '+%b %e %T'`: Stripping files" | tee -a $LOGFILE
790 find $LFS/lib $LFS/usr/lib $LFS/usr/share/rrdtool-* $LFS/install ! -type l \( -name '*.so' -o -name '*.so[\.0-9]*' \) \
791 ! -name 'libc.so' ! -name 'libpthread.so' ! -name 'libcrypto.so.0.9.7.sha1' \
90350ff3 792 -exec $LFS/tools/bin/strip --strip-all {} \; >> $LOGFILE 2>&1
df5e82b3
MT
793 # add -ls before -exec if you want to verify what files are stripped
794
795 find $LFS/{,s}bin $LFS/usr/{,s}bin $LFS/usr/local/{,s}bin ! -type l \
796 -exec file {} \; | grep " ELF " | cut -f1 -d ':' | xargs $LFS/tools/bin/strip --strip-all >> $LOGFILE 2>&1
797 # there add -v to strip to verify
798
799 if [ 'i386' = $MACHINE ]; then
800 # Create fcdsl packages
801 echo "`date -u '+%b %e %T'`: Building fcdsl tgz" | tee -a $LOGFILE
802 cp $LFS/install/images/fcdsl/license.txt $LFS >> $LOGFILE 2>&1
803 touch $LFS/var/run/{need-depmod-$KVER,need-depmod-$KVER-smp}
804 cd $LFS && tar cvfz $LFS/install/images/$SNAME-fcdsl-$VERSION.$MACHINE.tgz \
805 lib/modules/$KVER/misc/fcdsl*.o.gz \
806 lib/modules/$KVER-smp/misc/fcdsl*.o.gz \
807 usr/lib/isdn/{fds?base.bin,fd?ubase.frm} \
808 etc/fcdsl/fcdsl*.conf \
809 etc/drdsl/{drdsl,drdsl.ini} \
810 license.txt \
811 var/run/{need-depmod-$KVER,need-depmod-$KVER-smp} >> $LOGFILE 2>&1
812 rm -f $LFS/license.txt >> $LOGFILE 2>&1
813 cd $BASEDIR
814 fi
df5e82b3
MT
815
816 # Generating list of packages used
817 echo "`date -u '+%b %e %T'`: Generating packages list from logs" | tee -a $LOGFILE
818 rm -f $BASEDIR/doc/packages-list
819 for i in `ls -1tr $BASEDIR/log/[^_]*`; do
820 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
7471f6ab 821 echo "* `basename $i`" >>$BASEDIR/doc/packages-list
df5e82b3
MT
822 fi
823 done
7471f6ab 824 echo "== List of softwares used to build $NAME Version: $VERSION ==" > $BASEDIR/doc/packages-list.txt
f522e307 825 grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|ipfire$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$\|.tgz$\|-config$' \
df5e82b3
MT
826 $BASEDIR/doc/packages-list | sort >> $BASEDIR/doc/packages-list.txt
827 rm -f $BASEDIR/doc/packages-list
c9673262 828 # packages-list.txt is ready to be displayed for wiki page
df5e82b3 829
f522e307 830 # Create ISO for CDROM
c3defe9b 831 ipcopmake cdrom
e67a57fe 832 rm -f $LFS/install/images/*usb*
c3defe9b 833 cp $LFS/install/images/{*.iso,*.tgz} $BASEDIR >> $LOGFILE 2>&1
c9673262 834
e67a57fe
MT
835 ipfirepackages
836
837 # Cleanup
838 stdumount
839 rm -rf $BASEDIR/build/tmp/*
840
841 # Generating total list of files
842 echo "`date -u '+%b %e %T'`: Generating files list from logs" | tee -a $LOGFILE
843 rm -f $BASEDIR/log/FILES
844 for i in `ls -1tr $BASEDIR/log/[^_]*`; do
845 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
846 echo "##" >>$BASEDIR/log/FILES
847 echo "## `basename $i`" >>$BASEDIR/log/FILES
848 echo "##" >>$BASEDIR/log/FILES
849 cat $i | sed "s%^\./%#%" | sort >> $BASEDIR/log/FILES
850 fi
851 done
913668ba 852 cd $BASEDIR/packages; ls -w1 *.ipfire | awk -F ".ipfire" '{ print $1 }' > $BASEDIR/packages/packages_list.txt
5e773594 853 echo -n "###EOF###" >> $BASEDIR/packages/packages_list.txt
e67a57fe
MT
854
855 cd $PWD
856
857}
858
859ipfirepackages() {
013a23e2
MT
860 if [ -d "$BASEDIR/packages" ]; then
861 for i in `ls $BASEDIR/packages`; do
862 touch $BASEDIR/build/install/packages/$i.empty
863 done
864 fi
f1baee3e 865# ipfiredist amavisd
78331e30 866 ipfiredist applejuice
5ac2da9f 867 ipfiredist asterisk
c7acba4a 868 ipfiredist clamav
483f59cd 869 ipfiredist cups
78331e30
MT
870 ipfiredist cyrusimap
871 ipfiredist fetchmail
d1b6aa72 872 ipfiredist ffmpeg
78331e30 873 ipfiredist gnump3d
7a98bae5 874 ipfiredist iptraf
0d0521b6 875 ipfiredist java
78331e30 876 ipfiredist lame
d1b6aa72 877 ipfiredist libmad
ae179f6e 878 ipfiredist libogg
78331e30 879 ipfiredist libtiff
ae179f6e 880 ipfiredist libvorbis
f0ca8c34 881 ipfiredist mailx
3ab910dd 882 ipfiredist mldonkey
d1b6aa72 883 ipfiredist mpeg2dec
2ae94d2d 884 ipfiredist nagios
f0ca8c34
MT
885 ipfiredist nfs
886 ipfiredist nmap
3e45cc09 887 ipfiredist ntop
27ac55bf 888 ipfiredist portmap
78331e30 889 ipfiredist postfix
371d9df0 890 ipfiredist procmail
90350ff3 891 ipfiredist samba
ae179f6e 892 ipfiredist sox
f0ca8c34 893 ipfiredist spamassassin
7a98bae5 894 ipfiredist subversion
d1b6aa72 895 ipfiredist videolan
f1baee3e 896 ipfiredist webcyradm
d1b6aa72 897 ipfiredist xvid
0145f271 898 ipfiredist yasuc
78331e30 899 test -d $BASEDIR/packages || mkdir $BASEDIR/packages
d535503d 900 mv -f $LFS/install/packages/*.{ipfire,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 914 #only restore on a clean disk
dd714b8a 915 if [ ! -f log/cleanup-toolchain-*-tools ]; then
df5e82b3
MT
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
028698e8 1158 echo "Loading the latest source files..."
7471f6ab
MT
1159 if [ $3 ]; then
1160 svn update -r $3 | tee -a $PWD/log/_build.svn.update.log
1161 else
1162 svn update | tee -a $PWD/log/_build.svn.update.log
1163 fi
c6cb9d25 1164 if [ $? -eq 0 ]; then
028698e8 1165 echo "Finished!"
c6cb9d25 1166 else
028698e8 1167 echo "Failure!"
c6cb9d25
MT
1168 exit 1
1169 fi
028698e8 1170 echo -n "Writing the svn-info to a file..."
c6cb9d25
MT
1171 svn info > $PWD/svn_status
1172 if [ "$?" -eq "0" ]; then
028698e8 1173 echo ".Finished!"
c6cb9d25 1174 else
028698e8 1175 echo ".Failure!"
c6cb9d25
MT
1176 exit 1
1177 fi
712d859c 1178 chmod 755 $0
cc0e56be 1179 exit 0
c6cb9d25
MT
1180 ;;
1181 commit|ci)
1182 clear
d79b46cb 1183 if [ -e /sbin/yast ]; then
028698e8
MT
1184 if [ "`echo $SVN_REVISION | cut -c 3`" -eq "0" ]; then
1185 $0 changelog
1186 fi
d79b46cb
MT
1187 fi
1188 echo "Upload the changed files..."
c6cb9d25 1189 sleep 1
d79b46cb
MT
1190 IPFIRE_SVN_MESSAGE=/tmp/ipfire-svn-co-message.txt
1191 rm -f $IPFIRE_SVN_MESSAGE
1192 mcedit $IPFIRE_SVN_MESSAGE
1193 svn commit -F $IPFIRE_SVN_MESSAGE
1194 rm -f $IPFIRE_SVN_MESSAGE
c6cb9d25
MT
1195 $0 svn up
1196 ;;
1197 dist)
7471f6ab
MT
1198 if [ $3 ]; then
1199 SVN_REVISION=$3
1200 fi
1201 if [ -f ipfire-source-r$SVN_REVISION.tar.gz ]; then
1202 echo -ne "REV $SVN_REVISION: SKIPPED!\n"
1203 exit 0
1204 fi
1205 echo -en "REV $SVN_REVISION: Downloading..."
c6cb9d25 1206 svn export http://svn.ipfire.eu/svn/ipfire ipfire-source/ --force > /dev/null
7471f6ab 1207 svn log http://svn.ipfire.eu/svn/ipfire -r 1:$SVN_REVISION > ipfire-source/Changelog
9fa7d717 1208 #svn info http://svn.ipfire.eu/svn/ipfire -r $SVN_REVISION > ipfire-source/svn_status
c6cb9d25 1209 if [ "$?" -eq "0" ]; then
7471f6ab 1210 echo -en "\r"
c6cb9d25 1211 else
7471f6ab 1212 echo -en "\n"
c6cb9d25
MT
1213 exit 1
1214 fi
7471f6ab
MT
1215 echo -en "REV $SVN_REVISION: Compressing files..."
1216 if [ -e ipfire-source/trunk/make.sh ]; then
1217 chmod 755 ipfire-source/trunk/make.sh
1218 fi
9dc02b38 1219 tar cfz ipfire-source-r$SVN_REVISION.tar.gz ipfire-source
c6cb9d25 1220 if [ "$?" -eq "0" ]; then
7471f6ab 1221 echo -ne "\r"
c6cb9d25 1222 else
7471f6ab 1223 echo -ne "\n"
c6cb9d25
MT
1224 exit 1
1225 fi
7471f6ab 1226 echo -en "REV $SVN_REVISION: Cleaning up..."
c6cb9d25
MT
1227 rm ipfire-source/ -r
1228 if [ "$?" -eq "0" ]; then
7471f6ab 1229 echo -ne "\rREV $SVN_REVISION: ##### FINISHED! #####\n"
c6cb9d25 1230 else
7471f6ab 1231 echo -ne "\n"
c6cb9d25
MT
1232 exit 1
1233 fi
1234 ;;
7471f6ab
MT
1235 alldist|ad)
1236 echo -e "### THIS WILL TAKE A LONG TIME!\nDOING A FETCH FROM REV 1 TO REV $SVN_REVISION!\n"
1237 for i in `seq 1 $SVN_REVISION`; do
1238 $0 svn dist $i
1239 done
1240 ;;
028698e8 1241 diff|di)
c6cb9d25
MT
1242 echo -ne "Make a local diff to last svn revision..."
1243 svn diff > ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff
1244 if [ "$?" -eq "0" ]; then
1245 echo ".Done!"
1246 else
1247 echo ".Fail!"
1248 exit 1
1249 fi
1250 echo "Diff was successfully saved to ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff"
1251 ;;
1252 esac
f9315063 1253 ;;
cc0e56be
MT
1254make-config)
1255 echo -e "This is for creating your configuration..."
cc0e56be
MT
1256 echo -e "We will need some input:"
1257 echo -e ""
1258 echo -n "FTP-DOMAIN FOR THE ISO: "
1259 read IPFIRE_FTP_URL_EXT
1260 echo -n "PATH FOR $IPFIRE_FTP_URL_EXT: "
1261 read IPFIRE_FTP_PATH_EXT
1262 echo -n "USERNAME FOR $IPFIRE_FTP_URL_EXT: "
1263 read IPFIRE_FTP_USER_EXT
1264 echo -n "PASSWORD FOR $IPFIRE_FTP_URL_EXT: "
712d859c 1265 read -s IPFIRE_FTP_PASS_EXT
cc0e56be
MT
1266 echo ""
1267 echo "(You can leave this empty if the cache-server is the same as your iso-server.)"
1268 echo -n "FTP-DOMAIN FOR THE CACHE: "
1269 read IPFIRE_FTP_URL_INT
1270 echo -n "PATH FOR $IPFIRE_FTP_URL_INT: "
1271 read IPFIRE_FTP_PATH_INT
1272 if [ $IPFIRE_FTP_URL_INT ]; then
1273 echo -n "USERNAME FOR $IPFIRE_FTP_URL_INT: "
1274 read IPFIRE_FTP_USER_INT
1275 echo -n "PASSWORD FOR $IPFIRE_FTP_URL_INT: "
712d859c 1276 read -s IPFIRE_FTP_PASS_INT
cc0e56be
MT
1277 else
1278 IPFIRE_FTP_URL_INT=$IPFIRE_FTP_URL_EXT
1279 IPFIRE_FTP_USER_INT=$IPFIRE_FTP_USER_EXT
1280 IPFIRE_FTP_PASS_INT=$IPFIRE_FTP_PASS_EXT
1281 echo "USERNAME FOR $IPFIRE_FTP_URL_INT: $IPFIRE_FTP_USER_INT"
712d859c 1282 echo "PASSWORD FOR $IPFIRE_FTP_URL_INT: !HIDDEN!"
cc0e56be
MT
1283 fi
1284 echo ""
1285 echo "(You can leave this empty if the pak-server is the same as your iso-server.)"
1286 echo -n "FTP-DOMAIN FOR THE PAKS: "
1287 read IPFIRE_FTP_URL_PAK
1288 echo -n "PATH FOR $IPFIRE_FTP_URL_PAK: "
1289 read IPFIRE_FTP_PATH_PAK
1290 if [ $IPFIRE_FTP_URL_PAK ]; then
1291 echo -n "USERNAME FOR $IPFIRE_FTP_URL_PAK: "
1292 read IPFIRE_FTP_USER_PAK
1293 echo -n "PASSWORD FOR $IPFIRE_FTP_URL_PAK: "
712d859c 1294 read -s IPFIRE_FTP_PASS_PAK
a68fedca 1295 else
cc0e56be
MT
1296 IPFIRE_FTP_URL_PAK=$IPFIRE_FTP_URL_EXT
1297 IPFIRE_FTP_USER_PAK=$IPFIRE_FTP_USER_EXT
1298 IPFIRE_FTP_PASS_PAK=$IPFIRE_FTP_PASS_EXT
1299 echo "USERNAME FOR $IPFIRE_FTP_URL_PAK: $IPFIRE_FTP_USER_PAK"
712d859c 1300 echo "PASSWORD FOR $IPFIRE_FTP_URL_PAK: !HIDDEN!"
a68fedca 1301 fi
cc0e56be
MT
1302 echo ""
1303 echo -e "ONE OR MORE EMAIL ADDRESS(ES) TO WHICH THE REPORTS WILL BE SENT"
1304 echo -e "(seperated by comma)"
1305 read IPFIRE_MAIL_REPORT
1306 echo -n "EMAIL FROM: "
1307 read IPFIRE_MAIL_FROM
1308 echo -n "EMAIL SERVER: "
1309 read IPFIRE_MAIL_SERVER
1310 echo -n "LOGIN TO MAIL SERVER: "
1311 read IPFIRE_MAIL_USER
1312 echo -n "MAIL PASSWORD: "
712d859c 1313 read -s IPFIRE_MAIL_PASS
cc0e56be
MT
1314 echo -n "Saving..."
1315 for i in `seq 20`; do
1316 sleep 0.1; echo -n "."
1317 done
1318 echo ".Finished!"
1319 cat <<END > .config
1320### ISO server
1321IPFIRE_FTP_URL_EXT=$IPFIRE_FTP_URL_EXT
1322IPFIRE_FTP_PATH_EXT=$IPFIRE_FTP_PATH_EXT
1323IPFIRE_FTP_USER_EXT=$IPFIRE_FTP_USER_EXT
1324IPFIRE_FTP_PASS_EXT=$IPFIRE_FTP_PASS_EXT
1325### cache server
1326IPFIRE_FTP_URL_INT=$IPFIRE_FTP_URL_INT
1327IPFIRE_FTP_PATH_INT=$IPFIRE_FTP_PATH_INT
1328IPFIRE_FTP_USER_INT=$IPFIRE_FTP_USER_INT
1329IPFIRE_FTP_PASS_INT=$IPFIRE_FTP_PASS_INT
1330### paks server
1331IPFIRE_FTP_URL_PAK=$IPFIRE_FTP_URL_PAK
1332IPFIRE_FTP_PATH_PAK=$IPFIRE_FTP_PATH_PAK
1333IPFIRE_FTP_USER_PAK=$IPFIRE_FTP_USER_PAK
1334IPFIRE_FTP_PASS_PAK=$IPFIRE_FTP_PASS_PAK
1335### mail reports
1336IPFIRE_MAIL_REPORT=$IPFIRE_MAIL_REPORT
1337IPFIRE_MAIL_FROM=$IPFIRE_MAIL_FROM
1338IPFIRE_MAIL_SERVER=$IPFIRE_MAIL_SERVER
1339IPFIRE_MAIL_USER=$IPFIRE_MAIL_USER
1340IPFIRE_MAIL_PASS=$IPFIRE_MAIL_PASS
1341END
1342 ;;
1343sync)
1344 echo -e "Syncing cache to ftp:"
ce56e927 1345# rm -f doc/packages-to-remove-from-ftp
cc0e56be 1346 ncftpls -u $IPFIRE_FTP_USER_INT -p $IPFIRE_FTP_PASS_INT ftp://$IPFIRE_FTP_URL_INT$IPFIRE_FTP_PATH_INT/ > ftplist
0eab8e84
MT
1347 for i in `ls -w1 cache/`; do
1348 grep $i ftplist
1349 if [ "$?" -ne "0" ]; then
cc0e56be 1350 ncftpput -u $IPFIRE_FTP_USER_INT -p $IPFIRE_FTP_PASS_INT $IPFIRE_FTP_URL_INT $IPFIRE_FTP_PATH_INT/ cache/$i
0eab8e84
MT
1351 if [ "$?" -eq "0" ]; then
1352 echo -e "$i was successfully uploaded to the ftp server."
1353 else
1354 echo -e "There was an error while uploading $i to the ftp server."
1355 fi
1356 fi
1357 done
1358 rm -f ftplist
1359 ;;
cc0e56be
MT
1360upload)
1361 case "$2" in
1362 iso)
1363 echo -e "Uploading the iso to $IPFIRE_FTP_URL_EXT."
9dc02b38
MT
1364 cat <<EOF > .ftp-commands
1365mkdir $IPFIRE_FTP_PATH_EXT
1366ls -lah
1367quit
1368EOF
1369 ncftp -u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT < .ftp-commands
1370 rm -f .ftp-commands
1371 md5sum ipfire-install-$VERSION.i386.iso > ipfire-install-$VERSION.i386.iso.md5
1372 ncftpput -u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT $IPFIRE_FTP_PATH_EXT/ ipfire-install-$VERSION.i386.iso
1373 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
1374 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 1375 ncftpput -u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT $IPFIRE_FTP_PATH_EXT/ svn_status
9dc02b38
MT
1376 if [ "$?" -eq "0" ]; then
1377 echo -e "The iso of Revision $SVN_REVISION was successfully uploaded to $IPFIRE_FTP_URL_EXT$IPFIRE_FTP_PATH_EXT/."
cc0e56be 1378 else
9dc02b38
MT
1379 echo -e "There was an error while uploading the iso to the ftp server."
1380 exit 1
cc0e56be 1381 fi
6aae8d61
MT
1382 if [ "$3" = "--with-sources-cd" ]; then
1383 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
1384 fi
cc0e56be
MT
1385 ;;
1386 paks)
9dc02b38
MT
1387 cat <<EOF > .ftp-commands
1388mkdir $IPFIRE_FTP_PATH_PAK
1389ls -lah
1390quit
1391EOF
1392 ncftp -u $IPFIRE_FTP_USER_PAK -p $IPFIRE_FTP_PASS_PAK $IPFIRE_FTP_URL_PAK < .ftp-commands
1393 rm -f .ftp-commands
cc0e56be
MT
1394 ncftpput -z -u $IPFIRE_FTP_USER_PAK -p $IPFIRE_FTP_PASS_PAK $IPFIRE_FTP_URL_PAK $IPFIRE_FTP_PATH_PAK/ packages/*
1395 if [ "$?" -eq "0" ]; then
9dc02b38 1396 echo -e "The packages were successfully uploaded to $IPFIRE_FTP_URL_PAK$IPFIRE_FTP_PATH_PAK/."
cc0e56be
MT
1397 else
1398 echo -e "There was an error while uploading the packages to the ftp server."
712d859c 1399 exit 1
cc0e56be
MT
1400 fi
1401 ;;
1402 esac
0d0521b6 1403 ;;
52345790
MT
1404build-only)
1405 rm -f $BASEDIR/log/$2*
1406 BUILDMACHINE=`uname -m`
1407 prepareenv
1408 ipcopmake $2
1409 ;;
c6cb9d25
MT
1410build-silent)
1411 screen -dmS ipfire $0 build
1412 echo "Build started... This will take a while!"
1413 echo "You can see the status with 'screen -x ipfire'."
1414 ;;
cc0e56be
MT
1415mail)
1416 chmod 755 tools/sendEmail
1417 ATTACHMENT=/tmp/ipfire-build-logs-R$SVN_REVISION.tar.gz
1418 if [ "$2" = "ERROR" ]; then
1419 SUBJECT="ERROR: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
1420 echo "ERROR: $0 build!"
1421 cat <<END > /tmp/ipfire_mail_body
1422When I was building IPFire on `hostname`, I have found an ERROR!
1423Here you can see the logs and detect the reason for this error.
1424
1425Best Regards
1426Your IPFire-Build-Script
1427END
1428 fi
1429 if [ "$2" = "SUCCESS" ]; then
1430 SUBJECT="SUCCESS: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
1431 cat <<END > /tmp/ipfire_mail_body
1432Building IPFire on `hostname` in Revision $SVN_REVISION was successfull!
1433You can find the ISO on your ftp server.
1434
1435Statistics:
1436-----------
1437Started: $IPFIRE_START_TIME
1438Finished: `date`
1439
1440Best Regards
1441Your IPFire-Build-Script
1442END
1443 fi
1444 if [ "$2" = "SVNUPDATE" ]; then
1445 SUBJECT="SVNUPDATE: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
1446 echo "ERROR: $0 svn up!"
1447 cat <<END > /tmp/ipfire_mail_body
1448When I was downloading the latest svn source,
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
712d859c
MT
1456
1457 if [ "$2" = "SVNDIST" ]; then
1458 SUBJECT="SVNDIST: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
1459 echo "ERROR: $0 svn dist!"
1460 cat <<END > /tmp/ipfire_mail_body
1461When I was exporting the latest svn source,
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
cc0e56be
MT
1470 if [ "$2" = "PREFETCH" ]; then
1471 SUBJECT="PREFETCH: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
1472 echo "ERROR: $0 prefetch!"
1473 cat <<END > /tmp/ipfire_mail_body
1474When I was downloading the source 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 if [ "$2" = "ISO" ]; then
1484 SUBJECT="ISO: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
1485 echo "ERROR: $0 upload iso!"
1486 cat <<END > /tmp/ipfire_mail_body
1487When I was uploading the iso image,
1488I have found an ERROR!
1489Here you can see the logs and detect the reason for this error.
1490
1491Best Regards
1492Your IPFire-Build-Script
1493END
1494 fi
1495
1496 if [ "$2" = "PAKS" ]; then
1497 SUBJECT="PAKS: IPFIRE-BUILD R$SVN_REVISION on `hostname`"
1498 echo "ERROR: $0 upload paks!"
1499 cat <<END > /tmp/ipfire_mail_body
1500When I was uploading the packages,
1501I have found an ERROR!
1502Here you can see the logs and detect the reason for this error.
1503
1504Best Regards
1505Your IPFire-Build-Script
1506END
1507 fi
1508
1509 tar cfz $ATTACHMENT log/_build*
1510 cat <<END >> /tmp/ipfire_mail_body
1511
1512Here is a summary... The full logs are in the attachment.
1513---------------------------------------------------------
1514
1515`tail log/_*`
1516END
1517 cat /tmp/ipfire_mail_body | tools/sendEmail -q \
1518 -f $IPFIRE_MAIL_FROM \
1519 -t $IPFIRE_MAIL_REPORT \
1520 -u $SUBJECT \
1521 -s $IPFIRE_MAIL_SERVER:25 \
1522 -xu $IPFIRE_MAIL_USER \
1523 -xp $IPFIRE_MAIL_PASS \
1524 -l log/_build.mail.log \
1525 -a $ATTACHMENT # -v
1526 rm -f /tmp/ipfire_mail_body $ATTACHMENT
1527 ;;
1528unattended)
712d859c
MT
1529 if [ ! -f .config ]; then
1530 echo "No configuration found. Try ./make.sh make-config."
1531 fi
cc0e56be
MT
1532 ### This is our procedure that will compile the IPFire by herself...
1533 echo "### UPDATE LOGS"
1534 update_logs
cc0e56be 1535
27ac55bf
MT
1536 if [ "$IPFIRE_REBUILD" -eq "0" ]; then
1537 echo "### SAVING TIME"
1538 export IPFIRE_START_TIME=`date`
ce56e927 1539
dd714b8a
MT
1540 #echo "### GETTING TOOLCHAIN"
1541 #$0 gettoolchain
27ac55bf
MT
1542
1543 echo "### RUNNING SVN-UPDATE"
1544 $0 svn update
1545 if [ $? -ne 0 ]; then
1546 $0 mail SVNUPDATE
1547 exit 1
1548 fi
712d859c 1549
27ac55bf
MT
1550 echo "### EXPORT SOURCES"
1551 $0 svn dist
1552 if [ $? -ne 0 ]; then
1553 $0 mail SVNDIST
1554 exit 1
1555 fi
cc0e56be 1556
27ac55bf
MT
1557 echo "### RUNNING PREFETCH"
1558 $0 prefetch | grep -q "md5 difference"
1559 if [ $? -eq 0 ]; then
1560 $0 mail PREFETCH
1561 exit 1
1562 fi
cc0e56be
MT
1563 fi
1564
1565 echo "### RUNNING BUILD"
1566 $0 build
1567 if [ $? -ne 0 ]; then
1568 $0 mail ERROR
1569 exit 1
1570 fi
1571
ce56e927 1572 echo "### MAKING SOURCES-ISO"
92b5fba4
MT
1573 echo "DISABLED by Delaco!"
1574 #$0 sources-iso
ce56e927 1575
cc0e56be
MT
1576 echo "### UPLOADING ISO"
1577 $0 upload iso
1578 if [ $? -ne 0 ]; then
1579 $0 mail ISO
1580 exit 1
1581 fi
1582
1583 echo "### UPLOADING PAKS"
1584 $0 upload paks
1585 if [ $? -ne 0 ]; then
1586 $0 mail PAKS
1587 exit 1
1588 fi
1589
1590 echo "### SUCCESS!"
1591 $0 mail SUCCESS
712d859c 1592 exit 0
cc0e56be
MT
1593 ;;
1594batch)
27ac55bf 1595 if [ `screen -ls | grep -q ipfire` ]; then
712d859c
MT
1596 echo "Build is already running, sorry!"
1597 exit 1
1598 else
27ac55bf
MT
1599 if [ "$2" = "--rebuild" ]; then
1600 export IPFIRE_REBUILD=1
1601 echo "REBUILD!"
1602 else
1603 export IPFIRE_REBUILD=0
1604 fi
712d859c
MT
1605 echo -n "IPFire-Batch-Build is starting..."
1606 screen -dmS ipfire $0 unattended
1607 if [ "$?" -eq "0" ]; then
1608 echo ".Done!"
1609 else
1610 echo ".ERROR!"
1611 exit 1
1612 fi
712d859c
MT
1613 exit 0
1614 fi
cc0e56be 1615 ;;
028698e8
MT
1616watch)
1617 echo "Exit with Ctrl+A, Ctrl+D."
1618 echo -n "Preparing..."
1619 for i in `seq 5`; do
1620 sleep 0.1; echo -n "."
1621 done
1622 echo ".Ready!"
1623 sleep 0.3
1624 screen -x ipfire
1625 ;;
df5e82b3 1626*)
24a4a744
MT
1627 clear
1628 svn info
712d859c 1629 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
1630 do
1631 case $name in
c6cb9d25
MT
1632 "IPFIRE: Prefetch")
1633 $0 prefetch
1634 ;;
1635 "IPFIRE: Build (silent)")
1636 $0 build-silent
1637 ;;
1638 "IPFIRE: Watch Build")
028698e8 1639 $0 watch
c6cb9d25 1640 ;;
712d859c
MT
1641 "IPFIRE: Batch")
1642 $0 batch
1643 ;;
c6cb9d25
MT
1644 "IPFIRE: Clean")
1645 $0 clean
1646 ;;
1647 "SVN: Commit")
d63e8889
RZ
1648 echo "Are your sure to Update all Files to the Server (write: yes)?"; read input
1649 if [ "$input" == "yes" ]; then
1650 $0 svn commit
1651 fi
d1b6aa72 1652 $0 sync
c6cb9d25
MT
1653 ;;
1654 "SVN: Update")
1655 $0 svn update
1656 ;;
1657 "SVN: Status")
1658 svn status # | grep -v ^?
1659 ;;
1660 "SVN: Diff")
1661 $0 svn diff
1662 ;;
1663 "Help")
1664 echo "Usage: $0 {build|changelog|check|checkclean|clean|gettoolchain|newpak|prefetch|shell|sync|toolchain}"
1665 cat doc/make.sh-usage
1666 ;;
712d859c
MT
1667 "LOG: Tail")
1668 tail -f log/_*
1669 ;;
c6cb9d25
MT
1670 "Exit")
1671 break
1672 ;;
24a4a744
MT
1673 esac
1674 done
df5e82b3 1675 ;;
3ea75603 1676esac