summaryrefslogtreecommitdiff
path: root/run-bootstrap-in-chroot
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-03-09 13:24:46 +0000
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-03-09 13:24:46 +0000
commitb2596ff6b7fe7c6ac250b5b16162cb8fb1849fa3 (patch)
tree797dc7040a2f2ce60f609445a1f2c433810f9e8a /run-bootstrap-in-chroot
parentf07cb579b63a64dde7c42260005b098fb7e23364 (diff)
downloadmorph-b2596ff6b7fe7c6ac250b5b16162cb8fb1849fa3.tar.gz
Add untested support for ccache through the CCACHE_HOST_DIR variable.
This variable can optionally be set outside the squeeze chroot (that is, outside the run-bootstrap-in-chroot script. The directory is then bind mounted into the chroot and baserock-bootstrap will set its CCACHE_DIR to the location inside the chroot.
Diffstat (limited to 'run-bootstrap-in-chroot')
-rwxr-xr-xrun-bootstrap-in-chroot25
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