summaryrefslogtreecommitdiff
path: root/helpers/lh_chroot_cache
diff options
context:
space:
mode:
Diffstat (limited to 'helpers/lh_chroot_cache')
-rwxr-xr-xhelpers/lh_chroot_cache75
1 files changed, 39 insertions, 36 deletions
diff --git a/helpers/lh_chroot_cache b/helpers/lh_chroot_cache
index 157a48ebd..4ec2d13b2 100755
--- a/helpers/lh_chroot_cache
+++ b/helpers/lh_chroot_cache
@@ -37,49 +37,49 @@ Echo_message "Begin caching chroot stage..."
for STAGE in ${LH_CACHE_STAGES}
do
- case "${1}" in
- restore)
- # Checking stage file
- Check_stagefile .stage/chroot_cache.restore
+ if [ "${STAGE}" = "chroot" ]
+ then
+ case "${1}" in
+ restore)
+ # Checking stage file
+ Check_stagefile .stage/chroot_cache.restore
+
+ if [ -d cache/stages_chroot ]
+ 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}" = "chroot" ] && [ -d cache/stages_chroot ]
- then
- # Removing old chroot
- rm -rf chroot
+ # Restoring old cache
+ ${LH_ROOT_COMMAND} cp -a cache/stages_chroot chroot
- # Restoring old cache
- ${LH_ROOT_COMMAND} cp -a cache/stages_chroot 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/chroot_cache.restore
- # Creating stage file
- Create_stagefile .stage/chroot_cache.restore
-
- exit 0
- fi
- ;;
+ exit 0
+ fi
+ ;;
- save)
- # Checking stage file
- Check_stagefile .stage/chroot_cache.save
+ save)
+ # Checking stage file
+ Check_stagefile .stage/chroot_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}" = "chroot" ]
- then
rm -rf cache/stages_chroot
mkdir -p cache
@@ -90,7 +90,10 @@ do
then
${LH_ROOT_COMMAND} chown -R `whoami`:`whoami` cache/stages_chroot
fi
- fi
- ;;
- esac
+
+ # Creating stage file
+ Create_stagefile .stage/chroot_cache.save
+ ;;
+ esac
+ fi
done