simplify STAGE checks - use In_List

Closes: 
This commit is contained in:
jnqnfe 2015-01-06 03:43:43 +00:00 committed by Lyndon Brown
parent 62b3efa686
commit ed2d70bde1
3 changed files with 101 additions and 109 deletions

View File

@ -61,22 +61,19 @@ esac
# Creating directory # Creating directory
mkdir -p binary/${INITFS} mkdir -p binary/${INITFS}
for STAGE in ${LB_CACHE_STAGES} if In_list "rootfs" ${LB_CACHE_STAGES} && [ -d cache/binary_rootfs ]
do then
if [ "${STAGE}" = "rootfs" ] && [ -d cache/binary_rootfs ] # Removing old chroot
then rm -rf binary/"${INITFS}"/filesystem.*
# Removing old chroot
rm -rf binary/"${INITFS}"/filesystem.*
# Restoring old cache # Restoring old cache
mkdir -p binary/"${INITFS}" mkdir -p binary/"${INITFS}"
cp -a cache/binary_rootfs/filesystem.* binary/"${INITFS}" cp -a cache/binary_rootfs/filesystem.* binary/"${INITFS}"
# Creating stage file # Creating stage file
Create_stagefile .build/binary_rootfs Create_stagefile .build/binary_rootfs
exit 0 exit 0
fi fi
done
case "${LB_CHROOT_FILESYSTEM}" in case "${LB_CHROOT_FILESYSTEM}" in
ext2|ext3|ext4) ext2|ext3|ext4)
@ -443,20 +440,17 @@ case "${LB_CHROOT_FILESYSTEM}" in
esac esac
for STAGE in ${LB_CACHE_STAGES} if In_list "rootfs" ${LB_CACHE_STAGES}
do then
if [ "${STAGE}" = "rootfs" ] rm -rf cache/binary_rootfs
mkdir -p cache/binary_rootfs
if [ "${LB_CHROOT_FILESYSTEM}" != "none" ]
then then
rm -rf cache/binary_rootfs cp -a binary/"${INITFS}"/filesystem.* cache/binary_rootfs
mkdir -p cache/binary_rootfs
if [ "${LB_CHROOT_FILESYSTEM}" != "none" ]
then
cp -a binary/"${INITFS}"/filesystem.* cache/binary_rootfs
fi
fi fi
done fi
# Creating stage file # Creating stage file
Create_stagefile .build/binary_rootfs Create_stagefile .build/binary_rootfs

View File

@ -27,60 +27,59 @@ Set_defaults
# Check architecture # Check architecture
Check_crossarchitectures Check_crossarchitectures
for STAGE in ${LB_CACHE_STAGES} if ! In_list "bootstrap" ${LB_CACHE_STAGES}
do then
if [ "${STAGE}" = "bootstrap" ] exit 0
then fi
case "${1}" in
restore)
# Checking stage file
Check_stagefile .build/bootstrap_cache.restore
if [ -d cache/bootstrap ] case "${1}" in
then restore)
Echo_message "Restoring bootstrap stage from cache..." # Checking stage file
Check_stagefile .build/bootstrap_cache.restore
# Checking lock file if [ -d cache/bootstrap ]
Check_lockfile .lock then
Echo_message "Restoring bootstrap stage from cache..."
# Creating lock file # Checking lock file
Create_lockfile .lock Check_lockfile .lock
# Removing old chroot # Creating lock file
rm -rf chroot Create_lockfile .lock
# Restoring old cache # Removing old chroot
cp -a cache/bootstrap chroot rm -rf chroot
# Creating stage file # Restoring old cache
Create_stagefile .build/bootstrap_cache.restore cp -a cache/bootstrap chroot
Create_stagefile .build/bootstrap
exit 0 # Creating stage file
fi Create_stagefile .build/bootstrap_cache.restore
;; Create_stagefile .build/bootstrap
save) exit 0
Echo_message "Saving bootstrap stage to cache..." fi
;;
# Checking stage file save)
Check_stagefile .build/bootstrap_cache.save Echo_message "Saving bootstrap stage to cache..."
# Checking lock file # Checking stage file
Check_lockfile .lock Check_stagefile .build/bootstrap_cache.save
# Creating lock file # Checking lock file
Create_lockfile .lock 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 cp -a chroot cache/bootstrap
Create_stagefile .build/bootstrap_cache.save
;; # Creating stage file
esac Create_stagefile .build/bootstrap_cache.save
fi ;;
done esac

View File

@ -24,59 +24,58 @@ Arguments "${@}"
Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
Set_defaults Set_defaults
for STAGE in ${LB_CACHE_STAGES} if ! In_list "chroot" ${LB_CACHE_STAGES}
do then
if [ "${STAGE}" = "chroot" ] exit 0
then fi
case "${1}" in
restore)
Echo_message "Restoring chroot stage from cache..."
# Checking stage file case "${1}" in
Check_stagefile .build/chroot_cache.restore restore)
Echo_message "Restoring chroot stage from cache..."
if [ -d cache/chroot ] # Checking stage file
then Check_stagefile .build/chroot_cache.restore
# Checking lock file
Check_lockfile .lock
# Creating lock file if [ -d cache/chroot ]
Create_lockfile .lock then
# Checking lock file
Check_lockfile .lock
# Removing old chroot # Creating lock file
rm -rf chroot Create_lockfile .lock
# Restoring old cache # Removing old chroot
cp -a cache/chroot chroot rm -rf chroot
# Creating stage file # Restoring old cache
Create_stagefile .build/chroot_cache.restore cp -a cache/chroot chroot
exit 0 # Creating stage file
fi Create_stagefile .build/chroot_cache.restore
;;
save) exit 0
Echo_message "Saving chroot stage to cache..." fi
;;
# Checking stage file save)
Check_stagefile .build/chroot_cache.save Echo_message "Saving chroot stage to cache..."
# Checking lock file # Checking stage file
Check_lockfile .lock Check_stagefile .build/chroot_cache.save
# Creating lock file # Checking lock file
Create_lockfile .lock Check_lockfile .lock
rm -rf cache/chroot # Creating lock file
Create_lockfile .lock
mkdir -p cache rm -rf cache/chroot
cp -a chroot cache/chroot mkdir -p cache
# Creating stage file cp -a chroot cache/chroot
Create_stagefile .build/chroot_cache.save
;; # Creating stage file
esac Create_stagefile .build/chroot_cache.save
fi ;;
done esac