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