summaryrefslogtreecommitdiff
path: root/helpers/lh_bootstrap_cache
diff options
context:
space:
mode:
Diffstat (limited to 'helpers/lh_bootstrap_cache')
-rwxr-xr-xhelpers/lh_bootstrap_cache73
1 files changed, 37 insertions, 36 deletions
diff --git a/helpers/lh_bootstrap_cache b/helpers/lh_bootstrap_cache
index 8d811a9..b253b5d 100755
--- a/helpers/lh_bootstrap_cache
+++ b/helpers/lh_bootstrap_cache
@@ -37,49 +37,50 @@ Echo_message "Begin caching bootstrap stage..."
for STAGE in ${LH_CACHE_STAGES}
do
- case "${1}" in
- restore)
- # Checking stage file
- Check_stagefile .stage/bootstrap_cache.restore
+ if [ "${STAGE}" = "bootstrap" ]
+ then
+ case "${1}" in
+ restore)
+ # Checking stage file
+ Check_stagefile .stage/bootstrap_cache.restore
+
+ if [ -d cache/stages_bootstrap ]
+ then
+ # Checking lock file
+ Check_lockfile .lock
- # Checking lock file
- Check_lockfile .lock
+ # Creating lock file
+ Create_lockfile .lock
- # Creating lock file
- Create_lockfile .lock
+ # Removing old chroot
+ rm -rf chroot
- if [ "${STAGE}" = "bootstrap" ] && [ -d cache/stages_bootstrap ]
- then
- # Removing old chroot
- rm -rf chroot
+ # Restoring old cache
+ ${LH_ROOT_COMMAND} cp -a cache/stages_bootstrap chroot
- # Restoring old cache
- ${LH_ROOT_COMMAND} cp -a cache/stages_bootstrap chroot
+ if [ -n "${LH_ROOT_COMMAND}" ]
+ then
+ ${LH_ROOT_COMMAND} chown -R `whoami`:`whoami` chroot
+ fi
- if [ -n "${LH_ROOT_COMMAND}" ]
- then
- ${LH_ROOT_COMMAND} chown -R `whoami`:`whoami` chroot
- fi
+ # Creating stage file
+ Create_stagefile .stage/bootstrap_cache.restore
+ Create_stagefile .stage/bootstrap
- # Creating stage file
- Create_stagefile .stage/bootstrap_cache.restore
-
- exit 0
- fi
- ;;
+ exit 0
+ fi
+ ;;
- save)
- # Checking stage file
- Check_stagefile .stage/bootstrap_cache.save
+ save)
+ # Checking stage file
+ Check_stagefile .stage/bootstrap_cache.save
- # Checking lock file
- Check_lockfile .lock
+ # Checking lock file
+ Check_lockfile .lock
- # Creating lock file
- Create_lockfile .lock
+ # Creating lock file
+ Create_lockfile .lock
- if [ "${STAGE}" = "bootstrap" ]
- then
rm -rf cache/stages_bootstrap
mkdir -p cache
@@ -93,7 +94,7 @@ do
# Creating stage file
Create_stagefile .stage/bootstrap_cache.save
- fi
- ;;
- esac
+ ;;
+ esac
+ fi
done