diff --git a/elements/debootstrap/README.rst b/elements/debootstrap/README.rst index cc584e8fc..da244dda2 100644 --- a/elements/debootstrap/README.rst +++ b/elements/debootstrap/README.rst @@ -25,6 +25,11 @@ pass extra arguments to the debootstrap command used to create the base filesystem image. If --keyring is is used in `DIB_DEBOOTSTRAP_EXTRA_ARGS`, it will override `DIB_APT_KEYRING` if that is used as well. +The `DIB_DEBOOTSTRAP_CACHE` variable can be used to cache the created root +filesystem. By default this is 0 (disabled) and any other value enables this. +If run in offline mode then the most recently cached rootfs is used instead of +being built. + ------------------- Note on ARM systems ------------------- diff --git a/elements/debootstrap/root.d/08-debootstrap b/elements/debootstrap/root.d/08-debootstrap index bf8e69bdb..3ccaa7e78 100755 --- a/elements/debootstrap/root.d/08-debootstrap +++ b/elements/debootstrap/root.d/08-debootstrap @@ -72,7 +72,9 @@ else ${DIB_DEBIAN_DEBOOTSTRAP_SCRIPT:-}" echo Caching debootstrap result in $DEBOOTSTRAP_TARBALL - sudo tar --numeric-owner -C $TARGET_ROOT -zcf $DEBOOTSTRAP_TARBALL --exclude='./tmp/*' . + if [ "${DIB_DEBOOTSTRAP_CACHE:-0}" != "0" ]; then + sudo tar --numeric-owner -C $TARGET_ROOT -zcf $DEBOOTSTRAP_TARBALL --exclude='./tmp/*' . + fi fi sudo rm -f ${TARGET_ROOT}/.extra_settings