2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2008 Michael Tremer & Christian Schmidt #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
21 ###############################################################################
25 ###############################################################################
27 CONFIG_ROOT
=/etc
/$SNAME # Configuration rootdir
29 TARGET
=i686
# Default target
30 KVER
=`grep --max-count=1 VER lfs/linux | awk '{ print $3 }' | tr -d '\n'; grep --max-count=1 LOCALVERSION lfs/linux | awk '{ print $3 }' | tail -1`
31 MACHINE_REAL
=`uname -m`
32 GIT_TAG
=$
(git tag |
tail -1)
47 PARALLELISMFLAGS
=-j$
(( $
(grep processor
< /proc
/cpuinfo |
wc -l) * 2 + 1 ))
48 DISTCC_HOSTS
=localhost
51 BASENAME
=`basename $0`
53 # Debian specific settings
54 if [ ! -e /etc
/debian_version
]; then
57 if [ -x /usr
/bin
/realpath
]; then
58 FULLPATH
=`/usr/bin/realpath $0`
60 echo "ERROR: Need to do apt-get install realpath"
65 BASEDIR
=`echo $FULLPATH | sed "s/\/$BASENAME//g"`
68 HOSTNAME
=${HOSTNAME-$(hostname -f || hostname)}
70 .
$BASEDIR/tools
/make-beautify
# Load this very early
72 ###############################################################################
74 # Read the local configuration to override the environment variables
76 ###############################################################################
78 if ! [ -e .config
]; then
79 sed -e "s/@UUID@/$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid)/" \
80 -e "s/^#UUID=/UUID=/" < $BASEDIR/.config-default
> $BASEDIR/.config
85 ###############################################################################
87 # Variables that are not modifyable by .config
89 ###############################################################################
91 if [ 'i686' = $MACHINE_REAL \
92 -o 'i586' = $MACHINE_REAL \
93 -o 'i486' = $MACHINE_REAL \
94 -o 'x86_64' = $MACHINE_REAL ]; then
95 IFS_HOST
="$(echo $MACHTYPE | sed "s
/$
(echo $MACHTYPE | cut
-d- -f2)/cross
/")"
98 echo "Can't determine your architecture - $MACHINE_REAL"
102 if [ 'i686' = $TARGET -o 'i586' = $TARGET \
103 -o 'i486' = $TARGET ]; then
105 MACHINE_REAL
=${MACHINE_REAL}
106 LINKER
=/lib
/ld-linux.so
.2
107 IFS_TARGET
="${MACHINE}-pc-linux-gnu"
108 CFLAGS
="-march=${MACHINE} -O2 -pipe -fomit-frame-pointer"
110 elif [ 'via-c7' = $TARGET ]; then
112 MACHINE_REAL
=${MACHINE_REAL}
113 LINKER
=/lib
/ld-linux.so
.2
114 IFS_TARGET
="${MACHINE}-pc-linux-gnu"
115 CFLAGS
="-march=${MACHINE} -mmmx -msse -msse2 -msse3 -O2 -pipe"
117 elif [ 'via-c3' = $TARGET ]; then
119 MACHINE_REAL
=${MACHINE_REAL}
120 LINKER
=/lib
/ld-linux.so
.2
121 IFS_TARGET
="${MACHINE}-pc-linux-gnu"
122 CFLAGS
="-march=c3 -m3dnow -O2 -pipe -fomit-frame-pointer"
124 elif [ 'geodelx' = $TARGET ]; then
126 MACHINE_REAL
=${MACHINE_REAL}
127 LINKER
=/lib
/ld-linux.so
.2
128 IFS_TARGET
="${MACHINE}-pc-linux-gnu"
129 CFLAGS
="-march=geode -Os -pipe -fomit-frame-pointer"
132 beautify message FAIL
133 echo "Not a valid target arch (i686|i586|i486|via-c7|via-c3|geodelx) - $TARGET"
137 mkdir
$BASEDIR/log_
${MACHINE}/ 2>/dev
/null
139 # Set up what used to be /tools
140 TOOLS_DIR
=/tools_
${MACHINE}
143 INSTALLER_DIR
=/pomona
145 # A place to build the iso
148 # A place to keep the images
151 # include machine in TOOLCHAINNAME
152 TOOLCHAINNAME
=$SNAME-$TOOLCHAINVERSION-toolchain-t${TARGET}-m${MACHINE}
154 # Files that indicates that we are running or failed
155 RUNNING
=$BASEDIR/.running
156 FAILED
=$BASEDIR/.failed
158 ################################################################################
160 # Necessary shell functions #
162 ################################################################################
164 .
$BASEDIR/tools
/make-buildspy
165 .
$BASEDIR/tools
/make-check
166 .
$BASEDIR/tools
/make-batch
167 .
$BASEDIR/tools
/make-compilers
168 .
$BASEDIR/tools
/make-git
172 if [ "$RETVAL" -eq "0" ]; then
173 beautify message DONE
175 beautify message FAIL
181 sleep 0.3 # Wait one second for finish of processes
182 for fs
in `mount | grep $BASEDIR/build_${MACHINE} | awk '{print $3}'`; do
183 umount
$fs #2>/dev/null;
185 } # End of stdumount()
190 build_spy state error
192 rm -f $RUNNING 2>/dev
/null
194 } # End of exiterror()
196 ################################################################################
197 # This is the function that sets the environment of a chroot and enters it #
198 ################################################################################
200 PATH
=${TOOLS_DIR}/usr/bin:/bin:/usr/bin:/sbin:/usr/sbin:${TOOLS_DIR}/bin:/usr/${MACHINE_REAL}-linux/bin
202 if [ ! -e $LFS/usr
/src
/lfs
/ ]; then
203 exiterror
"No such file or directory: $LFS/usr/src/lfs/"
206 echo -ne "Entering ${BOLD}$MACHINE${NORMAL} LFS chroot, type exit to return to host environment\n"
208 chroot
$LFS $TOOLS_DIR/bin
/env
-i \
211 PS1
="${BOLD}[chroot-${TARGET}(${MACHINE})]${NORMAL} \u:\w\$ " \
213 CONFIG_ROOT
=${CONFIG_ROOT} \
218 CCACHE_DIR
=/usr
/src
/ccache \
219 CCACHE_PREFIX
=${CCACHE_PREFIX} \
220 CCACHE_HASHDIR
=${CCACHE_HASHDIR} \
221 DISTCC_DIR
=/usr
/src
/distcc \
222 PARALLELISMFLAGS
=$PARALLELISMFLAGS \
224 TOOLS_DIR
=$TOOLS_DIR \
225 INSTALLER_DIR
=$INSTALLER_DIR \
227 MACHINE_REAL
="$MACHINE_REAL" \
229 CXXFLAGS
="$CXXFLAGS" \
230 IFS_HOST
="$IFS_HOST" \
231 IFS_TARGET
="$IFS_TARGET" \
234 STAGE_ORDER
=$STAGE_ORDER \
235 LOGFILE
=`echo $LOGFILE | sed "s,$BASEDIR,/usr/src,g"` \
238 if [ $?
-ne 0 ]; then
239 exiterror
"chroot error"
243 } # End of entershell()
247 ################################################################################
248 # Common checking before entering the chroot and compilling #
249 # Return:0 caller can continue #
250 # :1 skip (nothing to do) #
251 # or fail if no script file found #
252 ################################################################################
256 if [ ! -f $BASEDIR/lfs
/$1 ]; then
257 exiterror
"No such file or directory: $BASEDIR/lfs/$1"
260 local PKG_VER
=`get_pkg_ver $BASEDIR/lfs/$1`
261 beautify make_pkg
"$PKG_VER $*"
265 for i
in $SKIP_PACKAGE_LIST
267 if [ "$i" == "$1" ]; then
273 # Don't create addons?
274 local EXTRA
=`grep ^EXTRA $BASEDIR/lfs/$1 | awk '{print $3}'`
275 if [ "$EXTRA" == "yes" -a "$BUILD_EXTRAS" == "0" ]; then
280 # Don't create debugging tools?
281 local DEBUG
=`grep ^DEBUG $BASEDIR/lfs/$1 | awk '{print $3}'`
282 if [ "$DEBUG" == "yes" -a "$BUILD_DEBUG" == "1" ]; then
287 echo -e "`date -u '+%b %e %T'`: Building $* " >> $LOGFILE
289 cd $BASEDIR/lfs
&& make -s -f $
* MACHINE
=$MACHINE LFS_BASEDIR
=$BASEDIR MESSAGE
="$1\t " download
>> $LOGFILE 2>&1
290 if [ $?
-ne 0 ]; then
291 exiterror
"Download error in $1"
297 } # End of lfsmakecommoncheck()
299 ################################################################################
300 # This is the function that builds every package in stage "toolchain" #
301 ################################################################################
303 lfsmakecommoncheck $
*
304 [ $?
== 1 ] && return 0
306 local PKG_VER
=`get_pkg_ver $BASEDIR/lfs/$1`
308 local EXTRA_MAKE
=$EXTRA_MAKE
310 local PKG_TIME_START
=`date +%s`
311 cd $BASEDIR/lfs
&& $EXTRA_MAKE make -f $
* \
312 CONFIG_ROOT
=$CONFIG_ROOT \
314 TOOLS_DIR
=$TOOLS_DIR \
316 MACHINE_REAL
="$MACHINE_REAL" \
317 IFS_HOST
="$IFS_HOST" \
318 IFS_TARGET
="$IFS_TARGET" \
319 LFS_BASEDIR
=$BASEDIR \
321 INSTALLER_DIR
=$INSTALLER_DIR \
322 PARALLELISMFLAGS
=$PARALLELISMFLAGS \
325 STAGE_ORDER
=$STAGE_ORDER \
329 install >> $LOGFILE 2>&1
331 local COMPILE_SUCCESS
=$?
332 local PKG_TIME_END
=`date +%s`
334 if [ $COMPILE_SUCCESS -ne 0 ]; then
335 beautify result FAIL $
[ $PKG_TIME_END - $PKG_TIME_START ] $1 $PKG_VER $STAGE_ORDER $STAGE
336 exiterror
"Building $*";
338 beautify result DONE $
[ $PKG_TIME_END - $PKG_TIME_START ] $1 $PKG_VER $STAGE_ORDER $STAGE
342 } # End of toolchain_make()
344 ################################################################################
345 # This is the function that builds every package in stage "base" and "ipfire" #
346 ################################################################################
348 lfsmakecommoncheck $
*
349 [ $?
== 1 ] && return 0
351 local PKG_VER
=`get_pkg_ver $BASEDIR/lfs/$1`
353 local EXTRA_MAKE
=$EXTRA_MAKE
354 # When cross-compiling, make sure the kernel is compiled for the target
355 [ "$MACHINE" != "$MACHINE_REAL" -a "$1" == "linux" ] && unset EXTRA_MAKE
357 # Also, make sure external kernel modules are compiled 64bit
358 if grep -qEi 'KERNEL_MOD = yes' $1 ; then
362 local PKG_TIME_START
=`date +%s`
363 chroot
$LFS $TOOLS_DIR/bin
/env
-i \
368 CONFIG_ROOT
=${CONFIG_ROOT} \
373 CCACHE_DIR
=/usr
/src
/ccache \
374 CCACHE_PREFIX
=${CCACHE_PREFIX} \
375 CCACHE_HASHDIR
=${CCACHE_HASHDIR} \
376 DISTCC_DIR
=/usr
/src
/distcc \
377 PARALLELISMFLAGS
=$PARALLELISMFLAGS \
379 TOOLS_DIR
=$TOOLS_DIR \
380 INSTALLER_DIR
=$INSTALLER_DIR \
381 CDROM_DIR
=$CDROM_DIR \
382 IMAGES_DIR
=$IMAGES_DIR \
384 MACHINE_REAL
="$MACHINE_REAL" \
386 CXXFLAGS
="$CXXFLAGS" \
387 IFS_HOST
="$IFS_HOST" \
388 IFS_TARGET
="$IFS_TARGET" \
390 BUILD_DEBUG
=$BUILD_DEBUG \
391 BUILD_EXTRAS
=$BUILD_EXTRAS \
394 STAGE_ORDER
=$STAGE_ORDER \
399 LOGFILE
=`echo $LOGFILE | sed "s,$BASEDIR,/usr/src,g"` \
400 bash
-x -c "cd /usr/src/lfs && \
401 $EXTRA_MAKE make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
403 local COMPILE_SUCCESS
=$?
404 local PKG_TIME_END
=`date +%s`
406 if [ $COMPILE_SUCCESS -ne 0 ]; then
407 beautify result FAIL $
[ $PKG_TIME_END - $PKG_TIME_START ] $1 $PKG_VER $STAGE_ORDER $STAGE
408 exiterror
"Building $*";
410 beautify result DONE $
[ $PKG_TIME_END - $PKG_TIME_START ] $1 $PKG_VER $STAGE_ORDER $STAGE
414 } # End of ipfire_make()
416 ################################################################################
417 # This prepares the build environment #
418 ################################################################################
420 LOGFILE
=$BASEDIR/log_
${MACHINE}/_build
.00-preparation.log
422 mkdir
-p $BASEDIR/log_
${MACHINE}/01_toolchain
2>/dev
/null
423 mkdir
-p $BASEDIR/log_
${MACHINE}/02_base
2>/dev
/null
424 mkdir
-p $BASEDIR/log_
${MACHINE}/03_
${SNAME} 2>/dev
/null
425 mkdir
-p $BASEDIR/log_
${MACHINE}/04_misc
2>/dev
/null
426 mkdir
-p $BASEDIR/log_
${MACHINE}/05_installer
2>/dev
/null
427 mkdir
-p $BASEDIR/log_
${MACHINE}/06_packages
2>/dev
/null
429 #############################################################################
430 # Are we running the right shell? #
431 #############################################################################
433 if [ ! "$BASH" ]; then
434 exiterror
"BASH environment variable is not set. You're probably running the wrong shell."
437 if [ -z "${BASH_VERSION}" ]; then
438 exiterror
"Not running BASH shell."
441 #############################################################################
442 # Trap on emergency exit #
443 #############################################################################
444 trap "exiterror 'Build process interrupted'" SIGINT SIGTERM SIGKILL SIGSTOP SIGQUIT
447 #############################################################################
448 # Resetting our nice level #
449 #############################################################################
450 echo -ne "Resetting our nice level to $NICE"
451 renice
$NICE $$
> /dev
/null
452 if [ `nice` != "$NICE" ]; then
453 beautify message FAIL
454 exiterror
"Failed to set correct nice level"
456 beautify message DONE
460 if [ -x /usr
/bin
/schedtool
]; then
461 /usr
/bin
/schedtool
-B $$
462 if [ $?
-ne 0 ]; then
463 echo -ne "Setting kernel schedular to SCHED_BATCH"
464 beautify message FAIL
468 ##############################################################################
469 # Checking if running as root user #
470 ##############################################################################
471 if [ `id -u` != 0 ]; then
472 echo -ne "Checking if we're running as root user"
473 beautify message FAIL
474 exiterror
"Not building as root"
478 ##############################################################################
479 # Checking for necessary temporary space #
480 ##############################################################################
481 BASE_DEV
=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $1 }'`
482 BASE_ASPACE
=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $4 }'`
483 if (( 2048000 > $BASE_ASPACE )); then
484 BASE_USPACE
=`du -skx $BASEDIR | awk '{print $1}'`
485 if (( 2048000 - $BASE_USPACE > $BASE_ASPACE )); then
486 echo -ne "Checking for necessary space on disk $BASE_DEV"
487 beautify message FAIL
488 exiterror
"Not enough temporary space available, need at least 2GB on $BASE_DEV"
492 ##############################################################################
493 # Setting security features #
494 ##############################################################################
496 echo -ne "Stack smashing protector (SSP)"
497 if [ $SSP -eq 1 ]; then
503 echo -ne "Position independent executeables (PIE)"
504 if [ $PIE -eq 1 ]; then
510 echo -ne "GRSecurity (PAX)"
511 if [ $PAX -eq 1 ]; then
519 ##############################################################################
521 ##############################################################################
523 echo -ne "Embedded build"
524 if [ $EMB -eq 1 ]; then
526 check_loop || exiterror
"Can't build flash images on this machine."
533 ##############################################################################
534 # Checking CPU features #
535 ##############################################################################
538 if [ 'via-c7' = $TARGET ]; then
539 CHECK_CPU
="sse sse2 pni"
540 elif [ 'via-c3' = $TARGET ]; then
544 for flag
in $CHECK_CPU; do
546 exiterror
"Your system doesn't support needed cpu feature \"$flag\" to build target $TARGET."
549 ##############################################################################
550 # Building Linux From Scratch system configuration #
551 ##############################################################################
557 LFS
=$BASEDIR/build_
${MACHINE}/${SNAME}
559 # Check /tools symlink
560 if [ -h $TOOLS_DIR ]; then
563 if [ ! -a $TOOLS_DIR ]; then
564 ln -s $BASEDIR/build_
${MACHINE}/$TOOLS_DIR /
566 if [ ! -h $TOOLS_DIR ]; then
567 exiterror
"Could not create $TOOLS_DIR symbolic link."
574 unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
576 # Make some extra directories
577 mkdir
-p $BASEDIR/build_
${MACHINE}/{$TOOLS_DIR,cdrom
,$INSTALLER_DIR,$IMAGES_DIR} 2>/dev
/null
578 mkdir
-p $BASEDIR/{cache
,ccache
,distcc
} 2>/dev
/null
579 mkdir
-p $BASEDIR/cache
/{toolchains
,patches
,tarballs
} 2>/dev
/null
580 mkdir
-p $LFS/{$TOOLS_DIR,usr
/src
} 2>/dev
/null
581 mkdir
-p $LFS/{dev
,etc
,proc
,sys
} 2>/dev
/null
582 mkdir
-p $LFS/dev
/pts
2>/dev
/null
583 mkdir
-p $LFS/usr
/src
/{cache
,config
,doc
,lfs
,log_
${MACHINE},src
,ccache
,distcc
} 2>/dev
/null
584 mkdir
-p $LFS/{$INSTALLER_DIR,cdrom
,images
} 2>/dev
/null
586 mknod
-m 600 $BASEDIR/build
/dev
/console c
5 1 2>/dev
/null
587 mknod
-m 666 $BASEDIR/build
/dev
/null c
1 3 2>/dev
/null
589 # Make all sources and proc available under lfs build
590 mount
--bind /dev
$LFS/dev
591 mount
--bind /proc
$LFS/proc
592 mount
--bind /sys
$LFS/sys
593 mount
--bind $BASEDIR/cache
$LFS/usr
/src
/cache
594 mount
--bind $BASEDIR/ccache
$LFS/usr
/src
/ccache
595 mount
--bind $BASEDIR/distcc
$LFS/usr
/src
/distcc
596 mount
--bind $BASEDIR/config
$LFS/usr
/src
/config
597 mount
--bind $BASEDIR/doc
$LFS/usr
/src
/doc
598 mount
--bind $BASEDIR/lfs
$LFS/usr
/src
/lfs
599 mount
--bind $BASEDIR/log_
${MACHINE} $LFS/usr
/src
/log_
${MACHINE}
600 mount
--bind $BASEDIR/src
$LFS/usr
/src
/src
601 mount
--bind $BASEDIR/build_
${MACHINE}/$TOOLS_DIR $LFS/$TOOLS_DIR
602 mount
--bind $BASEDIR/build_
${MACHINE}/$CDROM_DIR $LFS/$CDROM_DIR
603 mount
--bind $BASEDIR/build_
${MACHINE}/$INSTALLER_DIR $LFS/$INSTALLER_DIR
604 mount
--bind $BASEDIR/build_
${MACHINE}/$IMAGES_DIR $LFS/$IMAGES_DIR
606 # Run LFS static binary creation scripts one by one
607 export CCACHE_DIR
=$BASEDIR/ccache
608 export CCACHE_HASHDIR
=1
609 if [ ! -z "$DISTCC_HOSTS" ]; then
610 export CCACHE_PREFIX
="distcc"
611 export DISTCC_DIR
=$BASEDIR/distcc
614 [ -z "$DISTCC_HOSTS" ] ||
echo "$DISTCC_HOSTS" > $DISTCC_DIR/hosts
616 # Remove pre-install list of installed files in case user erase some files before rebuild
617 rm -f $LFS/usr
/src
/lsalr
2>/dev
/null
622 #a prebuilt toolchain package is only used if found in cache
623 if [ ! -d $BASEDIR/cache
]; then
624 exiterror
"Use make.sh source get first!"
626 cd $BASEDIR/cache
/toolchains
627 PACKAGE
=`ls -v -r $TOOLCHAINNAME.tar.bz2 2>/dev/null | head -n 1`
628 #only restore on a clean disk
630 local BLD_TIME_START
=`date +%s`
631 touch $RUNNING; rm -f $FAILED $BUILD_SPY_FILENAME 2>/dev
/null
633 echo -ne "Building for ${BOLD}${TARGET} (${MACHINE}) on ${MACHINE_REAL}${NORMAL}\n"
635 build_spy_send_profile
636 build_spy state compiling
637 BASEDIR
=$BASEDIR UUID
=$UUID NAME
=$NAME VERSION
=$VERSION $BASEDIR/tools
/make-buildspy
&
639 if [ -f $BASEDIR/log_
${MACHINE}/02_base
/stage2-LFS
]; then
641 echo "Using installed toolchain" >> $LOGFILE
642 beautify message DONE
"Stage toolchain already built or extracted"
644 if [ -z "$PACKAGE" ]; then
645 echo "Full toolchain compilation"
650 beautify build_stage
"Building toolchain"
653 echo "Restore from $PACKAGE"
654 cd $BASEDIR && tar jxf
$BASEDIR/cache
/toolchains
/$PACKAGE
662 beautify build_stage
"Building base"
665 beautify build_stage
"Building $SNAME"
668 beautify build_stage
"Building miscellaneous"
671 if [ "${EMB}" -eq "0" ]; then
672 beautify build_stage
"Building installer"
676 beautify build_stage
"Building packages"
680 echo "... and all this hard work for this:"
681 ls -sh $BASEDIR/${SNAME}-${VERSION}.${MACHINE}.iso
683 local BLD_TIME_END
=`date +%s`
684 build_spy duration $
[ $BLD_TIME_END - $BLD_TIME_START ]
691 if [ ! -f $BASEDIR/cache
/toolchains
/$TOOLCHAINNAME.
tar.bz2
]; then
692 URL_TOOLCHAIN
=$
(grep URL_TOOLCHAIN lfs
/Config |
awk '{ print $3 }')
693 DIR_TOOLCHAIN
="$BASEDIR/cache/toolchains"
695 echo "Loading toolchain for $MACHINE"
696 scp
-2C ${IPFIRE_USER}@
${URL_TOOLCHAIN}/$TOOLCHAINNAME.
tar.bz2 \
699 echo -n "Toolchain \"$TOOLCHAINNAME\" is already existing"
700 beautify message SKIP
706 if [ -f $BASEDIR/cache
/toolchains
/$TOOLCHAINNAME.
tar.bz2
]; then
707 URL_TOOLCHAIN
=$
(grep URL_TOOLCHAIN lfs
/Config |
awk '{ print $3 }')
708 DIR_TOOLCHAIN
="$BASEDIR/cache/toolchains"
710 echo "Pushing toolchain for $MACHINE"
711 scp
-2C ${DIR_TOOLCHAIN}/$TOOLCHAINNAME.
tar.bz2 \
712 ${IPFIRE_USER}@
${URL_TOOLCHAIN}
714 echo -n "Toolchain \"$TOOLCHAINNAME\" is not existing. "
715 echo -n "Run \"./make.sh build\", first"
716 beautify message SKIP
721 if [ ! -d $BASEDIR/cache
]; then
722 mkdir
-p $BASEDIR/cache
/{tarballs
,patches
}
724 mkdir
-p $BASEDIR/log_
${MACHINE}
725 echo -e "${BOLD}Preload all source files${NORMAL}"
728 if [ -f "$i" -a "$i" != "Config" ]; then
730 LFS_BASEDIR
=$BASEDIR \
734 PAX
=$PAX download
2>> $LOGFILE
735 [ $?
-ne 0 ] && beautify message FAIL
743 URL_SOURCE
=$
(grep URL_SOURCE lfs
/Config |
awk '{ print $3 }')
744 REMOTE_FILES
=$
(echo "ls -1" | sftp
-C ${IPFIRE_USER}@
${URL_SOURCE})
746 cd $BASEDIR/cache
/tarballs
/
747 for file in $
(ls -1); do
748 grep -q "$file" <<<$REMOTE_FILES && continue
749 NEW_FILES
="$NEW_FILES $file"
751 [ -n "$NEW_FILES" ] && scp
-2C $NEW_FILES ${IPFIRE_USER}@
${URL_SOURCE}
757 URL_TARGET
=$
(grep URL_TARGET lfs
/Config |
awk '{ print $3 }')
758 DIR
="${BASEDIR}/${HOSTNAME}/$(date '+%Y%m%d-%0k')/"
760 # If there is no iso, we do nothing.
761 [ -e "${BASEDIR}/${SNAME}-${VERSION}.${MACHINE}.iso" ] ||
return 0
763 rm -rf ${BASEDIR}/${HOSTNAME} 2>/dev
/null
766 [ -e "${BASEDIR}/packages" ] && cp -al ${BASEDIR}/packages ${DIR}
767 [ -e "${BATCHLOG}" ] && \
768 python ${BASEDIR}/tools/alog2html < ${BATCHLOG} > ${DIR}/build_log.html
769 git_export; cp -l ${BASEDIR}/${SNAME}-${VERSION}.source.tar.gz ${DIR}
770 git_diff >/dev/null && cp -l ${DIFF_NAME} ${DIR}
771 cp -l ${BASEDIR}/${SNAME}-${VERSION}.${MACHINE}.iso ${DIR}
774 scp -2C -r ${HOSTNAME} ${IPFIRE_USER}@${URL_TARGET} || :
776 rm -rf ${BASEDIR}/${HOSTNAME} 2>/dev/null