summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLyndon Brown <jnqnfe@gmail.com>2020-04-30 05:48:08 +0100
committerLyndon Brown <jnqnfe@gmail.com>2020-04-30 06:20:52 +0100
commit647dcb7aeddc71c9637e1487de1c3f61e49ae978 (patch)
treef4277e6d4296ef41675c6f65171d552248ad92e8
parent51903da07338928e15c8c7963b18968954f4dd06 (diff)
downloadvyos-live-build-647dcb7aeddc71c9637e1487de1c3f61e49ae978.tar.gz
vyos-live-build-647dcb7aeddc71c9637e1487de1c3f61e49ae978.zip
bootstrap_cache: fix failure condition
during testing i encountered an unexpected error resulting from the following condition: - bootstrap was cached - cache of bootstrap packages was empty (from playing with `lb clean`) - installer was not none|live everything works fine up until the main installer script, which comes to an abrupt halt with an error due to the missing cached bootstrap packages that it wants to copy. this situation is easy to unintentionally create, as i managed to do. here we catch the failure condition, correcting for it. this is done by checking for the missing cached packages when restoring the bootstrap from the cache, and skipping this if the packages were missing, thus forcing the bootstrap to be rebuilt. the packages should then be found within the cache, allowing the installer stage to complete successfully. of course the bootstrap stage will only cache the packages if caching is enabled, but if caching is disabled and installer enabled, the config validation will catch that, reporting that problem. Gbp-Dch: Short
-rwxr-xr-xscripts/build/bootstrap_cache14
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/build/bootstrap_cache b/scripts/build/bootstrap_cache
index 1bbc439b5..d8e9607aa 100755
--- a/scripts/build/bootstrap_cache
+++ b/scripts/build/bootstrap_cache
@@ -55,6 +55,20 @@ case "${_ACTION}" in
# Removing old chroot
rm -rf chroot
+ # Catch failure condition.
+ # The installer stage, if not 'none' or 'live' needs to copy cached
+ # bootstrap packages, and will error if these do not exist. This
+ # could be the case if bootstrap is cached but the packages were
+ # wiped from the cache. This detects this condition and if it is the
+ # case, ignores the cached bootstrap, forcing it to be rebuilt thus
+ # re-caching the packages.
+ if ! In_list "${LB_DEBIAN_INSTALLER}" live none &&
+ ! ls cache/packages.bootstrap/*.deb > /dev/null 2>&1
+ then
+ Echo_message "Cached bootstrap packages required but missing, ignoring cached bootstrap to force rebuild."
+ exit 0
+ fi
+
# Restoring old cache
cp -a cache/bootstrap chroot