summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2009-10-16 18:35:28 +0200
committerDaniel Baumann <daniel@debian.org>2011-03-09 19:09:47 +0100
commitfa9ebfb6d13d8dfed739dc74ad4c28110a4103f1 (patch)
tree0a01e163ae1c8c026afca02c206fa0ca48968e36
parent4d341dfbb242a4d8a0fbb8de6627fc6fcf738944 (diff)
downloadvyos-live-build-fa9ebfb6d13d8dfed739dc74ad4c28110a4103f1.tar.gz
vyos-live-build-fa9ebfb6d13d8dfed739dc74ad4c28110a4103f1.zip
Using pre-cached bootstrap stage, if available, in order to build chroot image which dramatically speads up building of large images.
-rwxr-xr-xhelpers/lh_binary_chroot12
-rwxr-xr-xhelpers/lh_binary_rootfs120
2 files changed, 127 insertions, 5 deletions
diff --git a/helpers/lh_binary_chroot b/helpers/lh_binary_chroot
index 1591c2518..20239419a 100755
--- a/helpers/lh_binary_chroot
+++ b/helpers/lh_binary_chroot
@@ -84,8 +84,16 @@ ${LH_ROOT_COMMAND} rm -rf chroot/chroot
${LH_ROOT_COMMAND} rm -rf chroot.tmp
# Copying new chroot
-${LH_ROOT_COMMAND} cp -a chroot chroot.tmp
-${LH_ROOT_COMMAND} mv chroot.tmp chroot/chroot
+if [ -d cache/stages_bootstrap ]
+then
+ ${LH_ROOT_COMMAND} mv chroot chroot.tmp
+ ${LH_ROOT_COMMAND} cp -a cache/stages_bootstrap chroot
+ ${LH_ROOT_COMMAND} mv chroot.tmp chroot/chroot
+ ${LH_ROOT_COMMAND} touch chroot/chroot.cache
+else
+ ${LH_ROOT_COMMAND} cp -a chroot chroot.tmp
+ ${LH_ROOT_COMMAND} mv chroot.tmp chroot/chroot
+fi
if [ -f config/binary_rootfs/exclude ]
then
diff --git a/helpers/lh_binary_rootfs b/helpers/lh_binary_rootfs
index 1b72e7c52..25fbb15e9 100755
--- a/helpers/lh_binary_rootfs
+++ b/helpers/lh_binary_rootfs
@@ -146,7 +146,45 @@ case "${LH_CHROOT_FILESYSTEM}" in
# Move image
mv chroot/filesystem.${LH_CHROOT_FILESYSTEM} binary/${INITFS}
- rm -rf chroot/chroot
+
+ if [ -e chroot/chroot.cache ]
+ then
+ rm -f .lock
+ mv chroot/chroot chroot.tmp
+
+ lh_chroot_linux-image remove ${*}
+ lh_chroot_sources remove ${*}
+ lh_chroot_apt remove ${*}
+ lh_chroot_hostname remove ${*}
+ lh_chroot_resolv remove ${*}
+ lh_chroot_hosts remove ${*}
+ lh_chroot_sysv-rc remove ${*}
+ lh_chroot_debianchroot remove ${*}
+ lh_chroot_sysfs remove ${*}
+ lh_chroot_selinuxfs remove ${*}
+ lh_chroot_proc remove ${*}
+ lh_chroot_devpts remove ${*}
+
+ rm -rf chroot
+ mv chroot.tmp chroot
+
+ lh_chroot_devpts install ${*}
+ lh_chroot_proc install ${*}
+ lh_chroot_selinuxfs install ${*}
+ lh_chroot_sysfs install ${*}
+ lh_chroot_debianchroot install ${*}
+ lh_chroot_sysv-rc install ${*}
+ lh_chroot_hosts install ${*}
+ lh_chroot_resolv install ${*}
+ lh_chroot_hostname install ${*}
+ lh_chroot_apt install ${*}
+ lh_chroot_sources install ${*}
+ lh_chroot_linux-image install ${*}
+
+ touch .lock
+ else
+ rm -rf chroot/chroot
+ fi
;;
disabled)
@@ -188,7 +226,43 @@ case "${LH_CHROOT_FILESYSTEM}" in
# Move image
mv chroot/filesystem.jffs2 binary/${INITFS}
- rm -rf chroot/chroot
+
+ if [ -e chroot/chroot.cache ]
+ then
+ rm -f .lock
+ mv chroot/chroot chroot.tmp
+
+ lh_chroot_linux-image remove ${*}
+ lh_chroot_sources remove ${*}
+ lh_chroot_apt remove ${*}
+ lh_chroot_hostname remove ${*}
+ lh_chroot_resolv remove ${*}
+ lh_chroot_hosts remove ${*}
+ lh_chroot_sysv-rc remove ${*}
+ lh_chroot_debianchroot remove ${*}
+ lh_chroot_sysfs remove ${*}
+ lh_chroot_selinuxfs remove ${*}
+ lh_chroot_proc remove ${*}
+ lh_chroot_devpts remove ${*}
+
+ rm -rf chroot
+ mv chroot.tmp chroot
+
+ lh_chroot_devpts install ${*}
+ lh_chroot_proc install ${*}
+ lh_chroot_selinuxfs install ${*}
+ lh_chroot_sysfs install ${*}
+ lh_chroot_debianchroot install ${*}
+ lh_chroot_sysv-rc install ${*}
+ lh_chroot_hosts install ${*}
+ lh_chroot_resolv install ${*}
+ lh_chroot_hostname install ${*}
+ lh_chroot_apt install ${*}
+ lh_chroot_sources install ${*}
+ lh_chroot_linux-image install ${*}
+ else
+ rm -rf chroot/chroot
+ fi
;;
disabled)
@@ -262,7 +336,47 @@ case "${LH_CHROOT_FILESYSTEM}" in
# Move image
${LH_ROOT_COMMAND} mv chroot/filesystem.squashfs binary/${INITFS}
- ${LH_ROOT_COMMAND} rm -rf chroot/chroot chroot/squashfs.sort
+ ${LH_ROOT_COMMAND} rm -f chroot/squashfs.sort
+
+ if [ -e chroot/chroot.cache ]
+ then
+ rm -f .lock
+ mv chroot/chroot chroot.tmp
+
+ lh_chroot_linux-image remove ${*}
+ lh_chroot_sources remove ${*}
+ lh_chroot_apt remove ${*}
+ lh_chroot_hostname remove ${*}
+ lh_chroot_resolv remove ${*}
+ lh_chroot_hosts remove ${*}
+ lh_chroot_sysv-rc remove ${*}
+ lh_chroot_debianchroot remove ${*}
+ lh_chroot_sysfs remove ${*}
+ lh_chroot_selinuxfs remove ${*}
+ lh_chroot_proc remove ${*}
+ lh_chroot_devpts remove ${*}
+
+ rm -rf chroot
+ mv chroot.tmp chroot
+
+ lh_chroot_devpts install ${*}
+ lh_chroot_proc install ${*}
+ lh_chroot_selinuxfs install ${*}
+ lh_chroot_sysfs install ${*}
+ lh_chroot_debianchroot install ${*}
+ lh_chroot_sysv-rc install ${*}
+ lh_chroot_hosts install ${*}
+ lh_chroot_resolv install ${*}
+ lh_chroot_hostname install ${*}
+ lh_chroot_apt install ${*}
+ lh_chroot_sources install ${*}
+ lh_chroot_linux-image install ${*}
+
+ touch .lock
+ else
+ rm -rf chroot/chroot
+ fi
+
${LH_ROOT_COMMAND} chmod 0644 binary/${INITFS}/filesystem.squashfs
;;