From 63631975b71ac083c07fd927d0b7264af73f2e24 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 23 Sep 2007 10:05:21 +0200 Subject: Adding live-helper 1.0~a27-1. --- helpers/lh_chroot_cache | 75 +++++++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 36 deletions(-) (limited to 'helpers/lh_chroot_cache') 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 -- cgit v1.2.3