49 lines
926 B
Text
Executable file
49 lines
926 B
Text
Executable file
# functions and variable loaded by scripts
|
|
|
|
JOBS=$(nproc)
|
|
export MAKEFLAGS="-j${JOBS}"
|
|
export LFS="/mnt/lfs"
|
|
export LFS_TGT=$(uname -m)-lfs-linux-gnu
|
|
|
|
PATH=/tools/bin:/bin:/usr/bin
|
|
|
|
export LC_ALL=C
|
|
|
|
fetch() {
|
|
|
|
tarballname=$(echo $1 | rev | cut -d / -f 1 | rev)
|
|
WGETCMD="wget --passive-ftp --tries=3 --waitretry=3 --output-document=$2/$tarballname.partial"
|
|
WGETRESUME="-c"
|
|
|
|
if [ -f $2/$tarballname ]; then
|
|
echo "Source file $tarballname found."
|
|
return 0
|
|
else
|
|
if [ -f $2/$tarballname.partial ]; then
|
|
echo "Resuming $1"
|
|
$WGETCMD $WGETRESUME $1
|
|
else
|
|
mkdir -p "$2"
|
|
echo "Downloading $1"
|
|
$WGETCMD $1
|
|
fi
|
|
fi
|
|
|
|
if [ $? = 0 ]; then
|
|
mv $2/$tarballname.partial $2/$tarballname
|
|
fi
|
|
|
|
}
|
|
|
|
if [ ! -d $LFS/tools ]; then
|
|
sudo mkdir -pv $LFS/tools
|
|
fi
|
|
|
|
if [ ! -w $LFS ]; then
|
|
sudo chown -Rv $USER:$USER $LFS
|
|
fi
|
|
|
|
if [ ! -L /tools ] || [ $(realpath /tools) != $LFS/tools ]; then
|
|
sudo ln -svf $LFS/tools /
|
|
fi
|
|
|