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_DIR} symlink
167 if [ -h "${TOOLS_DIR}" ]; then
171 if [ ! -e "${TOOLS_DIR}" ]; then
172 ln -s "${BASEDIR}/build${TOOLS_DIR}" "${TOOLS_DIR}"
175 if [ ! -h "${TOOLS_DIR}" ]; then
176 exiterror
"Could not create ${TOOLS_DIR} symbolic link"
182 export LFS LC_ALL CFLAGS CXXFLAGS MAKETUNING
183 unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
185 # Make some extra directories
186 mkdir
-p "${BASEDIR}/build${TOOLS_DIR}" 2>/dev
/null
187 mkdir
-p $BASEDIR/build
/{etc
,usr
/src
} 2>/dev
/null
188 mkdir
-p $BASEDIR/build
/{dev
/{shm
,pts
},proc
,sys
}
189 mkdir
-p $BASEDIR/{cache
,ccache
} 2>/dev
/null
190 mkdir
-p $BASEDIR/build
/usr
/src
/{cache
,config
,doc
,html
,langs
,lfs
,log
,src
,ccache
}
192 mknod
-m 600 $BASEDIR/build
/dev
/console c
5 1 2>/dev
/null
193 mknod
-m 666 $BASEDIR/build
/dev
/null c
1 3 2>/dev
/null
195 # Make all sources and proc available under lfs build
196 mount
--bind /dev
$BASEDIR/build
/dev
197 mount
--bind /dev
/pts
$BASEDIR/build
/dev
/pts
198 mount
--bind /dev
/shm
$BASEDIR/build
/dev
/shm
199 mount
--bind /proc
$BASEDIR/build
/proc
200 mount
--bind /sys
$BASEDIR/build
/sys
201 mount
--bind $BASEDIR/cache
$BASEDIR/build
/usr
/src
/cache
202 mount
--bind $BASEDIR/ccache
$BASEDIR/build
/usr
/src
/ccache
203 mount
--bind $BASEDIR/config
$BASEDIR/build
/usr
/src
/config
204 mount
--bind $BASEDIR/doc
$BASEDIR/build
/usr
/src
/doc
205 mount
--bind $BASEDIR/html
$BASEDIR/build
/usr
/src
/html
206 mount
--bind $BASEDIR/langs
$BASEDIR/build
/usr
/src
/langs
207 mount
--bind $BASEDIR/lfs
$BASEDIR/build
/usr
/src
/lfs
208 mount
--bind $BASEDIR/log
$BASEDIR/build
/usr
/src
/log
209 mount
--bind $BASEDIR/src
$BASEDIR/build
/usr
/src
/src
211 # Run LFS static binary creation scripts one by one
212 export CCACHE_DIR
=$BASEDIR/ccache
213 export CCACHE_COMPRESS
=1
214 export CCACHE_COMPILERCHECK
="string:toolchain-${TOOLCHAINVER} ${BUILD_ARCH}"
216 # Remove pre-install list of installed files in case user erase some files before rebuild
217 rm -f $BASEDIR/build
/usr
/src
/lsalr
2>/dev
/null
219 # Prepare string for /etc/system-release.
220 SYSTEM_RELEASE
="${NAME} ${VERSION} (${BUILD_ARCH})"
221 if [ "$(git status -s | wc -l)" == "0" ]; then
226 case "$GIT_BRANCH" in
228 SYSTEM_RELEASE
="${SYSTEM_RELEASE} - $GIT_BRANCH$GIT_STATUS"
231 SYSTEM_RELEASE
="${SYSTEM_RELEASE} - Development Build: $GIT_BRANCH/$GIT_LASTCOMMIT$GIT_STATUS"
238 case "${BUILD_ARCH}:${HOST_ARCH}" in
245 i586
:i586|i586
:i686|i586
:x86_64
)
253 arvm7hl
:armv7hl|armv7hl
:armv7l
)
257 armv5tel
:armv5tel|armv5tel
:armv5tejl|armv5tel
:armv6l|armv5tel
:armv7l|armv5tel
:aarch64
)
266 exiterror
"Cannot build ${BUILD_ARCH} toolchain on $(uname -m). Please use the download if any."
268 local gcc
=$
(type -p gcc
)
269 if [ -z "${gcc}" ]; then
270 exiterror
"Could not find GCC. You will need a working build enviroment in order to build the toolchain."
273 LOGFILE
="$BASEDIR/log/_build.toolchain.log"
277 lfsmake1 ccache PASS
=1
278 lfsmake1 binutils PASS
=1
280 lfsmake1 linux KCFG
="-headers"
283 lfsmake1 binutils PASS
=2
285 lfsmake1 ccache PASS
=2
309 lfsmake1 fake-environ
310 lfsmake1 cleanup-toolchain
314 LOGFILE
="$BASEDIR/log/_build.base.log"
317 lfsmake2 linux KCFG
="-headers"
321 lfsmake2 cleanup-toolchain
338 lfsmake2 ncurses-compat
344 lfsmake2 readline-compat
384 LOGFILE
="$BASEDIR/log/_build.ipfire.log"
391 lfsmake2 libusb-compat
397 lfsmake2 linux-firmware
398 lfsmake2 ath10k-firmware
399 lfsmake2 dvb-firmwares
400 lfsmake2 mt7601u-firmware
401 lfsmake2 zd1211-firmware
402 lfsmake2 rpi-firmware
409 lfsmake2 multipath-tools
413 lfsmake2 libnfnetlink
414 lfsmake2 libnetfilter_queue
415 lfsmake2 libnetfilter_conntrack
416 lfsmake2 libnetfilter_cthelper
417 lfsmake2 libnetfilter_cttimeout
420 case "${BUILD_ARCH}" in
422 lfsmake2 linux KCFG
=""
423 lfsmake2 backports KCFG
=""
424 lfsmake2 e1000e KCFG
=""
426 lfsmake2 ixgbe KCFG
=""
427 lfsmake2 xtables-addons KCFG
=""
428 lfsmake2 linux-initrd KCFG
=""
431 # x86-pae (Native and new XEN) kernel build
432 lfsmake2 linux KCFG
="-pae"
433 lfsmake2 backports KCFG
="-pae"
434 lfsmake2 e1000e KCFG
="-pae"
435 lfsmake2 igb KCFG
="-pae"
436 lfsmake2 ixgbe KCFG
="-pae"
437 lfsmake2 xtables-addons KCFG
="-pae"
438 lfsmake2 linux-initrd KCFG
="-pae"
441 lfsmake2 linux KCFG
=""
442 lfsmake2 backports KCFG
=""
443 lfsmake2 e1000e KCFG
=""
445 lfsmake2 ixgbe KCFG
=""
446 lfsmake2 xtables-addons KCFG
=""
447 lfsmake2 linux-initrd KCFG
=""
451 # arm-rpi (Raspberry Pi) kernel build
452 lfsmake2 linux KCFG
="-rpi"
453 lfsmake2 backports KCFG
="-rpi"
454 lfsmake2 xtables-addons KCFG
="-rpi"
455 lfsmake2 linux-initrd KCFG
="-rpi"
457 # arm multi platform (Panda, Wandboard ...) kernel build
458 lfsmake2 linux KCFG
="-multi"
459 lfsmake2 backports KCFG
="-multi"
460 lfsmake2 e1000e KCFG
="-multi"
461 lfsmake2 igb KCFG
="-multi"
462 lfsmake2 ixgbe KCFG
="-multi"
463 lfsmake2 xtables-addons KCFG
="-multi"
464 lfsmake2 linux-initrd KCFG
="-multi"
466 # arm-kirkwood (Dreamplug, ICY-Box ...) kernel build
467 lfsmake2 linux KCFG
="-kirkwood"
468 lfsmake2 backports KCFG
="-kirkwood"
469 lfsmake2 e1000e KCFG
="-kirkwood"
470 lfsmake2 igb KCFG
="-kirkwood"
471 lfsmake2 ixgbe KCFG
="-kirkwood"
472 lfsmake2 xtables-addons KCFG
="-kirkwood"
473 lfsmake2 linux-initrd KCFG
="-kirkwood"
476 lfsmake2 xtables-addons USPACE
="1"
478 [ "${BUILD_ARCH}" = "i586" ] && lfsmake2 openssl KCFG
='-sse2'
479 lfsmake2 libgpg-error
485 lfsmake2 libevent2-compat
504 lfsmake2 ca-certificates
512 lfsmake2 libjpeg-compat
535 lfsmake2 web-user-interface
543 lfsmake2 reiserfsprogs
554 lfsmake2 perl-Device-SerialPort
555 lfsmake2 perl-Device-Modem
556 lfsmake2 perl-Apache-Htpasswd
562 lfsmake2 conntrack-tools
566 lfsmake2 l7-protocols
568 lfsmake2 capi4k-utils
577 lfsmake2 HTML-Template
578 lfsmake2 Compress-Zlib
584 lfsmake2 Net-IPv4Addr
587 lfsmake2 IO-Socket-SSL
592 lfsmake2 Convert-TNEF
593 lfsmake2 Convert-UUlib
596 lfsmake2 Text-Tabs
+Wrap
597 lfsmake2 Locale-Country
599 lfsmake2 Crypt-PasswdMD5
601 lfsmake2 python-setuptools
602 lfsmake2 python-clientform
603 lfsmake2 python-mechanize
604 lfsmake2 python-feedparser
605 lfsmake2 python-rssdler
606 lfsmake2 python-inotify
607 lfsmake2 python-docutils
608 lfsmake2 python-daemon
609 lfsmake2 python-ipaddress
612 lfsmake2 noip_updater
616 lfsmake2 dejavu-fonts-ttf
617 lfsmake2 ubuntu-font-family
650 lfsmake2 cups-filters
651 lfsmake2 epson-inkjet-printer-escpr
660 lfsmake2 bridge-utils
662 lfsmake2 smartmontools
668 lfsmake2 openmailadmin
670 lfsmake2 spamassassin
715 lfsmake2 python-pyparsing
716 lfsmake2 spice-protocol
734 lfsmake2 vdr_streamdev
735 lfsmake2 vdr_epgsearch
740 lfsmake2 icegenerator
742 lfsmake2 libmpdclient
744 lfsmake2 perl-Net-SMTP-SSL
745 lfsmake2 perl-MIME-Base64
746 lfsmake2 perl-Authen-SASL
747 lfsmake2 perl-MIME-Lite
748 lfsmake2 perl-Email-Date-Format
753 lfsmake2 wpa_supplicant
759 lfsmake2 cpufrequtils
767 lfsmake2 streamripper
772 lfsmake2 perl-gettext
773 lfsmake2 perl-Sort-Naturally
777 lfsmake2 perl-DBD-mysql
778 lfsmake2 perl-DBD-SQLite
779 lfsmake2 perl-File-ReadBackwards
792 lfsmake2 usb_modeswitch
793 lfsmake2 usb_modeswitch_data
803 lfsmake2 python-m2crypto
804 lfsmake2 wireless-regdb
807 lfsmake2 python-distutils-extra
809 lfsmake2 python-progressbar
810 lfsmake2 python-xattr
812 lfsmake2 transmission
827 lfsmake2 check_mk_agent
834 lfsmake2 ipfire-netboot
840 lfsmake2 perl-Carp-Clan
841 lfsmake2 perl-Date-Calc
842 lfsmake2 perl-Date-Manip
843 lfsmake2 perl-File-Tail
844 lfsmake2 perl-TimeDate
856 lfsmake2 perl-Font-TTF
857 lfsmake2 perl-IO-String
858 lfsmake2 perl-PDF-API2
859 lfsmake2 squid-accounting
862 lfsmake2 perl-Text-CSV_XS
873 lfsmake2 libpciaccess
876 lfsmake2 python3-libvirt
878 lfsmake2 perl-common-sense
879 lfsmake2 perl-inotify2
886 # Run installer scripts one by one
887 LOGFILE
="$BASEDIR/log/_build.installer.log"
895 LOGFILE
="$BASEDIR/log/_build.packages.log"
897 echo "... see detailed log in _build.*.log files" >> $LOGFILE
900 # Generating list of packages used
901 echo -n "Generating packages list from logs" |
tee -a $LOGFILE
902 rm -f $BASEDIR/doc
/packages-list
903 for i
in `ls -1tr $BASEDIR/log/[^_]*`; do
904 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
905 echo "* `basename $i`" >>$BASEDIR/doc
/packages-list
908 echo "== List of softwares used to build $NAME Version: $VERSION ==" > $BASEDIR/doc
/packages-list.txt
909 grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$\|.tgz$\|-config$\|_missing_rootfile$\|install1$\|install2$\|pass1$\|pass2$\|pass3$' \
910 $BASEDIR/doc
/packages-list |
sort >> $BASEDIR/doc
/packages-list.txt
911 rm -f $BASEDIR/doc
/packages-list
912 # packages-list.txt is ready to be displayed for wiki page
913 beautify message DONE
917 [ -z $GIT_TAG ] || LAST_TAG
=$GIT_TAG
918 [ -z $LAST_TAG ] || EXT
="$LAST_TAG..HEAD"
919 git log
-n 500 --no-merges --pretty=medium
--shortstat $EXT > $BASEDIR/doc
/ChangeLog
921 # Create images for install
924 # Check if there is a loop device for building in virtual environments
925 modprobe loop
2>/dev
/null
926 if [ $BUILD_IMAGES == 1 ] && ([ -e /dev
/loop
/0 ] ||
[ -e /dev
/loop0
] ||
[ -e "/dev/loop-control" ]); then
927 lfsmake2 flash-images
928 lfsmake2 flash-images SCON
=1
931 mv $LFS/install
/images
/{*.iso
,*.tgz
,*.img.gz
,*.bz2
} $BASEDIR >> $LOGFILE 2>&1
936 mv $LFS/install
/images
/*.bz2
$BASEDIR >> $LOGFILE 2>&1
940 # remove not useable iso on armv5tel (needed to build flash images)
941 [ "${BUILD_ARCH}" = "armv5tel" ] && rm -rf *.iso
943 for i
in `ls *.bz2 *.img.gz *.iso`; do
950 rm -rf $BASEDIR/build
/tmp
/*
952 # Generating total list of files
953 echo -n "Generating files list from logs" |
tee -a $LOGFILE
954 rm -f $BASEDIR/log
/FILES
955 for i
in `ls -1tr $BASEDIR/log/[^_]*`; do
956 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
957 echo "##" >>$BASEDIR/log
/FILES
958 echo "## `basename $i`" >>$BASEDIR/log
/FILES
959 echo "##" >>$BASEDIR/log
/FILES
960 cat $i |
sed "s%^\./%#%" |
sort >> $BASEDIR/log
/FILES
963 beautify message DONE
969 lfsmake2 core-updates
972 for i
in $
(find $BASEDIR/config
/rootfiles
/packages
{/${BUILD_ARCH},} -maxdepth 1 -type f
); do
974 if [ -e $BASEDIR/lfs
/$i ]; then
978 beautify message SKIP
981 test -d $BASEDIR/packages || mkdir
$BASEDIR/packages
982 mv -f $LFS/install
/packages
/* $BASEDIR/packages
>> $LOGFILE 2>&1
983 rm -rf $BASEDIR/build
/install
/packages
/*
986 while [ $# -gt 0 ]; do
989 configure_build
"${1#--target=}"
992 exiterror
"Unknown configuration option: ${1}"
995 # Found a command, so exit options parsing.
1002 # See what we're supposed to do
1006 PACKAGE
=`ls -v -r $BASEDIR/cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.gz 2> /dev/null | head -n 1`
1007 #only restore on a clean disk
1008 if [ ! -e "${BASEDIR}/build${TOOLS_DIR}/.toolchain-successful" ]; then
1009 if [ ! -n "$PACKAGE" ]; then
1010 beautify build_stage
"Full toolchain compilation"
1014 PACKAGENAME
=${PACKAGE%.tar.gz}
1015 beautify build_stage
"Packaged toolchain compilation"
1016 if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then
1020 exiterror
"$PACKAGENAME md5 did not match, check downloaded package"
1024 echo -n "Using installed toolchain" |
tee -a $LOGFILE
1025 beautify message SKIP
1029 beautify build_start
1030 beautify build_stage
"Building LFS"
1033 beautify build_stage
"Building IPFire"
1036 beautify build_stage
"Building installer"
1039 beautify build_stage
"Building packages"
1042 beautify build_stage
"Checking Logfiles for new Files"
1045 tools
/checknewlog.pl
1046 tools
/checkrootfiles
1052 # enter a shell inside LFS chroot
1053 # may be used to changed kernel settings
1058 echo -en "${BOLD}Cleaning build directory...${NORMAL}"
1059 for i
in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do
1060 $LOSETUP -d $i 2>/dev
/null
1062 for i
in `mount | grep $BASEDIR | cut -d " " -f 1`; do
1066 for i
in `seq 0 7`; do
1067 if ( losetup
/dev
/loop
${i} 2>/dev
/null |
grep -q "/install/images" ); then
1068 umount
/dev
/loop
${i} 2>/dev
/null
;
1069 losetup
-d /dev
/loop
${i} 2>/dev
/null
;
1072 rm -rf $BASEDIR/build
1073 rm -rf $BASEDIR/cdrom
1074 rm -rf $BASEDIR/packages
1076 if [ -h "${TOOLS_DIR}" ]; then
1077 rm -f "${TOOLS_DIR}"
1079 rm -f $BASEDIR/ipfire-
*
1080 beautify message DONE
1083 if [ ! -d $BASEDIR/cache
]; then
1084 mkdir
$BASEDIR/cache
1086 mkdir
-p $BASEDIR/log
1087 echo -e "${BOLD}Preload all source files${NORMAL}" |
tee -a $LOGFILE
1090 for c
in `seq $MAX_RETRIES`; do
1091 if (( FINISHED
==1 )); then
1097 if [ -f "$i" -a "$i" != "Config" ]; then
1098 lfsmakecommoncheck
${i} ||
continue
1100 make -s -f $i LFS_BASEDIR
=$BASEDIR BUILD_ARCH
="${BUILD_ARCH}" \
1101 MESSAGE
="$i\t ($c/$MAX_RETRIES)" download
>> $LOGFILE 2>&1
1102 if [ $?
-ne 0 ]; then
1103 beautify message FAIL
1106 if [ $c -eq 1 ]; then
1107 beautify message DONE
1113 echo -e "${BOLD}***Verifying md5sums${NORMAL}"
1116 if [ -f "$i" -a "$i" != "Config" ]; then
1117 lfsmakecommoncheck
${i} > /dev
/null ||
continue
1118 make -s -f $i LFS_BASEDIR
=$BASEDIR BUILD_ARCH
="${BUILD_ARCH}" \
1119 MESSAGE
="$i\t " md5
>> $LOGFILE 2>&1
1120 if [ $?
-ne 0 ]; then
1121 echo -ne "MD5 difference in lfs/$i"
1122 beautify message FAIL
1127 if [ $ERROR -eq 0 ]; then
1128 echo -ne "${BOLD}all files md5sum match${NORMAL}"
1129 beautify message DONE
1131 echo -ne "${BOLD}not all files were correctly download${NORMAL}"
1132 beautify message FAIL
1134 cd - >/dev
/null
2>&1
1139 beautify build_stage
"Toolchain compilation"
1141 echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for ${BUILD_ARCH}" |
tee -a $LOGFILE
1142 test -d $BASEDIR/cache
/toolchains || mkdir
-p $BASEDIR/cache
/toolchains
1143 cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache
/toolchains
/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.
tar.gz \
1144 build
/${TOOLS_DIR} build
/bin
/sh log
>> $LOGFILE
1145 md5sum cache
/toolchains
/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.
tar.gz \
1146 > cache
/toolchains
/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.md5
1150 # arbitrary name to be updated in case of new toolchain package upload
1151 PACKAGE
=$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}
1152 if [ ! -f $BASEDIR/cache
/toolchains
/$PACKAGE.
tar.gz
]; then
1153 URL_TOOLCHAIN
=`grep URL_TOOLCHAIN lfs/Config | awk '{ print $3 }'`
1154 test -d $BASEDIR/cache
/toolchains || mkdir
-p $BASEDIR/cache
/toolchains
1155 echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for ${BUILD_ARCH}" |
tee -a $LOGFILE
1156 cd $BASEDIR/cache
/toolchains
1157 wget
-U "IPFireSourceGrabber/2.x" $URL_TOOLCHAIN/$PACKAGE.
tar.gz
$URL_TOOLCHAIN/$PACKAGE.md5
>& /dev
/null
1158 if [ $?
-ne 0 ]; then
1159 echo "`date -u '+%b %e %T'`: error downloading $PACKAGE toolchain for ${BUILD_ARCH} machine" |
tee -a $LOGFILE
1161 if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then
1162 echo "`date -u '+%b %e %T'`: toolchain md5 ok" |
tee -a $LOGFILE
1164 exiterror
"$PACKAGE.md5 did not match, check downloaded package"
1168 echo "Toolchain is already downloaded. Exiting..."
1173 if [ -z $IPFIRE_USER ]; then
1174 echo -n "You have to setup IPFIRE_USER first. See .config for details."
1175 beautify message FAIL
1179 URL_SOURCE
=$
(grep URL_SOURCE lfs
/Config |
awk '{ print $3 }')
1180 REMOTE_FILES
=$
(echo "ls -1" | sftp
-C ${IPFIRE_USER}@
${URL_SOURCE})
1182 for file in ${BASEDIR}/cache
/*; do
1183 [ -d "${file}" ] && continue
1184 grep -q "$(basename ${file})" <<<$REMOTE_FILES && continue
1185 NEW_FILES
="$NEW_FILES $file"
1187 [ -n "$NEW_FILES" ] && scp
-2 $NEW_FILES ${IPFIRE_USER}@
${URL_SOURCE}
1196 echo "Usage: $0 {build|changelog|clean|gettoolchain|downloadsrc|shell|sync|toolchain}"
1197 cat doc
/make.sh-usage