diff --git a/.gitignore b/.gitignore index 7779d57..0221127 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.iso sources +packages diff --git a/01-toolchain b/01-toolchain index b9ab6ef..810b33f 100755 --- a/01-toolchain +++ b/01-toolchain @@ -1,7 +1,6 @@ #!/bin/bash -fetch() { - +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" @@ -22,8 +21,10 @@ fetch() { if [ $? = 0 ]; then mv $2/$tarballname.partial $2/$tarballname - fi - + else + echo "Failed fetching source: $tarballname" + exit 1 + fi } fetch_src() { @@ -73,8 +74,10 @@ checkdone() { if [ -e $LFS/tools/$(basename $script) ]; then echo "*** skip $(basename $script) ***" return 1 + else + echo ">>> building $(basename $script) <<<" + return 0 fi - return 0 } build_stage1() { diff --git a/02-base b/02-base index 5cf3b39..7e71d2a 100755 --- a/02-base +++ b/02-base @@ -75,6 +75,20 @@ umount_pseudo() { mountpoint -q $LFS/sys && umount $LFS/sys } +mountbind_cache() { + # mount bind cachedir + mkdir -p $LFS/var/lib/pkg/{pkg,src} $CWD/{sources,packages} + mount --bind $CWD/sources $LFS/var/lib/pkg/src + mount --bind $CWD/packages $LFS/var/lib/pkg/pkg +} + +umountbind_cache() { + # umount binded cachedir + umount $LFS/var/lib/pkg/src &>/dev/null + umount $LFS/var/lib/pkg/pkg &>/dev/null +} + + runinchroot() { pushd $LFS &>/dev/null mount_pseudo @@ -96,6 +110,7 @@ interrupted() { die() { [ "$@" ] && printerror $@ + umountbind_cache umount_pseudo exit 1 } @@ -136,15 +151,7 @@ mkdir -p $LFS/usr/ports/ echo "==> Copying ports" cp -Ra ports/* $LFS/usr/ports/ -if [ -d sources/ ]; then - echo "==> Copying sources" - cp -Ra sources/* $LFS/var/lib/pkg/src/ -fi - -if [ -d packages/ ]; then - echo "==> Copying packages" - cp -Ra packages/* $LFS/var/lib/pkg/pkg/ -fi +mountbind_cache for pkg in $PKGS; do case $pkg in @@ -153,4 +160,6 @@ for pkg in $PKGS; do esac done +umountbind_cache + exit 0 diff --git a/ports/sysvinit/Pkgfile b/ports/sysvinit/Pkgfile index af3c40b..d6f13e5 100755 --- a/ports/sysvinit/Pkgfile +++ b/ports/sysvinit/Pkgfile @@ -6,7 +6,7 @@ name=sysvinit version=2.96 release=1 -source=(https://download.savannah.gnu.org/releases/$name/$name-$version.tar.xz) +source=(http://download.savannah.gnu.org/releases/sysvinit/sysvinit-$version.tar.xz) build() { cd $name-$version diff --git a/toolchain/19-findutils b/toolchain/19-findutils index 2c0f1c9..82f701e 100755 --- a/toolchain/19-findutils +++ b/toolchain/19-findutils @@ -1,6 +1,6 @@ name=findutils version=4.7.0 -source=(http://ftp.gnu.org/gnu/findutils/findutils-$version.tar.gz) +source=(http://ftp.gnu.org/gnu/findutils/findutils-$version.tar.xz) build() { cd $name-$version