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
="116" # 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
66 . tools
/make-functions
68 # Get the amount of memory in this build system
69 HOST_MEM
=$
(system_memory
)
71 if [ -f .config
]; then
75 if [ -n "${BUILD_ARCH}" ]; then
76 configure_build
"${BUILD_ARCH}"
77 elif [ -n "${TARGET_ARCH}" ]; then
78 configure_build
"${TARGET_ARCH}"
81 configure_build
"default"
85 ############################################################################
87 # Are we running the right shell? #
89 ############################################################################
90 if [ ! "$BASH" ]; then
91 exiterror
"BASH environment variable is not set. You're probably running the wrong shell."
94 if [ -z "${BASH_VERSION}" ]; then
95 exiterror
"Not running BASH shell."
99 ############################################################################
101 # Trap on emergency exit #
103 ############################################################################
104 trap "exiterror 'Build process interrupted'" SIGINT SIGTERM SIGKILL SIGSTOP SIGQUIT
107 ############################################################################
109 # Resetting our nice level #
111 ############################################################################
112 echo -ne "Resetting our nice level to $NICE" |
tee -a $LOGFILE
113 renice
$NICE $$
> /dev
/null
114 if [ `nice` != "$NICE" ]; then
115 beautify message FAIL
116 exiterror
"Failed to set correct nice level"
118 beautify message DONE
122 ############################################################################
124 # Checking if running as root user #
126 ############################################################################
127 echo -ne "Checking if we're running as root user" |
tee -a $LOGFILE
128 if [ `id -u` != 0 ]; then
129 beautify message FAIL
130 exiterror
"Not building as root"
132 beautify message DONE
136 ############################################################################
138 # Checking for necessary temporary space #
140 ############################################################################
141 echo -ne "Checking for necessary space on disk $BASE_DEV" |
tee -a $LOGFILE
142 BASE_DEV
=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $1 }'`
143 BASE_ASPACE
=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $4 }'`
144 if (( 2048000 > $BASE_ASPACE )); then
145 BASE_USPACE
=`du -skx $BASEDIR | awk '{print $1}'`
146 if (( 2048000 - $BASE_USPACE > $BASE_ASPACE )); then
147 beautify message FAIL
148 exiterror
"Not enough temporary space available, need at least 2GB on $BASE_DEV"
151 beautify message DONE
154 ############################################################################
156 # Building Linux From Scratch system #
158 ############################################################################
165 # Check /tools symlink
166 if [ -h /tools
]; then
169 if [ ! -a /tools
]; then
170 ln -s $BASEDIR/build
/tools
/
172 if [ ! -h /tools
]; then
173 exiterror
"Could not create /tools symbolic link."
179 if [ -z $MAKETUNING ]; then
180 CPU_COUNT
="$(system_processors)"
182 MAKETUNING
="-j$(( ${CPU_COUNT} * 2 + 1 ))"
184 export LFS LC_ALL CFLAGS CXXFLAGS MAKETUNING
185 unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
187 # Make some extra directories
188 mkdir
-p $BASEDIR/build
/{tools
,etc
,usr
/src
} 2>/dev
/null
189 mkdir
-p $BASEDIR/build
/{dev
/{shm
,pts
},proc
,sys
}
190 mkdir
-p $BASEDIR/{cache
,ccache
} 2>/dev
/null
191 mkdir
-p $BASEDIR/build
/usr
/src
/{cache
,config
,doc
,html
,langs
,lfs
,log
,src
,ccache
}
193 mknod
-m 600 $BASEDIR/build
/dev
/console c
5 1 2>/dev
/null
194 mknod
-m 666 $BASEDIR/build
/dev
/null c
1 3 2>/dev
/null
196 # Make all sources and proc available under lfs build
197 mount
--bind /dev
$BASEDIR/build
/dev
198 mount
--bind /dev
/pts
$BASEDIR/build
/dev
/pts
199 mount
--bind /dev
/shm
$BASEDIR/build
/dev
/shm
200 mount
--bind /proc
$BASEDIR/build
/proc
201 mount
--bind /sys
$BASEDIR/build
/sys
202 mount
--bind $BASEDIR/cache
$BASEDIR/build
/usr
/src
/cache
203 mount
--bind $BASEDIR/ccache
$BASEDIR/build
/usr
/src
/ccache
204 mount
--bind $BASEDIR/config
$BASEDIR/build
/usr
/src
/config
205 mount
--bind $BASEDIR/doc
$BASEDIR/build
/usr
/src
/doc
206 mount
--bind $BASEDIR/html
$BASEDIR/build
/usr
/src
/html
207 mount
--bind $BASEDIR/langs
$BASEDIR/build
/usr
/src
/langs
208 mount
--bind $BASEDIR/lfs
$BASEDIR/build
/usr
/src
/lfs
209 mount
--bind $BASEDIR/log
$BASEDIR/build
/usr
/src
/log
210 mount
--bind $BASEDIR/src
$BASEDIR/build
/usr
/src
/src
212 # Run LFS static binary creation scripts one by one
213 export CCACHE_DIR
=$BASEDIR/ccache
214 export CCACHE_COMPRESS
=1
215 export CCACHE_COMPILERCHECK
="string:toolchain-${TOOLCHAINVER} ${BUILD_ARCH}"
217 # Remove pre-install list of installed files in case user erase some files before rebuild
218 rm -f $BASEDIR/build
/usr
/src
/lsalr
2>/dev
/null
220 # Prepare string for /etc/system-release.
221 SYSTEM_RELEASE
="${NAME} ${VERSION} (${BUILD_ARCH})"
222 if [ "$(git status -s | wc -l)" == "0" ]; then
227 case "$GIT_BRANCH" in
229 SYSTEM_RELEASE
="${SYSTEM_RELEASE} - $GIT_BRANCH$GIT_STATUS"
232 SYSTEM_RELEASE
="${SYSTEM_RELEASE} - Development Build: $GIT_BRANCH/$GIT_LASTCOMMIT$GIT_STATUS"
239 case "${BUILD_ARCH}:${HOST_ARCH}" in
246 i586
:i586|i586
:i686|i586
:x86_64
)
254 arvm7hl
:armv7hl|armv7hl
:armv7l
)
258 armv5tel
:armv5tel|armv5tel
:armv5tejl|armv5tel
:armv6l|armv5tel
:armv7l|armv5tel
:aarch64
)
267 exiterror
"Cannot build ${BUILD_ARCH} toolchain on $(uname -m). Please use the download if any."
269 local gcc
=$
(type -p gcc
)
270 if [ -z "${gcc}" ]; then
271 exiterror
"Could not find GCC. You will need a working build enviroment in order to build the toolchain."
274 LOGFILE
="$BASEDIR/log/_build.toolchain.log"
278 lfsmake1 ccache PASS
=1
279 lfsmake1 binutils PASS
=1
281 lfsmake1 linux KCFG
="-headers"
284 lfsmake1 binutils PASS
=2
286 lfsmake1 ccache PASS
=2
310 lfsmake1 fake-environ
311 lfsmake1 cleanup-toolchain
315 LOGFILE
="$BASEDIR/log/_build.base.log"
318 lfsmake2 linux KCFG
="-headers"
322 lfsmake2 cleanup-toolchain
339 lfsmake2 ncurses-compat
345 lfsmake2 readline-compat
385 LOGFILE
="$BASEDIR/log/_build.ipfire.log"
392 lfsmake2 libusb-compat
398 lfsmake2 linux-firmware
399 lfsmake2 ath10k-firmware
400 lfsmake2 dvb-firmwares
401 lfsmake2 mt7601u-firmware
402 lfsmake2 zd1211-firmware
403 lfsmake2 rpi-firmware
410 lfsmake2 multipath-tools
414 lfsmake2 libnfnetlink
415 lfsmake2 libnetfilter_queue
416 lfsmake2 libnetfilter_conntrack
417 lfsmake2 libnetfilter_cthelper
418 lfsmake2 libnetfilter_cttimeout
421 case "${BUILD_ARCH}" in
423 lfsmake2 linux KCFG
=""
424 lfsmake2 backports KCFG
=""
425 lfsmake2 e1000e KCFG
=""
427 lfsmake2 ixgbe KCFG
=""
428 lfsmake2 xtables-addons KCFG
=""
429 lfsmake2 linux-initrd KCFG
=""
432 # x86-pae (Native and new XEN) kernel build
433 lfsmake2 linux KCFG
="-pae"
434 lfsmake2 backports KCFG
="-pae"
435 lfsmake2 e1000e KCFG
="-pae"
436 lfsmake2 igb KCFG
="-pae"
437 lfsmake2 ixgbe KCFG
="-pae"
438 lfsmake2 xtables-addons KCFG
="-pae"
439 lfsmake2 linux-initrd KCFG
="-pae"
442 lfsmake2 linux KCFG
=""
443 lfsmake2 backports KCFG
=""
444 lfsmake2 e1000e KCFG
=""
446 lfsmake2 ixgbe KCFG
=""
447 lfsmake2 xtables-addons KCFG
=""
448 lfsmake2 linux-initrd KCFG
=""
452 # arm-rpi (Raspberry Pi) kernel build
453 lfsmake2 linux KCFG
="-rpi"
454 lfsmake2 backports KCFG
="-rpi"
455 lfsmake2 xtables-addons KCFG
="-rpi"
456 lfsmake2 linux-initrd KCFG
="-rpi"
458 # arm multi platform (Panda, Wandboard ...) kernel build
459 lfsmake2 linux KCFG
="-multi"
460 lfsmake2 backports KCFG
="-multi"
461 lfsmake2 e1000e KCFG
="-multi"
462 lfsmake2 igb KCFG
="-multi"
463 lfsmake2 ixgbe KCFG
="-multi"
464 lfsmake2 xtables-addons KCFG
="-multi"
465 lfsmake2 linux-initrd KCFG
="-multi"
467 # arm-kirkwood (Dreamplug, ICY-Box ...) kernel build
468 lfsmake2 linux KCFG
="-kirkwood"
469 lfsmake2 backports KCFG
="-kirkwood"
470 lfsmake2 e1000e KCFG
="-kirkwood"
471 lfsmake2 igb KCFG
="-kirkwood"
472 lfsmake2 ixgbe KCFG
="-kirkwood"
473 lfsmake2 xtables-addons KCFG
="-kirkwood"
474 lfsmake2 linux-initrd KCFG
="-kirkwood"
477 lfsmake2 xtables-addons USPACE
="1"
479 [ "${BUILD_ARCH}" = "i586" ] && lfsmake2 openssl KCFG
='-sse2'
480 lfsmake2 libgpg-error
486 lfsmake2 libevent2-compat
505 lfsmake2 ca-certificates
513 lfsmake2 libjpeg-compat
536 lfsmake2 web-user-interface
544 lfsmake2 reiserfsprogs
555 lfsmake2 perl-Device-SerialPort
556 lfsmake2 perl-Device-Modem
557 lfsmake2 perl-Apache-Htpasswd
563 lfsmake2 conntrack-tools
567 lfsmake2 l7-protocols
569 lfsmake2 capi4k-utils
578 lfsmake2 HTML-Template
579 lfsmake2 Compress-Zlib
585 lfsmake2 Net-IPv4Addr
588 lfsmake2 IO-Socket-SSL
593 lfsmake2 Convert-TNEF
594 lfsmake2 Convert-UUlib
597 lfsmake2 Text-Tabs
+Wrap
598 lfsmake2 Locale-Country
600 lfsmake2 Crypt-PasswdMD5
602 lfsmake2 python-setuptools
603 lfsmake2 python-clientform
604 lfsmake2 python-mechanize
605 lfsmake2 python-feedparser
606 lfsmake2 python-rssdler
607 lfsmake2 python-inotify
608 lfsmake2 python-docutils
609 lfsmake2 python-daemon
610 lfsmake2 python-ipaddress
613 lfsmake2 noip_updater
617 lfsmake2 dejavu-fonts-ttf
618 lfsmake2 ubuntu-font-family
651 lfsmake2 cups-filters
652 lfsmake2 epson-inkjet-printer-escpr
661 lfsmake2 bridge-utils
663 lfsmake2 smartmontools
669 lfsmake2 openmailadmin
671 lfsmake2 spamassassin
716 lfsmake2 python-pyparsing
717 lfsmake2 spice-protocol
735 lfsmake2 vdr_streamdev
736 lfsmake2 vdr_epgsearch
741 lfsmake2 icegenerator
743 lfsmake2 libmpdclient
745 lfsmake2 perl-Net-SMTP-SSL
746 lfsmake2 perl-MIME-Base64
747 lfsmake2 perl-Authen-SASL
748 lfsmake2 perl-MIME-Lite
749 lfsmake2 perl-Email-Date-Format
754 lfsmake2 wpa_supplicant
760 lfsmake2 cpufrequtils
768 lfsmake2 streamripper
773 lfsmake2 perl-gettext
774 lfsmake2 perl-Sort-Naturally
778 lfsmake2 perl-DBD-mysql
779 lfsmake2 perl-DBD-SQLite
780 lfsmake2 perl-File-ReadBackwards
793 lfsmake2 usb_modeswitch
794 lfsmake2 usb_modeswitch_data
804 lfsmake2 python-m2crypto
805 lfsmake2 wireless-regdb
808 lfsmake2 python-distutils-extra
810 lfsmake2 python-progressbar
811 lfsmake2 python-xattr
813 lfsmake2 transmission
828 lfsmake2 check_mk_agent
835 lfsmake2 ipfire-netboot
841 lfsmake2 perl-Carp-Clan
842 lfsmake2 perl-Date-Calc
843 lfsmake2 perl-Date-Manip
844 lfsmake2 perl-File-Tail
845 lfsmake2 perl-TimeDate
857 lfsmake2 perl-Font-TTF
858 lfsmake2 perl-IO-String
859 lfsmake2 perl-PDF-API2
860 lfsmake2 squid-accounting
863 lfsmake2 perl-Text-CSV_XS
874 lfsmake2 libpciaccess
877 lfsmake2 python3-libvirt
879 lfsmake2 perl-common-sense
880 lfsmake2 perl-inotify2
887 # Run installer scripts one by one
888 LOGFILE
="$BASEDIR/log/_build.installer.log"
896 LOGFILE
="$BASEDIR/log/_build.packages.log"
898 echo "... see detailed log in _build.*.log files" >> $LOGFILE
901 # Generating list of packages used
902 echo -n "Generating packages list from logs" |
tee -a $LOGFILE
903 rm -f $BASEDIR/doc
/packages-list
904 for i
in `ls -1tr $BASEDIR/log/[^_]*`; do
905 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
906 echo "* `basename $i`" >>$BASEDIR/doc
/packages-list
909 echo "== List of softwares used to build $NAME Version: $VERSION ==" > $BASEDIR/doc
/packages-list.txt
910 grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$\|.tgz$\|-config$\|_missing_rootfile$\|install1$\|install2$\|pass1$\|pass2$\|pass3$' \
911 $BASEDIR/doc
/packages-list |
sort >> $BASEDIR/doc
/packages-list.txt
912 rm -f $BASEDIR/doc
/packages-list
913 # packages-list.txt is ready to be displayed for wiki page
914 beautify message DONE
918 [ -z $GIT_TAG ] || LAST_TAG
=$GIT_TAG
919 [ -z $LAST_TAG ] || EXT
="$LAST_TAG..HEAD"
920 git log
-n 500 --no-merges --pretty=medium
--shortstat $EXT > $BASEDIR/doc
/ChangeLog
922 # Create images for install
925 # Check if there is a loop device for building in virtual environments
926 modprobe loop
2>/dev
/null
927 if [ $BUILD_IMAGES == 1 ] && ([ -e /dev
/loop
/0 ] ||
[ -e /dev
/loop0
] ||
[ -e "/dev/loop-control" ]); then
928 lfsmake2 flash-images
929 lfsmake2 flash-images SCON
=1
932 mv $LFS/install
/images
/{*.iso
,*.tgz
,*.img.gz
,*.bz2
} $BASEDIR >> $LOGFILE 2>&1
937 mv $LFS/install
/images
/*.bz2
$BASEDIR >> $LOGFILE 2>&1
941 # remove not useable iso on armv5tel (needed to build flash images)
942 [ "${BUILD_ARCH}" = "armv5tel" ] && rm -rf *.iso
944 for i
in `ls *.bz2 *.img.gz *.iso`; do
951 rm -rf $BASEDIR/build
/tmp
/*
953 # Generating total list of files
954 echo -n "Generating files list from logs" |
tee -a $LOGFILE
955 rm -f $BASEDIR/log
/FILES
956 for i
in `ls -1tr $BASEDIR/log/[^_]*`; do
957 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
958 echo "##" >>$BASEDIR/log
/FILES
959 echo "## `basename $i`" >>$BASEDIR/log
/FILES
960 echo "##" >>$BASEDIR/log
/FILES
961 cat $i |
sed "s%^\./%#%" |
sort >> $BASEDIR/log
/FILES
964 beautify message DONE
970 lfsmake2 core-updates
973 for i
in $
(find $BASEDIR/config
/rootfiles
/packages
{/${BUILD_ARCH},} -maxdepth 1 -type f
); do
975 if [ -e $BASEDIR/lfs
/$i ]; then
979 beautify message SKIP
982 test -d $BASEDIR/packages || mkdir
$BASEDIR/packages
983 mv -f $LFS/install
/packages
/* $BASEDIR/packages
>> $LOGFILE 2>&1
984 rm -rf $BASEDIR/build
/install
/packages
/*
987 while [ $# -gt 0 ]; do
990 configure_build
"${1#--target=}"
993 exiterror
"Unknown configuration option: ${1}"
996 # Found a command, so exit options parsing.
1003 # See what we're supposed to do
1007 PACKAGE
=`ls -v -r $BASEDIR/cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.gz 2> /dev/null | head -n 1`
1008 #only restore on a clean disk
1009 if [ ! -e "${BASEDIR}/build/tools/.toolchain-successful" ]; then
1010 if [ ! -n "$PACKAGE" ]; then
1011 beautify build_stage
"Full toolchain compilation"
1015 PACKAGENAME
=${PACKAGE%.tar.gz}
1016 beautify build_stage
"Packaged toolchain compilation"
1017 if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then
1021 exiterror
"$PACKAGENAME md5 did not match, check downloaded package"
1025 echo -n "Using installed toolchain" |
tee -a $LOGFILE
1026 beautify message SKIP
1030 beautify build_start
1031 beautify build_stage
"Building LFS"
1034 beautify build_stage
"Building IPFire"
1037 beautify build_stage
"Building installer"
1040 beautify build_stage
"Building packages"
1043 beautify build_stage
"Checking Logfiles for new Files"
1046 tools
/checknewlog.pl
1047 tools
/checkrootfiles
1053 # enter a shell inside LFS chroot
1054 # may be used to changed kernel settings
1059 echo -en "${BOLD}Cleaning build directory...${NORMAL}"
1060 for i
in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do
1061 $LOSETUP -d $i 2>/dev
/null
1063 for i
in `mount | grep $BASEDIR | cut -d " " -f 1`; do
1067 for i
in `seq 0 7`; do
1068 if ( losetup
/dev
/loop
${i} 2>/dev
/null |
grep -q "/install/images" ); then
1069 umount
/dev
/loop
${i} 2>/dev
/null
;
1070 losetup
-d /dev
/loop
${i} 2>/dev
/null
;
1073 rm -rf $BASEDIR/build
1074 rm -rf $BASEDIR/cdrom
1075 rm -rf $BASEDIR/packages
1077 if [ -h /tools
]; then
1080 rm -f $BASEDIR/ipfire-
*
1081 beautify message DONE
1084 if [ ! -d $BASEDIR/cache
]; then
1085 mkdir
$BASEDIR/cache
1087 mkdir
-p $BASEDIR/log
1088 echo -e "${BOLD}Preload all source files${NORMAL}" |
tee -a $LOGFILE
1091 for c
in `seq $MAX_RETRIES`; do
1092 if (( FINISHED
==1 )); then
1098 if [ -f "$i" -a "$i" != "Config" ]; then
1099 lfsmakecommoncheck
${i} ||
continue
1101 make -s -f $i LFS_BASEDIR
=$BASEDIR BUILD_ARCH
="${BUILD_ARCH}" \
1102 MESSAGE
="$i\t ($c/$MAX_RETRIES)" download
>> $LOGFILE 2>&1
1103 if [ $?
-ne 0 ]; then
1104 beautify message FAIL
1107 if [ $c -eq 1 ]; then
1108 beautify message DONE
1114 echo -e "${BOLD}***Verifying md5sums${NORMAL}"
1117 if [ -f "$i" -a "$i" != "Config" ]; then
1118 lfsmakecommoncheck
${i} > /dev
/null ||
continue
1119 make -s -f $i LFS_BASEDIR
=$BASEDIR BUILD_ARCH
="${BUILD_ARCH}" \
1120 MESSAGE
="$i\t " md5
>> $LOGFILE 2>&1
1121 if [ $?
-ne 0 ]; then
1122 echo -ne "MD5 difference in lfs/$i"
1123 beautify message FAIL
1128 if [ $ERROR -eq 0 ]; then
1129 echo -ne "${BOLD}all files md5sum match${NORMAL}"
1130 beautify message DONE
1132 echo -ne "${BOLD}not all files were correctly download${NORMAL}"
1133 beautify message FAIL
1135 cd - >/dev
/null
2>&1
1140 beautify build_stage
"Toolchain compilation"
1142 echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for ${BUILD_ARCH}" |
tee -a $LOGFILE
1143 test -d $BASEDIR/cache
/toolchains || mkdir
-p $BASEDIR/cache
/toolchains
1144 cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache
/toolchains
/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.
tar.gz \
1145 build
/tools build
/bin
/sh log
>> $LOGFILE
1146 md5sum cache
/toolchains
/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.
tar.gz \
1147 > cache
/toolchains
/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.md5
1151 # arbitrary name to be updated in case of new toolchain package upload
1152 PACKAGE
=$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}
1153 if [ ! -f $BASEDIR/cache
/toolchains
/$PACKAGE.
tar.gz
]; then
1154 URL_TOOLCHAIN
=`grep URL_TOOLCHAIN lfs/Config | awk '{ print $3 }'`
1155 test -d $BASEDIR/cache
/toolchains || mkdir
-p $BASEDIR/cache
/toolchains
1156 echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for ${BUILD_ARCH}" |
tee -a $LOGFILE
1157 cd $BASEDIR/cache
/toolchains
1158 wget
-U "IPFireSourceGrabber/2.x" $URL_TOOLCHAIN/$PACKAGE.
tar.gz
$URL_TOOLCHAIN/$PACKAGE.md5
>& /dev
/null
1159 if [ $?
-ne 0 ]; then
1160 echo "`date -u '+%b %e %T'`: error downloading $PACKAGE toolchain for ${BUILD_ARCH} machine" |
tee -a $LOGFILE
1162 if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then
1163 echo "`date -u '+%b %e %T'`: toolchain md5 ok" |
tee -a $LOGFILE
1165 exiterror
"$PACKAGE.md5 did not match, check downloaded package"
1169 echo "Toolchain is already downloaded. Exiting..."
1174 echo -ne "`date -u '+%b %e %T'`: Build sources iso for ${BUILD_ARCH}" |
tee -a $LOGFILE
1175 chroot
$LFS /tools
/bin
/env
-i HOME
=/root \
1176 TERM
=$TERM PS1
='\u:\w\$ ' \
1177 PATH
=/usr
/local
/bin
:/bin
:/usr
/bin
:/sbin
:/usr
/sbin \
1178 VERSION
=$VERSION NAME
="$NAME" SNAME
="$SNAME" BUILD_ARCH
="${BUILD_ARCH}" \
1179 /bin
/bash
-x -c "cd /usr/src/lfs && make -f sources-iso LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
1180 mv $LFS/install
/images
/ipfire-
* $BASEDIR >> $LOGFILE 2>&1
1181 if [ $?
-eq "0" ]; then
1182 beautify message DONE
1184 beautify message FAIL
1190 if [ -z $IPFIRE_USER ]; then
1191 echo -n "You have to setup IPFIRE_USER first. See .config for details."
1192 beautify message FAIL
1196 URL_SOURCE
=$
(grep URL_SOURCE lfs
/Config |
awk '{ print $3 }')
1197 REMOTE_FILES
=$
(echo "ls -1" | sftp
-C ${IPFIRE_USER}@
${URL_SOURCE})
1199 for file in ${BASEDIR}/cache
/*; do
1200 [ -d "${file}" ] && continue
1201 grep -q "$(basename ${file})" <<<$REMOTE_FILES && continue
1202 NEW_FILES
="$NEW_FILES $file"
1204 [ -n "$NEW_FILES" ] && scp
-2 $NEW_FILES ${IPFIRE_USER}@
${URL_SOURCE}
1213 echo "Usage: $0 {build|changelog|clean|gettoolchain|downloadsrc|shell|sync|toolchain}"
1214 cat doc
/make.sh-usage