#!/bin/bash -e #©keithhedger Wed 14 Jun 19:51:12 BST 2017 kdhedger68713@gmail.com RED='\e[1;31m' GREEN='\e[1;32m' NORMAL='\e[0;0m' trap 'echo -e "$0 ${RED}FAILED${NORMAL} at line ${GREEN}${LINENO}${NORMAL}"' ERR LFSVERSION="10.1" LFSGITVERSION="$LFSVERSION" SYSTEMSOURCE=cdtree/LFS/LFSSourceArchives/$LFSVERSION/SYSTEM NETSOURCE=cdtree/LFS/LFSSourceArchives/$LFSVERSION/NET SYSSOURCE=cdtree/LFS/LFSSourceArchives/$LFSVERSION/SYS WGET_VERS=1.21.1 #other mirrors are available here: #https://www.linuxfromscratch.org/mirrors.html#files LFSSOURCES="https://lfs.gnlug.org/pub/lfs/lfs-packages/10.1/" WGETTAR="https://ftp.gnu.org/gnu/wget/wget-$WGET_VERS.tar.gz" UNZIPTAR="http://downloads.sourceforge.net/infozip/unzip60.tar.gz" TOOLS32TAR="https://github.com/KeithDHedger/LFSBootCD/releases/download/${LFSGITVERSION}/tools-${LFSGITVERSION}_32.tar.bz2" TOOLS64TAR="https://github.com/KeithDHedger/LFSBootCD/releases/download/${LFSGITVERSION}/tools-${LFSGITVERSION}_64.tar.bz2" LFSPKGBUILDS="https://github.com/KeithDHedger/LFSPkgBuilds/archive/${LFSGITVERSION}.zip" #Or: #git clone --single-branch --branch ${LFSGITVERSION} https://github.com/KeithDHedger/LFSPkgBuilds LFSPKG="https://github.com/KeithDHedger/LFSPkg/archive/master.zip" mkdir -vp cdtree/LFS $NETSOURCE $SYSSOURCE ${SYSTEMSOURCE}||true if [ ! -e $SYSTEMSOURCE/gotsystemsources ];then pushd ${SYSTEMSOURCE} wget -c -r -l1 -nH --reject="index.html*" --cut-dirs=4 "$LFSSOURCES" popd #wget/unzip from the blfs book I prefer to make this as part of the main system wget -c "$WGETTAR" -P $NETSOURCE||true wget -c "$UNZIPTAR" -P $SYSSOURCE||true touch $SYSTEMSOURCE/gotsystemsources pushd $SYSTEMSOURCE if ! md5sum -c md5sums;then echo "WARNING ... md5 hashes did NOT match, Exiting ..." exit 1 fi rm md5sums popd fi if [ ! -e cdtree/LFS/gottools ];then wget -c "$TOOLS32TAR" -P cdtree/LFS wget -c "$TOOLS64TAR" -P cdtree/LFS touch cdtree/LFS/gottools fi if [ ! -e cdtree/LFS/gotpkgbuilds ];then pushd cdtree/LFS git clone https://github.com/KeithDHedger/LFSPkgBuilds.git --branch 10.1 --single-branch pushd LFSPkgBuilds/LFSPkgBuildScripts/admin/LFSPkg wget -c $LFSPKG unzip master.zip rm master.zip popd touch gotpkgbuilds popd fi ( LFSVERSION=$LFSVERSION xtrasanyarch/usr/bin/getversions cp ./PkgVersions cdtree/LFS/LFSPkgBuilds/LFSScripts/LFSInitBuild mv ./PkgVersions cdtree/LFS/LFSPkgBuilds/LFSScripts/SysVBuild LFSVERSION="systemd" xtrasanyarch/usr/bin/getversions mv ./PkgVersions cdtree/LFS/LFSPkgBuilds/LFSScripts/SystemDBuild rm cdtree/LFS/LFSPkgBuilds/LFSPkgBuildScripts/kernel/PkgVersions||true rm cdtree/LFS/LFSPkgBuilds/LFSPkgBuildScripts/system/PkgVersions||true )||true exit 0