diff options
Diffstat (limited to 'run-bootstrap-in-chroot')
-rwxr-xr-x | run-bootstrap-in-chroot | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/run-bootstrap-in-chroot b/run-bootstrap-in-chroot index 7293e26d..8bc221a9 100755 --- a/run-bootstrap-in-chroot +++ b/run-bootstrap-in-chroot @@ -70,14 +70,22 @@ snapshotdir="$1" cat >"./do-squeeze-chroot" <<EOF #!/bin/sh -# clear the temporary directory used outisde the chroot +# clear the temporary directory used outside the chroot export TMPDIR= if mount -t proc proc "$dir/proc"; then trap "umount \"$dir/proc\"" INT TERM EXIT if mount -t sysfs sysfs "$dir/sys"; then trap "umount \"$dir/proc\" \"$dir/sys\"" INT TERM EXIT - chroot "$dir" "\$@" + if [ "x$CCACHE_HOST_DIR" != "x" ]; then + if mount --bind \"$CCACHE_HOST_DIR\" \"$dir/var/tmp/ccache\"; then + trap "umount \"$dir/proc\" \"$dir/sys\"" \"$dir/var/tmp/ccache\" \ + INT TERM EXIT + chroot "$dir" "\$@" + fi + else + chroot "$dir" "\$@" + fi fi fi EOF @@ -85,7 +93,7 @@ chmod +x "./do-squeeze-chroot" if ([ "x$DEBIAN_MIRROR" = x ] && echo DEBIAN_MIRROR is unspecified >&2) || ([ "x$GIT_BUNDLES" = x ] && echo GIT_BUNDLES is unspecified >&2) || - ([ "x$LFS_MIRROR" = x ] && echo LFS_MIRROR is unspecified >&2) + ([ "x$LFS_MIRROR" = x ] && echo LFS_MIRROR is unspecified >&2) || then echo You have to set DEBIAN_MIRROR and other environment variables 1>&2 exit 1 @@ -105,7 +113,7 @@ else debootstrap \ --include=build-essential,\ gawk,bison,python,autoconf,autopoint,automake,gettext,libtool,\ -help2man,texinfo,sudo,qemu-utils,parted,kpartx,mbr,extlinux \ +help2man,texinfo,sudo,ccache \ squeeze "$dir" "$DEBIAN_MIRROR" # We need a backport of tar 1.26. On ARM, older versions (possibly @@ -130,6 +138,15 @@ cat <<EOF > "$dir/etc/hosts" 127.0.1.1 `hostname` EOF +# prepare the ccache directory in the chroot, if necessary +if [ "x$CCACHE_HOST_DIR" = "x" ]; then + # print a warning if the CCACHE_HOST_DIR is not set + echo "CCACHE_HOST_DIR is unspecified, but that's ok" >&2 +else + # create the directory for cached ccache object files + mkdir "$1/var/tmp/ccache" +fi + if [ "x$LFS_MIRROR" = x ]; then cp wget-list "$dir/wget-list" else |