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