forked from ipfire/ipfire-2.x
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.sh
executable file
·1137 lines (1066 loc) · 32.2 KB
/
make.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
############################################################################
# #
# This file is part of the IPFire Firewall. #
# #
# IPFire is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# IPFire is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with IPFire; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
# #
# Copyright (C) 2007-2013 IPFire Team <[email protected]>. #
# #
############################################################################
#
NAME="IPFire" # Software name
SNAME="ipfire" # Short name
VERSION="2.13" # Version number
CORE="75" # Core Level (Filename)
PAKFIRE_CORE="75" # Core Level (PAKFIRE)
GIT_BRANCH=`git status | head -n1 | cut -d" " -f4` # Git Branch
SLOGAN="www.ipfire.org" # Software slogan
CONFIG_ROOT=/var/ipfire # Configuration rootdir
NICE=10 # Nice level
MAX_RETRIES=1 # prefetch/check loop
BUILD_IMAGES=1 # Build USB, Flash and Xen Images
KVER=`grep --max-count=1 VER lfs/linux | awk '{ print $3 }'`
MACHINE=`uname -m`
GIT_TAG=$(git tag | tail -1) # Git Tag
GIT_LASTCOMMIT=$(git log | head -n1 | cut -d" " -f2 |head -c8) # Last commit
TOOLCHAINVER=6
BUILDMACHINE=$MACHINE
if [ "$MACHINE" = "x86_64" ]; then
BUILDMACHINE="i686";
fi
# Debian specific settings
if [ ! -e /etc/debian_version ]; then
FULLPATH=`which $0`
else
if [ -x /usr/bin/realpath ]; then
FULLPATH=`/usr/bin/realpath $0`
else
echo "ERROR: Need to do apt-get install realpath"
exit 1
fi
fi
PWD=`pwd`
BASENAME=`basename $0`
BASEDIR=`echo $FULLPATH | sed "s/\/$BASENAME//g"`
LOGFILE=$BASEDIR/log/_build.preparation.log
export BASEDIR LOGFILE
DIR_CHK=$BASEDIR/cache/check
mkdir $BASEDIR/log/ 2>/dev/null
# Include funtions
. tools/make-functions
if [ -f .config ]; then
. .config
fi
if [ -z $EDITOR ]; then
for i in nano emacs vi; do
EDITOR=$(which $i 2>/dev/null)
if ! [ -z $EDITOR ]; then
export EDITOR=$EDITOR
break
fi
done
[ -z $EDITOR ] && exiterror "You should have installed an editor."
fi
prepareenv() {
############################################################################
# #
# Are we running the right shell? #
# #
############################################################################
if [ ! "$BASH" ]; then
exiterror "BASH environment variable is not set. You're probably running the wrong shell."
fi
if [ -z "${BASH_VERSION}" ]; then
exiterror "Not running BASH shell."
fi
############################################################################
# #
# Trap on emergency exit #
# #
############################################################################
trap "exiterror 'Build process interrupted'" SIGINT SIGTERM SIGKILL SIGSTOP SIGQUIT
############################################################################
# #
# Resetting our nice level #
# #
############################################################################
echo -ne "Resetting our nice level to $NICE" | tee -a $LOGFILE
renice $NICE $$ > /dev/null
if [ `nice` != "$NICE" ]; then
beautify message FAIL
exiterror "Failed to set correct nice level"
else
beautify message DONE
fi
############################################################################
# #
# Checking if running as root user #
# #
############################################################################
echo -ne "Checking if we're running as root user" | tee -a $LOGFILE
if [ `id -u` != 0 ]; then
beautify message FAIL
exiterror "Not building as root"
else
beautify message DONE
fi
############################################################################
# #
# Checking for necessary temporary space #
# #
############################################################################
echo -ne "Checking for necessary space on disk $BASE_DEV" | tee -a $LOGFILE
BASE_DEV=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $1 }'`
BASE_ASPACE=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $4 }'`
if (( 2048000 > $BASE_ASPACE )); then
BASE_USPACE=`du -skx $BASEDIR | awk '{print $1}'`
if (( 2048000 - $BASE_USPACE > $BASE_ASPACE )); then
beautify message FAIL
exiterror "Not enough temporary space available, need at least 2GB on $BASE_DEV"
fi
else
beautify message DONE
fi
############################################################################
# #
# Building Linux From Scratch system #
# #
############################################################################
# Set umask
umask 022
# Set LFS Directory
LFS=$BASEDIR/build
# Check /tools symlink
if [ -h /tools ]; then
rm -f /tools
fi
if [ ! -a /tools ]; then
ln -s $BASEDIR/build/tools /
fi
if [ ! -h /tools ]; then
exiterror "Could not create /tools symbolic link."
fi
# Setup environment
set +h
LC_ALL=POSIX
if [ -z $MAKETUNING ]; then
CPU_COUNT="$(getconf _NPROCESSORS_ONLN 2>/dev/null)"
if [ -z "${CPU_COUNT}" ]; then
CPU_COUNT=1
fi
MAKETUNING="-j$(( ${CPU_COUNT} * 2 + 1 ))"
fi
export LFS LC_ALL CFLAGS CXXFLAGS MAKETUNING
unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
# Make some extra directories
mkdir -p $BASEDIR/build/{tools,etc,usr/src} 2>/dev/null
mkdir -p $BASEDIR/build/{dev/{shm,pts},proc,sys}
mkdir -p $BASEDIR/{cache,ccache} 2>/dev/null
mkdir -p $BASEDIR/build/usr/src/{cache,config,doc,html,langs,lfs,log,src,ccache}
mknod -m 600 $BASEDIR/build/dev/console c 5 1 2>/dev/null
mknod -m 666 $BASEDIR/build/dev/null c 1 3 2>/dev/null
# Make all sources and proc available under lfs build
mount --bind /dev $BASEDIR/build/dev
mount --bind /dev/pts $BASEDIR/build/dev/pts
mount --bind /dev/shm $BASEDIR/build/dev/shm
mount --bind /proc $BASEDIR/build/proc
mount --bind /sys $BASEDIR/build/sys
mount --bind $BASEDIR/cache $BASEDIR/build/usr/src/cache
mount --bind $BASEDIR/ccache $BASEDIR/build/usr/src/ccache
mount --bind $BASEDIR/config $BASEDIR/build/usr/src/config
mount --bind $BASEDIR/doc $BASEDIR/build/usr/src/doc
mount --bind $BASEDIR/html $BASEDIR/build/usr/src/html
mount --bind $BASEDIR/langs $BASEDIR/build/usr/src/langs
mount --bind $BASEDIR/lfs $BASEDIR/build/usr/src/lfs
mount --bind $BASEDIR/log $BASEDIR/build/usr/src/log
mount --bind $BASEDIR/src $BASEDIR/build/usr/src/src
# Run LFS static binary creation scripts one by one
export CCACHE_DIR=$BASEDIR/ccache
export CCACHE_COMPRESS=1
export CCACHE_COMPILERCHECK="none"
# Remove pre-install list of installed files in case user erase some files before rebuild
rm -f $BASEDIR/build/usr/src/lsalr 2>/dev/null
}
buildtoolchain() {
local error=false
case "${MACHINE}:$(uname -m)" in
# x86
i586:i586|i586:i686|i586:x86_64)
# These are working.
;;
i586:*)
error=true
;;
# ARM
armv5tel:armv5tel|armv5tel:armv5tejl|armv5tel:armv6l|armv5tel:armv7l)
# These are working.
;;
armv5tel:*)
error=true
;;
esac
${error} && \
exiterror "Cannot build ${MACHINE} toolchain on $(uname -m). Please use the download if any."
local gcc=$(type -p gcc)
if [ -z "${gcc}" ]; then
exiterror "Could not find GCC. You will need a working build enviroment in order to build the toolchain."
fi
LOGFILE="$BASEDIR/log/_build.toolchain.log"
export LOGFILE
local ORG_PATH=$PATH
export PATH="/tools/ccache/bin:/tools/bin:$PATH"
lfsmake1 ccache PASS=1
lfsmake1 binutils PASS=1
lfsmake1 gcc PASS=1
lfsmake1 linux TOOLS=1 KCFG="-headers"
lfsmake1 glibc
lfsmake1 cleanup-toolchain PASS=1
lfsmake1 binutils PASS=2
lfsmake1 gcc PASS=2
lfsmake1 ccache PASS=2
lfsmake1 tcl
lfsmake1 expect
lfsmake1 dejagnu
lfsmake1 ncurses
lfsmake1 bash
lfsmake1 bzip2
lfsmake1 coreutils
lfsmake1 diffutils
lfsmake1 findutils
lfsmake1 gawk
lfsmake1 gettext
lfsmake1 grep
lfsmake1 gzip
lfsmake1 m4
lfsmake1 make
lfsmake1 patch
lfsmake1 perl
lfsmake1 sed
lfsmake1 tar
lfsmake1 texinfo
lfsmake1 xz
lfsmake1 fake-environ
lfsmake1 cleanup-toolchain PASS=2
export PATH=$ORG_PATH
}
buildbase() {
LOGFILE="$BASEDIR/log/_build.base.log"
export LOGFILE
lfsmake2 stage2
lfsmake2 linux KCFG="-headers"
lfsmake2 man-pages
lfsmake2 glibc
lfsmake2 tzdata
lfsmake2 cleanup-toolchain PASS=3
lfsmake2 zlib
lfsmake2 binutils
lfsmake2 gmp
lfsmake2 gmp-compat
lfsmake2 mpfr
lfsmake2 file
lfsmake2 gcc
lfsmake2 sed
lfsmake2 berkeley
lfsmake2 coreutils
lfsmake2 iana-etc
lfsmake2 m4
lfsmake2 bison
lfsmake2 ncurses
lfsmake2 procps
lfsmake2 libtool
lfsmake2 perl
lfsmake2 readline
lfsmake2 readline-compat
lfsmake2 pcre
lfsmake2 pcre-compat
lfsmake2 autoconf
lfsmake2 automake
lfsmake2 bash
lfsmake2 bzip2
lfsmake2 diffutils
lfsmake2 e2fsprogs
lfsmake2 ed
lfsmake2 findutils
lfsmake2 flex
lfsmake2 gawk
lfsmake2 gettext
lfsmake2 grep
lfsmake2 groff
lfsmake2 gperf
lfsmake2 gzip
lfsmake2 inetutils
lfsmake2 iproute2
lfsmake2 jwhois
lfsmake2 kbd
lfsmake2 less
lfsmake2 make
lfsmake2 man
lfsmake2 mktemp
lfsmake2 module-init-tools
lfsmake2 net-tools
lfsmake2 patch
lfsmake2 psmisc
lfsmake2 shadow
lfsmake2 sysklogd
lfsmake2 sysvinit
lfsmake2 tar
lfsmake2 texinfo
lfsmake2 udev
lfsmake2 util-linux
lfsmake2 vim
lfsmake2 xz
lfsmake2 grub
}
buildipfire() {
LOGFILE="$BASEDIR/log/_build.ipfire.log"
export LOGFILE
ipfiremake configroot
ipfiremake backup
ipfiremake bind
ipfiremake dhcp
ipfiremake dhcpcd
ipfiremake libusb
ipfiremake libpcap
ipfiremake ppp
ipfiremake pptp
ipfiremake unzip
ipfiremake which
ipfiremake linux-firmware
ipfiremake dvb-firmwares
ipfiremake zd1211-firmware
ipfiremake rpi-firmware
ipfiremake u-boot
if [ "${MACHINE_TYPE}" != "arm" ]; then
# x86-xen (Legacy XEN) kernel build
ipfiremake linux2 KCFG="-xen"
ipfiremake v4l-dvb KCFG="-xen"
ipfiremake mISDN KCFG="-xen"
ipfiremake cryptodev KCFG="-xen"
ipfiremake compat-drivers KCFG="-xen"
ipfiremake r8169 KCFG="-xen"
ipfiremake r8168 KCFG="-xen"
ipfiremake r8101 KCFG="-xen"
ipfiremake e1000 KCFG="-xen"
ipfiremake e1000e KCFG="-xen"
ipfiremake igb KCFG="-xen"
# x86-pae (Native and new XEN) kernel build
ipfiremake linux KCFG="-pae"
ipfiremake kvm-kmod KCFG="-pae"
ipfiremake v4l-dvb KCFG="-pae"
ipfiremake mISDN KCFG="-pae"
ipfiremake cryptodev KCFG="-pae"
ipfiremake compat-drivers KCFG="-pae"
ipfiremake r8169 KCFG="-pae"
ipfiremake r8168 KCFG="-pae"
ipfiremake r8101 KCFG="-pae"
ipfiremake e1000e KCFG="-pae"
ipfiremake igb KCFG="-pae"
# x86 kernel build
ipfiremake linux KCFG=""
ipfiremake kvm-kmod KCFG=""
ipfiremake v4l-dvb KCFG=""
ipfiremake mISDN KCFG=""
ipfiremake cryptodev KCFG=""
ipfiremake compat-drivers KCFG=""
ipfiremake r8169 KCFG=""
ipfiremake r8168 KCFG=""
ipfiremake r8101 KCFG=""
ipfiremake e1000e KCFG=""
ipfiremake igb KCFG=""
else
# arm-rpi (Raspberry Pi) kernel build
ipfiremake linux KCFG="-rpi"
ipfiremake v4l-dvb KCFG="-rpi"
ipfiremake mISDN KCFG="-rpi" NOPCI=1
ipfiremake cryptodev KCFG="-rpi"
ipfiremake compat-drivers KCFG="-rpi"
# arm-omap (Panda Board) kernel build
ipfiremake linux KCFG="-omap"
ipfiremake v4l-dvb KCFG="-omap"
ipfiremake mISDN KCFG="-omap" NOPCI=1
ipfiremake cryptodev KCFG="-omap"
ipfiremake compat-drivers KCFG="-omap"
# arm-kirkwood (Dreamplug, ICY-Box ...) kernel build
ipfiremake linux KCFG="-kirkwood"
ipfiremake v4l-dvb KCFG="-kirkwood"
ipfiremake mISDN KCFG="-kirkwood"
ipfiremake cryptodev KCFG="-kirkwood"
ipfiremake compat-drivers KCFG="-kirkwood"
ipfiremake r8169 KCFG="-kirkwood"
ipfiremake r8168 KCFG="-kirkwood"
ipfiremake r8101 KCFG="-kirkwood"
# ipfiremake e1000e KCFG="-kirkwood"
ipfiremake igb KCFG="-kirkwood"
fi
ipfiremake pkg-config
ipfiremake linux-atm
ipfiremake cpio
ipfiremake dracut
ipfiremake expat
ipfiremake gdbm
ipfiremake pam
ipfiremake openssl
ipfiremake curl
ipfiremake tcl
ipfiremake sqlite
ipfiremake python
ipfiremake fireinfo
ipfiremake libnet
ipfiremake libnl
ipfiremake libidn
ipfiremake nasm
ipfiremake libjpeg
ipfiremake libexif
ipfiremake libpng
ipfiremake libtiff
ipfiremake libart
ipfiremake freetype
ipfiremake gd
ipfiremake popt
ipfiremake pcre
ipfiremake slang
ipfiremake newt
ipfiremake attr
ipfiremake acl
ipfiremake libcap
ipfiremake pciutils
ipfiremake usbutils
ipfiremake libxml2
ipfiremake libxslt
ipfiremake BerkeleyDB
ipfiremake mysql
ipfiremake cyrus-sasl
ipfiremake openldap
ipfiremake apache2
ipfiremake php
ipfiremake apache2 PASS=C
ipfiremake arping
ipfiremake beep
ipfiremake dvdrtools
ipfiremake dnsmasq
ipfiremake dosfstools
ipfiremake reiserfsprogs
ipfiremake xfsprogs
ipfiremake sysfsutils
ipfiremake fuse
ipfiremake ntfs-3g
ipfiremake ethtool
ipfiremake ez-ipupdate
ipfiremake fcron
ipfiremake perl-GD
ipfiremake GD-Graph
ipfiremake GD-TextUtil
ipfiremake gnupg
ipfiremake hdparm
ipfiremake sdparm
ipfiremake mtools
ipfiremake initscripts
ipfiremake whatmask
ipfiremake libmnl
ipfiremake iptables
ipfiremake conntrack-tools
ipfiremake libupnp
ipfiremake ipaddr
ipfiremake iputils
ipfiremake l7-protocols
ipfiremake mISDNuser
ipfiremake capi4k-utils
ipfiremake hwdata
ipfiremake logrotate
ipfiremake logwatch
ipfiremake misc-progs
ipfiremake nano
ipfiremake URI
ipfiremake HTML-Tagset
ipfiremake HTML-Parser
ipfiremake HTML-Template
ipfiremake Compress-Zlib
ipfiremake Digest
ipfiremake Digest-SHA1
ipfiremake Digest-HMAC
ipfiremake libwww-perl
ipfiremake Net-DNS
ipfiremake Net-IPv4Addr
ipfiremake Net_SSLeay
ipfiremake IO-Stringy
ipfiremake IO-Socket-SSL
ipfiremake Unix-Syslog
ipfiremake Mail-Tools
ipfiremake MIME-Tools
ipfiremake Net-Server
ipfiremake Convert-TNEF
ipfiremake Convert-UUlib
ipfiremake Archive-Tar
ipfiremake Archive-Zip
ipfiremake Text-Tabs+Wrap
ipfiremake Locale-Country
ipfiremake XML-Parser
ipfiremake Crypt-PasswdMD5
ipfiremake Net-Telnet
ipfiremake python-setuptools
ipfiremake python-clientform
ipfiremake python-mechanize
ipfiremake python-feedparser
ipfiremake python-rssdler
ipfiremake libffi
ipfiremake glib
ipfiremake GeoIP
ipfiremake fwhits
ipfiremake noip_updater
ipfiremake ntp
ipfiremake openssh
ipfiremake fontconfig
ipfiremake dejavu-fonts-ttf
ipfiremake freefont
ipfiremake pixman
ipfiremake cairo
ipfiremake pango
ipfiremake rrdtool
ipfiremake setserial
ipfiremake setup
ipfiremake libdnet
ipfiremake daq
ipfiremake snort
ipfiremake oinkmaster
ipfiremake squid
ipfiremake squidguard
ipfiremake calamaris
ipfiremake tcpdump
ipfiremake traceroute
ipfiremake vlan
ipfiremake wireless
ipfiremake pakfire
ipfiremake spandsp
ipfiremake lzo
ipfiremake openvpn
ipfiremake pammysql
ipfiremake cups
ipfiremake ghostscript
ipfiremake foomatic
ipfiremake hplip
ipfiremake cifs-utils
ipfiremake samba
ipfiremake sudo
ipfiremake mc
ipfiremake wget
ipfiremake bridge-utils
ipfiremake screen
ipfiremake smartmontools
ipfiremake htop
ipfiremake postfix
ipfiremake fetchmail
ipfiremake cyrus-imapd
ipfiremake openmailadmin
ipfiremake clamav
ipfiremake spamassassin
ipfiremake amavisd
ipfiremake alsa
ipfiremake mpfire
ipfiremake guardian
ipfiremake libid3tag
ipfiremake libmad
ipfiremake libogg
ipfiremake libvorbis
ipfiremake libdvbpsi
ipfiremake flac
ipfiremake lame
ipfiremake sox
ipfiremake libshout
ipfiremake xvid
ipfiremake libmpeg2
ipfiremake cmake
ipfiremake gnump3d
ipfiremake libsigc++
ipfiremake libtorrent
ipfiremake rtorrent
ipfiremake rsync
ipfiremake tcpwrapper
ipfiremake libevent
ipfiremake libevent2
ipfiremake portmap
ipfiremake nfs
ipfiremake nmap
ipfiremake ncftp
ipfiremake etherwake
ipfiremake bwm-ng
ipfiremake tripwire
ipfiremake sysstat
ipfiremake vsftpd
ipfiremake strongswan
ipfiremake lsof
ipfiremake br2684ctl
ipfiremake pcmciautils
ipfiremake lm_sensors
ipfiremake liboping
ipfiremake collectd
ipfiremake teamspeak
ipfiremake elinks
ipfiremake igmpproxy
ipfiremake fbset
ipfiremake sdl
ipfiremake qemu
ipfiremake sane
ipfiremake netpbm
ipfiremake phpSANE
ipfiremake tunctl
ipfiremake nagios
ipfiremake nagios_nrpe
ipfiremake ebtables
ipfiremake directfb
ipfiremake dfb++
ipfiremake faad2
ipfiremake ffmpeg
ipfiremake vdr
ipfiremake vdr_streamdev
ipfiremake vdr_vnsiserver3
ipfiremake vdr_epgsearch
ipfiremake w_scan
ipfiremake icecast
ipfiremake icegenerator
ipfiremake mpd
ipfiremake libmpdclient
ipfiremake mpc
ipfiremake git
ipfiremake squidclamav
ipfiremake bc
ipfiremake vnstat
ipfiremake vnstati
ipfiremake iw
ipfiremake wpa_supplicant
ipfiremake hostapd
ipfiremake pycurl
ipfiremake urlgrabber
ipfiremake syslinux
ipfiremake tftpd
ipfiremake cpufrequtils
ipfiremake dbus
ipfiremake bluetooth
ipfiremake gutenprint
ipfiremake apcupsd
ipfiremake iperf
ipfiremake netcat
ipfiremake 7zip
ipfiremake lynis
ipfiremake streamripper
ipfiremake sshfs
ipfiremake taglib
ipfiremake mediatomb
ipfiremake sslh
ipfiremake perl-gettext
ipfiremake perl-Sort-Naturally
ipfiremake vdradmin
ipfiremake miau
ipfiremake netsnmpd
ipfiremake perl-DBI
ipfiremake perl-DBD-mysql
ipfiremake cacti
ipfiremake icecc
ipfiremake openvmtools
ipfiremake nagiosql
ipfiremake iftop
ipfiremake motion
ipfiremake joe
ipfiremake nut
ipfiremake watchdog
ipfiremake libpri
ipfiremake asterisk
ipfiremake lcr
ipfiremake usb_modeswitch
ipfiremake usb_modeswitch_data
ipfiremake zerofree
ipfiremake mdadm
ipfiremake eject
ipfiremake pound
ipfiremake minicom
ipfiremake ddrescue
ipfiremake imspector
ipfiremake miniupnpd
ipfiremake client175
ipfiremake powertop
ipfiremake parted
ipfiremake swig
ipfiremake python-m2crypto
ipfiremake wireless-regdb
ipfiremake crda
ipfiremake libsolv
ipfiremake python-distutils-extra
ipfiremake python-lzma
ipfiremake python-progressbar
ipfiremake python-xattr
ipfiremake intltool
ipfiremake transmission
ipfiremake dpfhack
ipfiremake lcd4linux
ipfiremake mtr
ipfiremake tcpick
ipfiremake minidlna
ipfiremake acpid
ipfiremake fping
ipfiremake telnet
ipfiremake xinetd
ipfiremake libgpg-error
ipfiremake libassuan
ipfiremake gpgme
ipfiremake pygpgme
ipfiremake pakfire3
ipfiremake stress
ipfiremake libstatgrab
ipfiremake sarg
ipfiremake fstrim
ipfiremake check_mk_agent
ipfiremake libdaemon
ipfiremake avahi
ipfiremake nginx
ipfiremake sendEmail
ipfiremake sysbench
ipfiremake strace
ipfiremake ipfire-netboot
ipfiremake lcdproc
ipfiremake bitstream
ipfiremake multicat
ipfiremake keepalived
ipfiremake ipvsadm
ipfiremake perl-Carp-Clan
ipfiremake perl-Date-Calc
ipfiremake perl-Date-Manip
ipfiremake perl-File-Tail
ipfiremake perl-TimeDate
ipfiremake swatch
ipfiremake tor
ipfiremake arm
ipfiremake wavemon
ipfiremake iptraf-ng
echo Build on $HOSTNAME > $BASEDIR/build/var/ipfire/firebuild
cat /proc/version >> $BASEDIR/build/var/ipfire/firebuild
echo >> $BASEDIR/build/var/ipfire/firebuild
git log -1 >> $BASEDIR/build/var/ipfire/firebuild
echo >> $BASEDIR/build/var/ipfire/firebuild
git status >> $BASEDIR/build/var/ipfire/firebuild
echo >> $BASEDIR/build/var/ipfire/firebuild
cat /proc/cpuinfo >> $BASEDIR/build/var/ipfire/firebuild
echo $PAKFIRE_CORE > $BASEDIR/build/opt/pakfire/db/core/mine
if [ "$(git status -s | wc -l)" == "0" ]; then
GIT_STATUS=""
else
GIT_STATUS="-dirty"
fi
case "$GIT_BRANCH" in
core*|beta?|rc?)
echo "$NAME $VERSION ($MACHINE) - $GIT_BRANCH$GIT_STATUS" > $BASEDIR/build/etc/system-release
;;
*)
echo "$NAME $VERSION ($MACHINE) - Development Build: $GIT_BRANCH/$GIT_LASTCOMMIT$GIT_STATUS" > $BASEDIR/build/etc/system-release
;;
esac
}
buildinstaller() {
# Run installer scripts one by one
LOGFILE="$BASEDIR/log/_build.installer.log"
export LOGFILE
ipfiremake as86
ipfiremake mbr
ipfiremake memtest
ipfiremake installer
installmake strip
ipfiremake initrd
}
buildpackages() {
LOGFILE="$BASEDIR/log/_build.packages.log"
export LOGFILE
echo "... see detailed log in _build.*.log files" >> $LOGFILE
# Generating list of packages used
echo -n "Generating packages list from logs" | tee -a $LOGFILE
rm -f $BASEDIR/doc/packages-list
for i in `ls -1tr $BASEDIR/log/[^_]*`; do
if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
echo "* `basename $i`" >>$BASEDIR/doc/packages-list
fi
done
echo "== List of softwares used to build $NAME Version: $VERSION ==" > $BASEDIR/doc/packages-list.txt
grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$\|.tgz$\|-config$\|_missing_rootfile$\|install1$\|install2$\|pass1$\|pass2$\|pass3$' \
$BASEDIR/doc/packages-list | sort >> $BASEDIR/doc/packages-list.txt
rm -f $BASEDIR/doc/packages-list
# packages-list.txt is ready to be displayed for wiki page
beautify message DONE
# Update changelog
cd $BASEDIR
[ -z $GIT_TAG ] || LAST_TAG=$GIT_TAG
[ -z $LAST_TAG ] || EXT="$LAST_TAG..HEAD"
git log -n 500 --no-merges --pretty=medium --shortstat $EXT > $BASEDIR/doc/ChangeLog
# Create images for install
ipfiremake cdrom
# Check if there is a loop device for building in virtual environments
if [ $BUILD_IMAGES == 1 ] && ([ -e /dev/loop/0 ] || [ -e /dev/loop0 ]); then
if [ "${MACHINE_TYPE}" != "arm" ]; then
ipfiremake usb-stick
fi
ipfiremake flash-images
fi
mv $LFS/install/images/{*.iso,*.tgz,*.img.gz,*.bz2} $BASEDIR >> $LOGFILE 2>&1
ipfirepackages
# Check if there is a loop device for building in virtual environments
if [ $BUILD_IMAGES == 1 ] && ([ -e /dev/loop/0 ] || [ -e /dev/loop0 ]) && [ "${MACHINE_TYPE}" != "arm" ]; then
cp -f $BASEDIR/packages/linux-xen-*.ipfire $LFS/install/packages/
cp -f $BASEDIR/packages/meta-linux-xen $LFS/install/packages/
cp -f $BASEDIR/packages/linux-pae-*.ipfire $LFS/install/packages/
cp -f $BASEDIR/packages/meta-linux-pae $LFS/install/packages/
ipfiremake xen-image
rm -rf $LFS/install/packages/linux-xen-*.ipfire
rm -rf $LFS/install/packages/meta-linux-xen
fi
mv $LFS/install/images/*.bz2 $BASEDIR >> $LOGFILE 2>&1
cd $BASEDIR
for i in `ls *.bz2 *.img.gz *.iso`; do
md5sum $i > $i.md5
done
cd $PWD
# Cleanup
stdumount
rm -rf $BASEDIR/build/tmp/*
# Generating total list of files
echo -n "Generating files list from logs" | tee -a $LOGFILE
rm -f $BASEDIR/log/FILES
for i in `ls -1tr $BASEDIR/log/[^_]*`; do
if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
echo "##" >>$BASEDIR/log/FILES
echo "## `basename $i`" >>$BASEDIR/log/FILES
echo "##" >>$BASEDIR/log/FILES
cat $i | sed "s%^\./%#%" | sort >> $BASEDIR/log/FILES
fi
done
beautify message DONE
cd $PWD
}
ipfirepackages() {
ipfiremake core-updates
local i
for i in $(find $BASEDIR/config/rootfiles/packages{/${MACHINE},} -maxdepth 1 -type f); do
i=$(basename ${i})
if [ -e $BASEDIR/lfs/$i ]; then
ipfiredist $i
else
echo -n $i
beautify message SKIP
fi
done
test -d $BASEDIR/packages || mkdir $BASEDIR/packages
mv -f $LFS/install/packages/* $BASEDIR/packages >> $LOGFILE 2>&1
rm -rf $BASEDIR/build/install/packages/*
}
# See what we're supposed to do
case "$1" in
build)
clear
PACKAGE=`ls -v -r $BASEDIR/cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-$MACHINE.tar.gz 2> /dev/null | head -n 1`
#only restore on a clean disk
if [ ! -f log/cleanup-toolchain-2-tools ]; then
if [ ! -n "$PACKAGE" ]; then
beautify build_stage "Full toolchain compilation - Native GCC: `gcc --version | grep GCC | awk {'print $3'}`"
prepareenv
buildtoolchain
else
PACKAGENAME=${PACKAGE%.tar.gz}
beautify build_stage "Packaged toolchain compilation"
if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then
tar zxf $PACKAGE
prepareenv
else
exiterror "$PACKAGENAME md5 did not match, check downloaded package"
fi
fi
else
echo -n "Using installed toolchain" | tee -a $LOGFILE
beautify message SKIP
prepareenv
fi
beautify build_start
beautify build_stage "Building LFS"
buildbase
beautify build_stage "Building IPFire"
buildipfire
beautify build_stage "Building installer"
buildinstaller
beautify build_stage "Building packages"
buildpackages
beautify build_stage "Checking Logfiles for new Files"
cd $BASEDIR
tools/checknewlog.pl
tools/checkwronginitlinks
cd $PWD
beautify build_end
;;
shell)
# enter a shell inside LFS chroot
# may be used to changed kernel settings
prepareenv
entershell
;;
clean)
echo -en "${BOLD}Cleaning build directory...${NORMAL}"
for i in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do
$LOSETUP -d $i 2>/dev/null
done
for i in `mount | grep $BASEDIR | cut -d " " -f 1`; do
umount $i
done
stdumount
for i in `seq 0 7`; do
if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
umount /dev/loop${i} 2>/dev/null;
losetup -d /dev/loop${i} 2>/dev/null;
fi;
done
rm -rf $BASEDIR/build
rm -rf $BASEDIR/cdrom
rm -rf $BASEDIR/packages
rm -rf $BASEDIR/log
if [ -h /tools ]; then
rm -f /tools
fi