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
="110" # Core Level (Filename)
29 PAKFIRE_CORE
="110" # 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 if [ -f .config
]; then
72 if [ -n "${BUILD_ARCH}" ]; then
73 configure_build
"${BUILD_ARCH}"
74 elif [ -n "${TARGET_ARCH}" ]; then
75 configure_build
"${TARGET_ARCH}"
78 configure_build
"default"
81 if [ -z $EDITOR ]; then
82 for i
in nano emacs vi
; do
83 EDITOR
=$
(which $i 2>/dev
/null
)
84 if ! [ -z $EDITOR ]; then
89 [ -z $EDITOR ] && exiterror
"You should have installed an editor."
94 ############################################################################
96 # Are we running the right shell? #
98 ############################################################################
99 if [ ! "$BASH" ]; then
100 exiterror
"BASH environment variable is not set. You're probably running the wrong shell."
103 if [ -z "${BASH_VERSION}" ]; then
104 exiterror
"Not running BASH shell."
108 ############################################################################
110 # Trap on emergency exit #
112 ############################################################################
113 trap "exiterror 'Build process interrupted'" SIGINT SIGTERM SIGKILL SIGSTOP SIGQUIT
116 ############################################################################
118 # Resetting our nice level #
120 ############################################################################
121 echo -ne "Resetting our nice level to $NICE" |
tee -a $LOGFILE
122 renice
$NICE $$
> /dev
/null
123 if [ `nice` != "$NICE" ]; then
124 beautify message FAIL
125 exiterror
"Failed to set correct nice level"
127 beautify message DONE
131 ############################################################################
133 # Checking if running as root user #
135 ############################################################################
136 echo -ne "Checking if we're running as root user" |
tee -a $LOGFILE
137 if [ `id -u` != 0 ]; then
138 beautify message FAIL
139 exiterror
"Not building as root"
141 beautify message DONE
145 ############################################################################
147 # Checking for necessary temporary space #
149 ############################################################################
150 echo -ne "Checking for necessary space on disk $BASE_DEV" |
tee -a $LOGFILE
151 BASE_DEV
=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $1 }'`
152 BASE_ASPACE
=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $4 }'`
153 if (( 2048000 > $BASE_ASPACE )); then
154 BASE_USPACE
=`du -skx $BASEDIR | awk '{print $1}'`
155 if (( 2048000 - $BASE_USPACE > $BASE_ASPACE )); then
156 beautify message FAIL
157 exiterror
"Not enough temporary space available, need at least 2GB on $BASE_DEV"
160 beautify message DONE
163 ############################################################################
165 # Building Linux From Scratch system #
167 ############################################################################
174 # Check /tools symlink
175 if [ -h /tools
]; then
178 if [ ! -a /tools
]; then
179 ln -s $BASEDIR/build
/tools
/
181 if [ ! -h /tools
]; then
182 exiterror
"Could not create /tools symbolic link."
188 if [ -z $MAKETUNING ]; then
189 CPU_COUNT
="$(getconf _NPROCESSORS_ONLN 2>/dev/null)"
190 if [ -z "${CPU_COUNT}" ]; then
194 MAKETUNING
="-j$(( ${CPU_COUNT} * 2 + 1 ))"
196 export LFS LC_ALL CFLAGS CXXFLAGS MAKETUNING
197 unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
199 # Make some extra directories
200 mkdir
-p $BASEDIR/build
/{tools
,etc
,usr
/src
} 2>/dev
/null
201 mkdir
-p $BASEDIR/build
/{dev
/{shm
,pts
},proc
,sys
}
202 mkdir
-p $BASEDIR/{cache
,ccache
} 2>/dev
/null
203 mkdir
-p $BASEDIR/build
/usr
/src
/{cache
,config
,doc
,html
,langs
,lfs
,log
,src
,ccache
}
205 mknod
-m 600 $BASEDIR/build
/dev
/console c
5 1 2>/dev
/null
206 mknod
-m 666 $BASEDIR/build
/dev
/null c
1 3 2>/dev
/null
208 # Make all sources and proc available under lfs build
209 mount
--bind /dev
$BASEDIR/build
/dev
210 mount
--bind /dev
/pts
$BASEDIR/build
/dev
/pts
211 mount
--bind /dev
/shm
$BASEDIR/build
/dev
/shm
212 mount
--bind /proc
$BASEDIR/build
/proc
213 mount
--bind /sys
$BASEDIR/build
/sys
214 mount
--bind $BASEDIR/cache
$BASEDIR/build
/usr
/src
/cache
215 mount
--bind $BASEDIR/ccache
$BASEDIR/build
/usr
/src
/ccache
216 mount
--bind $BASEDIR/config
$BASEDIR/build
/usr
/src
/config
217 mount
--bind $BASEDIR/doc
$BASEDIR/build
/usr
/src
/doc
218 mount
--bind $BASEDIR/html
$BASEDIR/build
/usr
/src
/html
219 mount
--bind $BASEDIR/langs
$BASEDIR/build
/usr
/src
/langs
220 mount
--bind $BASEDIR/lfs
$BASEDIR/build
/usr
/src
/lfs
221 mount
--bind $BASEDIR/log
$BASEDIR/build
/usr
/src
/log
222 mount
--bind $BASEDIR/src
$BASEDIR/build
/usr
/src
/src
224 # Run LFS static binary creation scripts one by one
225 export CCACHE_DIR
=$BASEDIR/ccache
226 export CCACHE_COMPRESS
=1
227 export CCACHE_COMPILERCHECK
="string:toolchain-${TOOLCHAINVER} ${BUILD_ARCH}"
229 # Remove pre-install list of installed files in case user erase some files before rebuild
230 rm -f $BASEDIR/build
/usr
/src
/lsalr
2>/dev
/null
232 # Prepare string for /etc/system-release.
233 SYSTEM_RELEASE
="${NAME} ${VERSION} (${BUILD_ARCH})"
234 if [ "$(git status -s | wc -l)" == "0" ]; then
239 case "$GIT_BRANCH" in
241 SYSTEM_RELEASE
="${SYSTEM_RELEASE} - $GIT_BRANCH$GIT_STATUS"
244 SYSTEM_RELEASE
="${SYSTEM_RELEASE} - Development Build: $GIT_BRANCH/$GIT_LASTCOMMIT$GIT_STATUS"
251 case "${BUILD_ARCH}:${HOST_ARCH}" in
258 i586
:i586|i586
:i686|i586
:x86_64
)
266 arvm7hl
:armv7hl|armv7hl
:armv7l
)
270 armv5tel
:armv5tel|armv5tel
:armv5tejl|armv5tel
:armv6l|armv5tel
:armv7l|armv5tel
:aarch64
)
279 exiterror
"Cannot build ${BUILD_ARCH} toolchain on $(uname -m). Please use the download if any."
281 local gcc
=$
(type -p gcc
)
282 if [ -z "${gcc}" ]; then
283 exiterror
"Could not find GCC. You will need a working build enviroment in order to build the toolchain."
286 LOGFILE
="$BASEDIR/log/_build.toolchain.log"
290 lfsmake1 ccache PASS
=1
291 lfsmake1 binutils PASS
=1
293 lfsmake1 linux KCFG
="-headers"
296 lfsmake1 binutils PASS
=2
298 lfsmake1 ccache PASS
=2
322 lfsmake1 fake-environ
323 lfsmake1 cleanup-toolchain
327 LOGFILE
="$BASEDIR/log/_build.base.log"
330 lfsmake2 linux KCFG
="-headers"
334 lfsmake2 cleanup-toolchain
351 lfsmake2 ncurses-compat
357 lfsmake2 readline-compat
396 LOGFILE
="$BASEDIR/log/_build.ipfire.log"
403 lfsmake2 libusb-compat
409 lfsmake2 linux-firmware
410 lfsmake2 ath10k-firmware
411 lfsmake2 dvb-firmwares
412 lfsmake2 mt7601u-firmware
413 lfsmake2 zd1211-firmware
414 lfsmake2 rpi-firmware
421 lfsmake2 multipath-tools
425 lfsmake2 libnfnetlink
426 lfsmake2 libnetfilter_queue
427 lfsmake2 libnetfilter_conntrack
428 lfsmake2 libnetfilter_cthelper
429 lfsmake2 libnetfilter_cttimeout
432 case "${BUILD_ARCH}" in
434 lfsmake2 linux KCFG
=""
435 lfsmake2 backports KCFG
=""
436 lfsmake2 e1000e KCFG
=""
438 lfsmake2 ixgbe KCFG
=""
439 lfsmake2 xtables-addons KCFG
=""
440 lfsmake2 linux-initrd KCFG
=""
443 # x86-pae (Native and new XEN) kernel build
444 lfsmake2 linux KCFG
="-pae"
445 lfsmake2 backports KCFG
="-pae"
446 lfsmake2 e1000e KCFG
="-pae"
447 lfsmake2 igb KCFG
="-pae"
448 lfsmake2 ixgbe KCFG
="-pae"
449 lfsmake2 xtables-addons KCFG
="-pae"
450 lfsmake2 linux-initrd KCFG
="-pae"
453 lfsmake2 linux KCFG
=""
454 lfsmake2 backports KCFG
=""
455 lfsmake2 e1000e KCFG
=""
457 lfsmake2 ixgbe KCFG
=""
458 lfsmake2 xtables-addons KCFG
=""
459 lfsmake2 linux-initrd KCFG
=""
463 # arm-rpi (Raspberry Pi) kernel build
464 lfsmake2 linux KCFG
="-rpi"
465 lfsmake2 backports KCFG
="-rpi"
466 lfsmake2 xtables-addons KCFG
="-rpi"
467 lfsmake2 linux-initrd KCFG
="-rpi"
469 # arm multi platform (Panda, Wandboard ...) kernel build
470 lfsmake2 linux KCFG
="-multi"
471 lfsmake2 backports KCFG
="-multi"
472 lfsmake2 e1000e KCFG
="-multi"
473 lfsmake2 igb KCFG
="-multi"
474 lfsmake2 ixgbe KCFG
="-multi"
475 lfsmake2 xtables-addons KCFG
="-multi"
476 lfsmake2 linux-initrd KCFG
="-multi"
478 # arm-kirkwood (Dreamplug, ICY-Box ...) kernel build
479 lfsmake2 linux KCFG
="-kirkwood"
480 lfsmake2 backports KCFG
="-kirkwood"
481 lfsmake2 e1000e KCFG
="-kirkwood"
482 lfsmake2 igb KCFG
="-kirkwood"
483 lfsmake2 ixgbe KCFG
="-kirkwood"
484 lfsmake2 xtables-addons KCFG
="-kirkwood"
485 lfsmake2 linux-initrd KCFG
="-kirkwood"
488 lfsmake2 xtables-addons USPACE
="1"
490 [ "${BUILD_ARCH}" = "i586" ] && lfsmake2 openssl KCFG
='-sse2'
491 lfsmake2 libgpg-error
513 lfsmake2 ca-certificates
521 lfsmake2 libjpeg-compat
545 lfsmake2 web-user-interface
552 lfsmake2 reiserfsprogs
563 lfsmake2 perl-Device-SerialPort
564 lfsmake2 perl-Device-Modem
565 lfsmake2 perl-Apache-Htpasswd
571 lfsmake2 conntrack-tools
575 lfsmake2 l7-protocols
577 lfsmake2 capi4k-utils
586 lfsmake2 HTML-Template
587 lfsmake2 Compress-Zlib
593 lfsmake2 Net-IPv4Addr
596 lfsmake2 IO-Socket-SSL
601 lfsmake2 Convert-TNEF
602 lfsmake2 Convert-UUlib
605 lfsmake2 Text-Tabs
+Wrap
606 lfsmake2 Locale-Country
608 lfsmake2 Crypt-PasswdMD5
610 lfsmake2 python-setuptools
611 lfsmake2 python-clientform
612 lfsmake2 python-mechanize
613 lfsmake2 python-feedparser
614 lfsmake2 python-rssdler
615 lfsmake2 python-inotify
616 lfsmake2 python-docutils
617 lfsmake2 python-daemon
618 lfsmake2 python-ipaddress
622 lfsmake2 noip_updater
626 lfsmake2 dejavu-fonts-ttf
659 lfsmake2 cups-filters
660 lfsmake2 epson-inkjet-printer-escpr
669 lfsmake2 bridge-utils
671 lfsmake2 smartmontools
677 lfsmake2 openmailadmin
679 lfsmake2 spamassassin
725 lfsmake2 python-pyparsing
726 lfsmake2 spice-protocol
744 lfsmake2 vdr_streamdev
745 lfsmake2 vdr_epgsearch
750 lfsmake2 icegenerator
752 lfsmake2 libmpdclient
754 lfsmake2 perl-Net-SMTP-SSL
755 lfsmake2 perl-MIME-Base64
756 lfsmake2 perl-Authen-SASL
757 lfsmake2 perl-MIME-Lite
758 lfsmake2 perl-Email-Date-Format
763 lfsmake2 wpa_supplicant
769 lfsmake2 cpufrequtils
777 lfsmake2 streamripper
782 lfsmake2 perl-gettext
783 lfsmake2 perl-Sort-Naturally
787 lfsmake2 perl-DBD-mysql
788 lfsmake2 perl-DBD-SQLite
789 lfsmake2 perl-File-ReadBackwards
802 lfsmake2 usb_modeswitch
803 lfsmake2 usb_modeswitch_data
813 lfsmake2 python-m2crypto
814 lfsmake2 wireless-regdb
817 lfsmake2 python-distutils-extra
819 lfsmake2 python-progressbar
820 lfsmake2 python-xattr
822 lfsmake2 transmission
837 lfsmake2 check_mk_agent
844 lfsmake2 ipfire-netboot
850 lfsmake2 perl-Carp-Clan
851 lfsmake2 perl-Date-Calc
852 lfsmake2 perl-Date-Manip
853 lfsmake2 perl-File-Tail
854 lfsmake2 perl-TimeDate
866 lfsmake2 perl-PDF-API2
867 lfsmake2 squid-accounting
870 lfsmake2 perl-Text-CSV_XS
881 lfsmake2 libpciaccess
885 lfsmake2 perl-common-sense
886 lfsmake2 perl-inotify2
891 # Run installer scripts one by one
892 LOGFILE
="$BASEDIR/log/_build.installer.log"
900 LOGFILE
="$BASEDIR/log/_build.packages.log"
902 echo "... see detailed log in _build.*.log files" >> $LOGFILE
905 # Generating list of packages used
906 echo -n "Generating packages list from logs" |
tee -a $LOGFILE
907 rm -f $BASEDIR/doc
/packages-list
908 for i
in `ls -1tr $BASEDIR/log/[^_]*`; do
909 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
910 echo "* `basename $i`" >>$BASEDIR/doc
/packages-list
913 echo "== List of softwares used to build $NAME Version: $VERSION ==" > $BASEDIR/doc
/packages-list.txt
914 grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$\|.tgz$\|-config$\|_missing_rootfile$\|install1$\|install2$\|pass1$\|pass2$\|pass3$' \
915 $BASEDIR/doc
/packages-list |
sort >> $BASEDIR/doc
/packages-list.txt
916 rm -f $BASEDIR/doc
/packages-list
917 # packages-list.txt is ready to be displayed for wiki page
918 beautify message DONE
922 [ -z $GIT_TAG ] || LAST_TAG
=$GIT_TAG
923 [ -z $LAST_TAG ] || EXT
="$LAST_TAG..HEAD"
924 git log
-n 500 --no-merges --pretty=medium
--shortstat $EXT > $BASEDIR/doc
/ChangeLog
926 # Create images for install
929 # Check if there is a loop device for building in virtual environments
930 modprobe loop
2>/dev
/null
931 if [ $BUILD_IMAGES == 1 ] && ([ -e /dev
/loop
/0 ] ||
[ -e /dev
/loop0
] ||
[ -e "/dev/loop-control" ]); then
932 lfsmake2 flash-images
933 lfsmake2 flash-images SCON
=1
936 mv $LFS/install
/images
/{*.iso
,*.tgz
,*.img.gz
,*.bz2
} $BASEDIR >> $LOGFILE 2>&1
941 mv $LFS/install
/images
/*.bz2
$BASEDIR >> $LOGFILE 2>&1
945 # remove not useable iso on armv5tel (needed to build flash images)
946 [ "${BUILD_ARCH}" = "armv5tel" ] && rm -rf *.iso
948 for i
in `ls *.bz2 *.img.gz *.iso`; do
955 rm -rf $BASEDIR/build
/tmp
/*
957 # Generating total list of files
958 echo -n "Generating files list from logs" |
tee -a $LOGFILE
959 rm -f $BASEDIR/log
/FILES
960 for i
in `ls -1tr $BASEDIR/log/[^_]*`; do
961 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
962 echo "##" >>$BASEDIR/log
/FILES
963 echo "## `basename $i`" >>$BASEDIR/log
/FILES
964 echo "##" >>$BASEDIR/log
/FILES
965 cat $i |
sed "s%^\./%#%" |
sort >> $BASEDIR/log
/FILES
968 beautify message DONE
974 lfsmake2 core-updates
977 for i
in $
(find $BASEDIR/config
/rootfiles
/packages
{/${BUILD_ARCH},} -maxdepth 1 -type f
); do
979 if [ -e $BASEDIR/lfs
/$i ]; then
983 beautify message SKIP
986 test -d $BASEDIR/packages || mkdir
$BASEDIR/packages
987 mv -f $LFS/install
/packages
/* $BASEDIR/packages
>> $LOGFILE 2>&1
988 rm -rf $BASEDIR/build
/install
/packages
/*
991 while [ $# -gt 0 ]; do
994 configure_build
"${1#--target=}"
997 exiterror
"Unknown configuration option: ${1}"
1000 # Found a command, so exit options parsing.
1007 # See what we're supposed to do
1011 PACKAGE
=`ls -v -r $BASEDIR/cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.gz 2> /dev/null | head -n 1`
1012 #only restore on a clean disk
1013 if [ ! -e "${BASEDIR}/build/tools/.toolchain-successful" ]; then
1014 if [ ! -n "$PACKAGE" ]; then
1015 beautify build_stage
"Full toolchain compilation - Native GCC: `gcc --version | grep GCC | awk {'print $3'}`"
1019 PACKAGENAME
=${PACKAGE%.tar.gz}
1020 beautify build_stage
"Packaged toolchain compilation"
1021 if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then
1025 exiterror
"$PACKAGENAME md5 did not match, check downloaded package"
1029 echo -n "Using installed toolchain" |
tee -a $LOGFILE
1030 beautify message SKIP
1034 beautify build_start
1035 beautify build_stage
"Building LFS"
1038 beautify build_stage
"Building IPFire"
1041 beautify build_stage
"Building installer"
1044 beautify build_stage
"Building packages"
1047 beautify build_stage
"Checking Logfiles for new Files"
1050 tools
/checknewlog.pl
1051 tools
/checkrootfiles
1057 # enter a shell inside LFS chroot
1058 # may be used to changed kernel settings
1063 echo -en "${BOLD}Cleaning build directory...${NORMAL}"
1064 for i
in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do
1065 $LOSETUP -d $i 2>/dev
/null
1067 for i
in `mount | grep $BASEDIR | cut -d " " -f 1`; do
1071 for i
in `seq 0 7`; do
1072 if ( losetup
/dev
/loop
${i} 2>/dev
/null |
grep -q "/install/images" ); then
1073 umount
/dev
/loop
${i} 2>/dev
/null
;
1074 losetup
-d /dev
/loop
${i} 2>/dev
/null
;
1077 rm -rf $BASEDIR/build
1078 rm -rf $BASEDIR/cdrom
1079 rm -rf $BASEDIR/packages
1081 if [ -h /tools
]; then
1084 rm -f $BASEDIR/ipfire-
*
1085 beautify message DONE
1088 if [ ! -d $BASEDIR/cache
]; then
1089 mkdir
$BASEDIR/cache
1091 mkdir
-p $BASEDIR/log
1092 echo -e "${BOLD}Preload all source files${NORMAL}" |
tee -a $LOGFILE
1095 for c
in `seq $MAX_RETRIES`; do
1096 if (( FINISHED
==1 )); then
1102 if [ -f "$i" -a "$i" != "Config" ]; then
1103 lfsmakecommoncheck
${i} ||
continue
1105 make -s -f $i LFS_BASEDIR
=$BASEDIR BUILD_ARCH
="${BUILD_ARCH}" \
1106 MESSAGE
="$i\t ($c/$MAX_RETRIES)" download
>> $LOGFILE 2>&1
1107 if [ $?
-ne 0 ]; then
1108 beautify message FAIL
1111 if [ $c -eq 1 ]; then
1112 beautify message DONE
1118 echo -e "${BOLD}***Verifying md5sums${NORMAL}"
1121 if [ -f "$i" -a "$i" != "Config" ]; then
1122 lfsmakecommoncheck
${i} > /dev
/null ||
continue
1123 make -s -f $i LFS_BASEDIR
=$BASEDIR BUILD_ARCH
="${BUILD_ARCH}" \
1124 MESSAGE
="$i\t " md5
>> $LOGFILE 2>&1
1125 if [ $?
-ne 0 ]; then
1126 echo -ne "MD5 difference in lfs/$i"
1127 beautify message FAIL
1132 if [ $ERROR -eq 0 ]; then
1133 echo -ne "${BOLD}all files md5sum match${NORMAL}"
1134 beautify message DONE
1136 echo -ne "${BOLD}not all files were correctly download${NORMAL}"
1137 beautify message FAIL
1139 cd - >/dev
/null
2>&1
1144 beautify build_stage
"Toolchain compilation - Native GCC: `gcc --version | grep GCC | awk {'print $3'}`"
1146 echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for ${BUILD_ARCH}" |
tee -a $LOGFILE
1147 test -d $BASEDIR/cache
/toolchains || mkdir
-p $BASEDIR/cache
/toolchains
1148 cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache
/toolchains
/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.
tar.gz \
1149 build
/tools build
/bin
/sh log
>> $LOGFILE
1150 md5sum cache
/toolchains
/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.
tar.gz \
1151 > cache
/toolchains
/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.md5
1155 # arbitrary name to be updated in case of new toolchain package upload
1156 PACKAGE
=$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}
1157 if [ ! -f $BASEDIR/cache
/toolchains
/$PACKAGE.
tar.gz
]; then
1158 URL_TOOLCHAIN
=`grep URL_TOOLCHAIN lfs/Config | awk '{ print $3 }'`
1159 test -d $BASEDIR/cache
/toolchains || mkdir
-p $BASEDIR/cache
/toolchains
1160 echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for ${BUILD_ARCH}" |
tee -a $LOGFILE
1161 cd $BASEDIR/cache
/toolchains
1162 wget
-U "IPFireSourceGrabber/2.x" $URL_TOOLCHAIN/$PACKAGE.
tar.gz
$URL_TOOLCHAIN/$PACKAGE.md5
>& /dev
/null
1163 if [ $?
-ne 0 ]; then
1164 echo "`date -u '+%b %e %T'`: error downloading $PACKAGE toolchain for ${BUILD_ARCH} machine" |
tee -a $LOGFILE
1166 if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then
1167 echo "`date -u '+%b %e %T'`: toolchain md5 ok" |
tee -a $LOGFILE
1169 exiterror
"$PACKAGE.md5 did not match, check downloaded package"
1173 echo "Toolchain is already downloaded. Exiting..."
1178 echo -ne "`date -u '+%b %e %T'`: Build sources iso for ${BUILD_ARCH}" |
tee -a $LOGFILE
1179 chroot
$LFS /tools
/bin
/env
-i HOME
=/root \
1180 TERM
=$TERM PS1
='\u:\w\$ ' \
1181 PATH
=/usr
/local
/bin
:/bin
:/usr
/bin
:/sbin
:/usr
/sbin \
1182 VERSION
=$VERSION NAME
="$NAME" SNAME
="$SNAME" BUILD_ARCH
="${BUILD_ARCH}" \
1183 /bin
/bash
-x -c "cd /usr/src/lfs && make -f sources-iso LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
1184 mv $LFS/install
/images
/ipfire-
* $BASEDIR >> $LOGFILE 2>&1
1185 if [ $?
-eq "0" ]; then
1186 beautify message DONE
1188 beautify message FAIL
1194 if [ -z $IPFIRE_USER ]; then
1195 echo -n "You have to setup IPFIRE_USER first. See .config for details."
1196 beautify message FAIL
1200 URL_SOURCE
=$
(grep URL_SOURCE lfs
/Config |
awk '{ print $3 }')
1201 REMOTE_FILES
=$
(echo "ls -1" | sftp
-C ${IPFIRE_USER}@
${URL_SOURCE})
1203 for file in ${BASEDIR}/cache
/*; do
1204 [ -d "${file}" ] && continue
1205 grep -q "$(basename ${file})" <<<$REMOTE_FILES && continue
1206 NEW_FILES
="$NEW_FILES $file"
1208 [ -n "$NEW_FILES" ] && scp
-2 $NEW_FILES ${IPFIRE_USER}@
${URL_SOURCE}
1217 echo "Usage: $0 {build|changelog|clean|gettoolchain|downloadsrc|shell|sync|toolchain}"
1218 cat doc
/make.sh-usage