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