2 ############################################################################
4 # This file is part of the IPFire Firewall. #
6 # IPFire is free software; you can redistribute it and/or modify #
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. #
11 # IPFire is distributed in the hope that it will be useful, #
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. #
16 # You should have received a copy of the GNU General Public License #
17 # along with IPFire; if not, write to the Free Software #
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
20 # Copyright (C) 2007-2017 IPFire Team <info@ipfire.org>. #
22 ############################################################################
25 NAME
="IPFire" # Software name
26 SNAME
="ipfire" # Short name
27 VERSION
="2.19" # Version number
28 CORE
="117" # Core Level (Filename)
29 PAKFIRE_CORE
="116" # Core Level (PAKFIRE)
30 GIT_BRANCH
=`git rev-parse --abbrev-ref HEAD` # Git Branch
31 SLOGAN
="www.ipfire.org" # Software slogan
32 CONFIG_ROOT
=/var
/ipfire
# Configuration rootdir
34 MAX_RETRIES
=1 # prefetch/check loop
35 BUILD_IMAGES
=1 # Flash and Xen Downloader
36 KVER
=`grep --max-count=1 VER lfs/linux | awk '{ print $3 }'`
37 GIT_TAG
=$
(git tag |
tail -1) # Git Tag
38 GIT_LASTCOMMIT
=$
(git log |
head -n1 | cut
-d" " -f2 |
head -c8) # Last commit
42 # New architecture variables
43 HOST_ARCH
="$(uname -m)"
45 # Debian specific settings
46 if [ ! -e /etc
/debian_version
]; then
49 if [ -x /usr
/bin
/realpath
]; then
50 FULLPATH
=`/usr/bin/realpath $0`
52 echo "ERROR: Need to do apt-get install realpath"
58 BASENAME
=`basename $0`
59 BASEDIR
=`echo $FULLPATH | sed "s/\/$BASENAME//g"`
60 LOGFILE
=$BASEDIR/log
/_build.preparation.log
61 export BASEDIR LOGFILE
62 DIR_CHK
=$BASEDIR/cache
/check
63 mkdir
$BASEDIR/log
/ 2>/dev
/null
65 # Load configuration file
66 if [ -f .config
]; then
71 . tools
/make-functions
73 # Get the amount of memory in this build system
74 HOST_MEM
=$
(system_memory
)
76 if [ -n "${BUILD_ARCH}" ]; then
77 configure_build
"${BUILD_ARCH}"
78 elif [ -n "${TARGET_ARCH}" ]; then
79 configure_build
"${TARGET_ARCH}"
82 configure_build
"default"
86 ############################################################################
88 # Are we running the right shell? #
90 ############################################################################
91 if [ ! "$BASH" ]; then
92 exiterror
"BASH environment variable is not set. You're probably running the wrong shell."
95 if [ -z "${BASH_VERSION}" ]; then
96 exiterror
"Not running BASH shell."
100 ############################################################################
102 # Trap on emergency exit #
104 ############################################################################
105 trap "exiterror 'Build process interrupted'" SIGINT SIGTERM SIGKILL SIGSTOP SIGQUIT
108 ############################################################################
110 # Resetting our nice level #
112 ############################################################################
113 echo -ne "Resetting our nice level to $NICE" |
tee -a $LOGFILE
114 renice
$NICE $$
> /dev
/null
115 if [ `nice` != "$NICE" ]; then
116 beautify message FAIL
117 exiterror
"Failed to set correct nice level"
119 beautify message DONE
123 ############################################################################
125 # Checking if running as root user #
127 ############################################################################
128 echo -ne "Checking if we're running as root user" |
tee -a $LOGFILE
129 if [ `id -u` != 0 ]; then
130 beautify message FAIL
131 exiterror
"Not building as root"
133 beautify message DONE
137 ############################################################################
139 # Checking for necessary temporary space #
141 ############################################################################
142 echo -ne "Checking for necessary space on disk $BASE_DEV" |
tee -a $LOGFILE
143 BASE_DEV
=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $1 }'`
144 BASE_ASPACE
=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $4 }'`
145 if (( 2048000 > $BASE_ASPACE )); then
146 BASE_USPACE
=`du -skx $BASEDIR | awk '{print $1}'`
147 if (( 2048000 - $BASE_USPACE > $BASE_ASPACE )); then
148 beautify message FAIL
149 exiterror
"Not enough temporary space available, need at least 2GB on $BASE_DEV"
152 beautify message DONE
155 ############################################################################
157 # Building Linux From Scratch system #
159 ############################################################################
166 # Check /tools symlink
167 if [ -h /tools
]; then
170 if [ ! -a /tools
]; then
171 ln -s $BASEDIR/build
/tools
/
173 if [ ! -h /tools
]; then
174 exiterror
"Could not create /tools symbolic link."
180 export LFS LC_ALL CFLAGS CXXFLAGS MAKETUNING
181 unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
183 # Make some extra directories
184 mkdir
-p $BASEDIR/build
/{tools
,etc
,usr
/src
} 2>/dev
/null
185 mkdir
-p $BASEDIR/build
/{dev
/{shm
,pts
},proc
,sys
}
186 mkdir
-p $BASEDIR/{cache
,ccache
} 2>/dev
/null
187 mkdir
-p $BASEDIR/build
/usr
/src
/{cache
,config
,doc
,html
,langs
,lfs
,log
,src
,ccache
}
189 mknod
-m 600 $BASEDIR/build
/dev
/console c
5 1 2>/dev
/null
190 mknod
-m 666 $BASEDIR/build
/dev
/null c
1 3 2>/dev
/null
192 # Make all sources and proc available under lfs build
193 mount
--bind /dev
$BASEDIR/build
/dev
194 mount
--bind /dev
/pts
$BASEDIR/build
/dev
/pts
195 mount
--bind /dev
/shm
$BASEDIR/build
/dev
/shm
196 mount
--bind /proc
$BASEDIR/build
/proc
197 mount
--bind /sys
$BASEDIR/build
/sys
198 mount
--bind $BASEDIR/cache
$BASEDIR/build
/usr
/src
/cache
199 mount
--bind $BASEDIR/ccache
$BASEDIR/build
/usr
/src
/ccache
200 mount
--bind $BASEDIR/config
$BASEDIR/build
/usr
/src
/config
201 mount
--bind $BASEDIR/doc
$BASEDIR/build
/usr
/src
/doc
202 mount
--bind $BASEDIR/html
$BASEDIR/build
/usr
/src
/html
203 mount
--bind $BASEDIR/langs
$BASEDIR/build
/usr
/src
/langs
204 mount
--bind $BASEDIR/lfs
$BASEDIR/build
/usr
/src
/lfs
205 mount
--bind $BASEDIR/log
$BASEDIR/build
/usr
/src
/log
206 mount
--bind $BASEDIR/src
$BASEDIR/build
/usr
/src
/src
208 # Run LFS static binary creation scripts one by one
209 export CCACHE_DIR
=$BASEDIR/ccache
210 export CCACHE_COMPRESS
=1
211 export CCACHE_COMPILERCHECK
="string:toolchain-${TOOLCHAINVER} ${BUILD_ARCH}"
213 # Remove pre-install list of installed files in case user erase some files before rebuild
214 rm -f $BASEDIR/build
/usr
/src
/lsalr
2>/dev
/null
216 # Prepare string for /etc/system-release.
217 SYSTEM_RELEASE
="${NAME} ${VERSION} (${BUILD_ARCH})"
218 if [ "$(git status -s | wc -l)" == "0" ]; then
223 case "$GIT_BRANCH" in
225 SYSTEM_RELEASE
="${SYSTEM_RELEASE} - $GIT_BRANCH$GIT_STATUS"
228 SYSTEM_RELEASE
="${SYSTEM_RELEASE} - Development Build: $GIT_BRANCH/$GIT_LASTCOMMIT$GIT_STATUS"
235 case "${BUILD_ARCH}:${HOST_ARCH}" in
242 i586
:i586|i586
:i686|i586
:x86_64
)
250 arvm7hl
:armv7hl|armv7hl
:armv7l
)
254 armv5tel
:armv5tel|armv5tel
:armv5tejl|armv5tel
:armv6l|armv5tel
:armv7l|armv5tel
:aarch64
)
263 exiterror
"Cannot build ${BUILD_ARCH} toolchain on $(uname -m). Please use the download if any."
265 local gcc
=$
(type -p gcc
)
266 if [ -z "${gcc}" ]; then
267 exiterror
"Could not find GCC. You will need a working build enviroment in order to build the toolchain."
270 LOGFILE
="$BASEDIR/log/_build.toolchain.log"
274 lfsmake1 ccache PASS
=1
275 lfsmake1 binutils PASS
=1
277 lfsmake1 linux KCFG
="-headers"
280 lfsmake1 binutils PASS
=2
282 lfsmake1 ccache PASS
=2
306 lfsmake1 fake-environ
307 lfsmake1 cleanup-toolchain
311 LOGFILE
="$BASEDIR/log/_build.base.log"
314 lfsmake2 linux KCFG
="-headers"
318 lfsmake2 cleanup-toolchain
335 lfsmake2 ncurses-compat
341 lfsmake2 readline-compat
381 LOGFILE
="$BASEDIR/log/_build.ipfire.log"
388 lfsmake2 libusb-compat
394 lfsmake2 linux-firmware
395 lfsmake2 ath10k-firmware
396 lfsmake2 dvb-firmwares
397 lfsmake2 mt7601u-firmware
398 lfsmake2 zd1211-firmware
399 lfsmake2 rpi-firmware
406 lfsmake2 multipath-tools
410 lfsmake2 libnfnetlink
411 lfsmake2 libnetfilter_queue
412 lfsmake2 libnetfilter_conntrack
413 lfsmake2 libnetfilter_cthelper
414 lfsmake2 libnetfilter_cttimeout
417 case "${BUILD_ARCH}" in
419 lfsmake2 linux KCFG
=""
420 lfsmake2 backports KCFG
=""
421 lfsmake2 e1000e KCFG
=""
423 lfsmake2 ixgbe KCFG
=""
424 lfsmake2 xtables-addons KCFG
=""
425 lfsmake2 linux-initrd KCFG
=""
428 # x86-pae (Native and new XEN) kernel build
429 lfsmake2 linux KCFG
="-pae"
430 lfsmake2 backports KCFG
="-pae"
431 lfsmake2 e1000e KCFG
="-pae"
432 lfsmake2 igb KCFG
="-pae"
433 lfsmake2 ixgbe KCFG
="-pae"
434 lfsmake2 xtables-addons KCFG
="-pae"
435 lfsmake2 linux-initrd KCFG
="-pae"
438 lfsmake2 linux KCFG
=""
439 lfsmake2 backports KCFG
=""
440 lfsmake2 e1000e KCFG
=""
442 lfsmake2 ixgbe KCFG
=""
443 lfsmake2 xtables-addons KCFG
=""
444 lfsmake2 linux-initrd KCFG
=""
448 # arm-rpi (Raspberry Pi) kernel build
449 lfsmake2 linux KCFG
="-rpi"
450 lfsmake2 backports KCFG
="-rpi"
451 lfsmake2 xtables-addons KCFG
="-rpi"
452 lfsmake2 linux-initrd KCFG
="-rpi"
454 # arm multi platform (Panda, Wandboard ...) kernel build
455 lfsmake2 linux KCFG
="-multi"
456 lfsmake2 backports KCFG
="-multi"
457 lfsmake2 e1000e KCFG
="-multi"
458 lfsmake2 igb KCFG
="-multi"
459 lfsmake2 ixgbe KCFG
="-multi"
460 lfsmake2 xtables-addons KCFG
="-multi"
461 lfsmake2 linux-initrd KCFG
="-multi"
463 # arm-kirkwood (Dreamplug, ICY-Box ...) kernel build
464 lfsmake2 linux KCFG
="-kirkwood"
465 lfsmake2 backports KCFG
="-kirkwood"
466 lfsmake2 e1000e KCFG
="-kirkwood"
467 lfsmake2 igb KCFG
="-kirkwood"
468 lfsmake2 ixgbe KCFG
="-kirkwood"
469 lfsmake2 xtables-addons KCFG
="-kirkwood"
470 lfsmake2 linux-initrd KCFG
="-kirkwood"
473 lfsmake2 xtables-addons USPACE
="1"
475 [ "${BUILD_ARCH}" = "i586" ] && lfsmake2 openssl KCFG
='-sse2'
476 lfsmake2 libgpg-error
482 lfsmake2 libevent2-compat
501 lfsmake2 ca-certificates
509 lfsmake2 libjpeg-compat
532 lfsmake2 web-user-interface
540 lfsmake2 reiserfsprogs
551 lfsmake2 perl-Device-SerialPort
552 lfsmake2 perl-Device-Modem
553 lfsmake2 perl-Apache-Htpasswd
559 lfsmake2 conntrack-tools
563 lfsmake2 l7-protocols
565 lfsmake2 capi4k-utils
574 lfsmake2 HTML-Template
575 lfsmake2 Compress-Zlib
581 lfsmake2 Net-IPv4Addr
584 lfsmake2 IO-Socket-SSL
589 lfsmake2 Convert-TNEF
590 lfsmake2 Convert-UUlib
593 lfsmake2 Text-Tabs
+Wrap
594 lfsmake2 Locale-Country
596 lfsmake2 Crypt-PasswdMD5
598 lfsmake2 python-setuptools
599 lfsmake2 python-clientform
600 lfsmake2 python-mechanize
601 lfsmake2 python-feedparser
602 lfsmake2 python-rssdler
603 lfsmake2 python-inotify
604 lfsmake2 python-docutils
605 lfsmake2 python-daemon
606 lfsmake2 python-ipaddress
609 lfsmake2 noip_updater
613 lfsmake2 dejavu-fonts-ttf
614 lfsmake2 ubuntu-font-family
647 lfsmake2 cups-filters
648 lfsmake2 epson-inkjet-printer-escpr
657 lfsmake2 bridge-utils
659 lfsmake2 smartmontools
665 lfsmake2 openmailadmin
667 lfsmake2 spamassassin
712 lfsmake2 python-pyparsing
713 lfsmake2 spice-protocol
731 lfsmake2 vdr_streamdev
732 lfsmake2 vdr_epgsearch
737 lfsmake2 icegenerator
739 lfsmake2 libmpdclient
741 lfsmake2 perl-Net-SMTP-SSL
742 lfsmake2 perl-MIME-Base64
743 lfsmake2 perl-Authen-SASL
744 lfsmake2 perl-MIME-Lite
745 lfsmake2 perl-Email-Date-Format
750 lfsmake2 wpa_supplicant
756 lfsmake2 cpufrequtils
764 lfsmake2 streamripper
769 lfsmake2 perl-gettext
770 lfsmake2 perl-Sort-Naturally
774 lfsmake2 perl-DBD-mysql
775 lfsmake2 perl-DBD-SQLite
776 lfsmake2 perl-File-ReadBackwards
789 lfsmake2 usb_modeswitch
790 lfsmake2 usb_modeswitch_data
800 lfsmake2 python-m2crypto
801 lfsmake2 wireless-regdb
804 lfsmake2 python-distutils-extra
806 lfsmake2 python-progressbar
807 lfsmake2 python-xattr
809 lfsmake2 transmission
824 lfsmake2 check_mk_agent
831 lfsmake2 ipfire-netboot
837 lfsmake2 perl-Carp-Clan
838 lfsmake2 perl-Date-Calc
839 lfsmake2 perl-Date-Manip
840 lfsmake2 perl-File-Tail
841 lfsmake2 perl-TimeDate
853 lfsmake2 perl-Font-TTF
854 lfsmake2 perl-IO-String
855 lfsmake2 perl-PDF-API2
856 lfsmake2 squid-accounting
859 lfsmake2 perl-Text-CSV_XS
870 lfsmake2 libpciaccess
873 lfsmake2 python3-libvirt
875 lfsmake2 perl-common-sense
876 lfsmake2 perl-inotify2
883 # Run installer scripts one by one
884 LOGFILE
="$BASEDIR/log/_build.installer.log"
892 LOGFILE
="$BASEDIR/log/_build.packages.log"
894 echo "... see detailed log in _build.*.log files" >> $LOGFILE
897 # Generating list of packages used
898 echo -n "Generating packages list from logs" |
tee -a $LOGFILE
899 rm -f $BASEDIR/doc
/packages-list
900 for i
in `ls -1tr $BASEDIR/log/[^_]*`; do
901 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
902 echo "* `basename $i`" >>$BASEDIR/doc
/packages-list
905 echo "== List of softwares used to build $NAME Version: $VERSION ==" > $BASEDIR/doc
/packages-list.txt
906 grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$\|.tgz$\|-config$\|_missing_rootfile$\|install1$\|install2$\|pass1$\|pass2$\|pass3$' \
907 $BASEDIR/doc
/packages-list |
sort >> $BASEDIR/doc
/packages-list.txt
908 rm -f $BASEDIR/doc
/packages-list
909 # packages-list.txt is ready to be displayed for wiki page
910 beautify message DONE
914 [ -z $GIT_TAG ] || LAST_TAG
=$GIT_TAG
915 [ -z $LAST_TAG ] || EXT
="$LAST_TAG..HEAD"
916 git log
-n 500 --no-merges --pretty=medium
--shortstat $EXT > $BASEDIR/doc
/ChangeLog
918 # Create images for install
921 # Check if there is a loop device for building in virtual environments
922 modprobe loop
2>/dev
/null
923 if [ $BUILD_IMAGES == 1 ] && ([ -e /dev
/loop
/0 ] ||
[ -e /dev
/loop0
] ||
[ -e "/dev/loop-control" ]); then
924 lfsmake2 flash-images
925 lfsmake2 flash-images SCON
=1
928 mv $LFS/install
/images
/{*.iso
,*.tgz
,*.img.gz
,*.bz2
} $BASEDIR >> $LOGFILE 2>&1
933 mv $LFS/install
/images
/*.bz2
$BASEDIR >> $LOGFILE 2>&1
937 # remove not useable iso on armv5tel (needed to build flash images)
938 [ "${BUILD_ARCH}" = "armv5tel" ] && rm -rf *.iso
940 for i
in `ls *.bz2 *.img.gz *.iso`; do
947 rm -rf $BASEDIR/build
/tmp
/*
949 # Generating total list of files
950 echo -n "Generating files list from logs" |
tee -a $LOGFILE
951 rm -f $BASEDIR/log
/FILES
952 for i
in `ls -1tr $BASEDIR/log/[^_]*`; do
953 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
954 echo "##" >>$BASEDIR/log
/FILES
955 echo "## `basename $i`" >>$BASEDIR/log
/FILES
956 echo "##" >>$BASEDIR/log
/FILES
957 cat $i |
sed "s%^\./%#%" |
sort >> $BASEDIR/log
/FILES
960 beautify message DONE
966 lfsmake2 core-updates
969 for i
in $
(find $BASEDIR/config
/rootfiles
/packages
{/${BUILD_ARCH},} -maxdepth 1 -type f
); do
971 if [ -e $BASEDIR/lfs
/$i ]; then
975 beautify message SKIP
978 test -d $BASEDIR/packages || mkdir
$BASEDIR/packages
979 mv -f $LFS/install
/packages
/* $BASEDIR/packages
>> $LOGFILE 2>&1
980 rm -rf $BASEDIR/build
/install
/packages
/*
983 while [ $# -gt 0 ]; do
986 configure_build
"${1#--target=}"
989 exiterror
"Unknown configuration option: ${1}"
992 # Found a command, so exit options parsing.
999 # See what we're supposed to do
1003 PACKAGE
=`ls -v -r $BASEDIR/cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.gz 2> /dev/null | head -n 1`
1004 #only restore on a clean disk
1005 if [ ! -e "${BASEDIR}/build/tools/.toolchain-successful" ]; then
1006 if [ ! -n "$PACKAGE" ]; then
1007 beautify build_stage
"Full toolchain compilation"
1011 PACKAGENAME
=${PACKAGE%.tar.gz}
1012 beautify build_stage
"Packaged toolchain compilation"
1013 if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then
1017 exiterror
"$PACKAGENAME md5 did not match, check downloaded package"
1021 echo -n "Using installed toolchain" |
tee -a $LOGFILE
1022 beautify message SKIP
1026 beautify build_start
1027 beautify build_stage
"Building LFS"
1030 beautify build_stage
"Building IPFire"
1033 beautify build_stage
"Building installer"
1036 beautify build_stage
"Building packages"
1039 beautify build_stage
"Checking Logfiles for new Files"
1042 tools
/checknewlog.pl
1043 tools
/checkrootfiles
1049 # enter a shell inside LFS chroot
1050 # may be used to changed kernel settings
1055 echo -en "${BOLD}Cleaning build directory...${NORMAL}"
1056 for i
in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do
1057 $LOSETUP -d $i 2>/dev
/null
1059 for i
in `mount | grep $BASEDIR | cut -d " " -f 1`; do
1063 for i
in `seq 0 7`; do
1064 if ( losetup
/dev
/loop
${i} 2>/dev
/null |
grep -q "/install/images" ); then
1065 umount
/dev
/loop
${i} 2>/dev
/null
;
1066 losetup
-d /dev
/loop
${i} 2>/dev
/null
;
1069 rm -rf $BASEDIR/build
1070 rm -rf $BASEDIR/cdrom
1071 rm -rf $BASEDIR/packages
1073 if [ -h /tools
]; then
1076 rm -f $BASEDIR/ipfire-
*
1077 beautify message DONE
1080 if [ ! -d $BASEDIR/cache
]; then
1081 mkdir
$BASEDIR/cache
1083 mkdir
-p $BASEDIR/log
1084 echo -e "${BOLD}Preload all source files${NORMAL}" |
tee -a $LOGFILE
1087 for c
in `seq $MAX_RETRIES`; do
1088 if (( FINISHED
==1 )); then
1094 if [ -f "$i" -a "$i" != "Config" ]; then
1095 lfsmakecommoncheck
${i} ||
continue
1097 make -s -f $i LFS_BASEDIR
=$BASEDIR BUILD_ARCH
="${BUILD_ARCH}" \
1098 MESSAGE
="$i\t ($c/$MAX_RETRIES)" download
>> $LOGFILE 2>&1
1099 if [ $?
-ne 0 ]; then
1100 beautify message FAIL
1103 if [ $c -eq 1 ]; then
1104 beautify message DONE
1110 echo -e "${BOLD}***Verifying md5sums${NORMAL}"
1113 if [ -f "$i" -a "$i" != "Config" ]; then
1114 lfsmakecommoncheck
${i} > /dev
/null ||
continue
1115 make -s -f $i LFS_BASEDIR
=$BASEDIR BUILD_ARCH
="${BUILD_ARCH}" \
1116 MESSAGE
="$i\t " md5
>> $LOGFILE 2>&1
1117 if [ $?
-ne 0 ]; then
1118 echo -ne "MD5 difference in lfs/$i"
1119 beautify message FAIL
1124 if [ $ERROR -eq 0 ]; then
1125 echo -ne "${BOLD}all files md5sum match${NORMAL}"
1126 beautify message DONE
1128 echo -ne "${BOLD}not all files were correctly download${NORMAL}"
1129 beautify message FAIL
1131 cd - >/dev
/null
2>&1
1136 beautify build_stage
"Toolchain compilation"
1138 echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for ${BUILD_ARCH}" |
tee -a $LOGFILE
1139 test -d $BASEDIR/cache
/toolchains || mkdir
-p $BASEDIR/cache
/toolchains
1140 cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache
/toolchains
/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.
tar.gz \
1141 build
/tools build
/bin
/sh log
>> $LOGFILE
1142 md5sum cache
/toolchains
/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.
tar.gz \
1143 > cache
/toolchains
/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.md5
1147 # arbitrary name to be updated in case of new toolchain package upload
1148 PACKAGE
=$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}
1149 if [ ! -f $BASEDIR/cache
/toolchains
/$PACKAGE.
tar.gz
]; then
1150 URL_TOOLCHAIN
=`grep URL_TOOLCHAIN lfs/Config | awk '{ print $3 }'`
1151 test -d $BASEDIR/cache
/toolchains || mkdir
-p $BASEDIR/cache
/toolchains
1152 echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for ${BUILD_ARCH}" |
tee -a $LOGFILE
1153 cd $BASEDIR/cache
/toolchains
1154 wget
-U "IPFireSourceGrabber/2.x" $URL_TOOLCHAIN/$PACKAGE.
tar.gz
$URL_TOOLCHAIN/$PACKAGE.md5
>& /dev
/null
1155 if [ $?
-ne 0 ]; then
1156 echo "`date -u '+%b %e %T'`: error downloading $PACKAGE toolchain for ${BUILD_ARCH} machine" |
tee -a $LOGFILE
1158 if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then
1159 echo "`date -u '+%b %e %T'`: toolchain md5 ok" |
tee -a $LOGFILE
1161 exiterror
"$PACKAGE.md5 did not match, check downloaded package"
1165 echo "Toolchain is already downloaded. Exiting..."
1170 echo -ne "`date -u '+%b %e %T'`: Build sources iso for ${BUILD_ARCH}" |
tee -a $LOGFILE
1171 chroot
$LFS /tools
/bin
/env
-i HOME
=/root \
1172 TERM
=$TERM PS1
='\u:\w\$ ' \
1173 PATH
=/usr
/local
/bin
:/bin
:/usr
/bin
:/sbin
:/usr
/sbin \
1174 VERSION
=$VERSION NAME
="$NAME" SNAME
="$SNAME" BUILD_ARCH
="${BUILD_ARCH}" \
1175 /bin
/bash
-x -c "cd /usr/src/lfs && make -f sources-iso LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
1176 mv $LFS/install
/images
/ipfire-
* $BASEDIR >> $LOGFILE 2>&1
1177 if [ $?
-eq "0" ]; then
1178 beautify message DONE
1180 beautify message FAIL
1186 if [ -z $IPFIRE_USER ]; then
1187 echo -n "You have to setup IPFIRE_USER first. See .config for details."
1188 beautify message FAIL
1192 URL_SOURCE
=$
(grep URL_SOURCE lfs
/Config |
awk '{ print $3 }')
1193 REMOTE_FILES
=$
(echo "ls -1" | sftp
-C ${IPFIRE_USER}@
${URL_SOURCE})
1195 for file in ${BASEDIR}/cache
/*; do
1196 [ -d "${file}" ] && continue
1197 grep -q "$(basename ${file})" <<<$REMOTE_FILES && continue
1198 NEW_FILES
="$NEW_FILES $file"
1200 [ -n "$NEW_FILES" ] && scp
-2 $NEW_FILES ${IPFIRE_USER}@
${URL_SOURCE}
1209 echo "Usage: $0 {build|changelog|clean|gettoolchain|downloadsrc|shell|sync|toolchain}"
1210 cat doc
/make.sh-usage