summaryrefslogtreecommitdiff
path: root/scripts/build/bootstrap_cache
diff options
context:
space:
mode:
authorjnqnfe <jnqnfe@gmail.com>2015-01-06 03:43:43 +0000
committerLyndon Brown <jnqnfe@gmail.com>2020-03-10 00:02:43 +0000
commited2d70bde10e8ff02e7409c125a6c70da8d6d9ba (patch)
tree8253affd17e14ce6f3944ce498a92acaf31542a9 /scripts/build/bootstrap_cache
parent62b3efa6869a79b0f134203f87fbc9234b0d9d4d (diff)
downloadvyos-live-build-ed2d70bde10e8ff02e7409c125a6c70da8d6d9ba.tar.gz
vyos-live-build-ed2d70bde10e8ff02e7409c125a6c70da8d6d9ba.zip
simplify STAGE checks - use In_List
Closes: #952917
Diffstat (limited to 'scripts/build/bootstrap_cache')
-rwxr-xr-xscripts/build/bootstrap_cache83
1 files changed, 41 insertions, 42 deletions
diff --git a/scripts/build/bootstrap_cache b/scripts/build/bootstrap_cache
index 694ba9dee..b76177b33 100755
--- a/scripts/build/bootstrap_cache
+++ b/scripts/build/bootstrap_cache
@@ -27,60 +27,59 @@ Set_defaults
# Check architecture
Check_crossarchitectures
-for STAGE in ${LB_CACHE_STAGES}
-do
- if [ "${STAGE}" = "bootstrap" ]
- then
- case "${1}" in
- restore)
- # Checking stage file
- Check_stagefile .build/bootstrap_cache.restore
+if ! In_list "bootstrap" ${LB_CACHE_STAGES}
+then
+ exit 0
+fi
- if [ -d cache/bootstrap ]
- then
- Echo_message "Restoring bootstrap stage from cache..."
+case "${1}" in
+ restore)
+ # Checking stage file
+ Check_stagefile .build/bootstrap_cache.restore
- # Checking lock file
- Check_lockfile .lock
+ if [ -d cache/bootstrap ]
+ then
+ Echo_message "Restoring bootstrap stage from cache..."
- # Creating lock file
- Create_lockfile .lock
+ # Checking lock file
+ Check_lockfile .lock
- # Removing old chroot
- rm -rf chroot
+ # Creating lock file
+ Create_lockfile .lock
- # Restoring old cache
- cp -a cache/bootstrap chroot
+ # Removing old chroot
+ rm -rf chroot
- # Creating stage file
- Create_stagefile .build/bootstrap_cache.restore
- Create_stagefile .build/bootstrap
+ # Restoring old cache
+ cp -a cache/bootstrap chroot
- exit 0
- fi
- ;;
+ # Creating stage file
+ Create_stagefile .build/bootstrap_cache.restore
+ Create_stagefile .build/bootstrap
- save)
- Echo_message "Saving bootstrap stage to cache..."
+ exit 0
+ fi
+ ;;
- # Checking stage file
- Check_stagefile .build/bootstrap_cache.save
+ save)
+ Echo_message "Saving bootstrap stage to cache..."
- # Checking lock file
- Check_lockfile .lock
+ # Checking stage file
+ Check_stagefile .build/bootstrap_cache.save
- # Creating lock file
- Create_lockfile .lock
+ # Checking lock file
+ Check_lockfile .lock
- rm -rf cache/bootstrap
+ # Creating lock file
+ Create_lockfile .lock
- mkdir -p cache
+ rm -rf cache/bootstrap
- cp -a chroot cache/bootstrap
+ mkdir -p cache
- # Creating stage file
- Create_stagefile .build/bootstrap_cache.save
- ;;
- esac
- fi
-done
+ cp -a chroot cache/bootstrap
+
+ # Creating stage file
+ Create_stagefile .build/bootstrap_cache.save
+ ;;
+esac