diff options
-rwxr-xr-x | scripts/build/bootstrap | 3 | ||||
-rwxr-xr-x | scripts/build/bootstrap_cache | 82 | ||||
-rwxr-xr-x | scripts/build/bootstrap_cdebootstrap | 18 | ||||
-rwxr-xr-x | scripts/build/bootstrap_debootstrap | 18 |
4 files changed, 85 insertions, 36 deletions
diff --git a/scripts/build/bootstrap b/scripts/build/bootstrap index b497fb6c7..eea107490 100755 --- a/scripts/build/bootstrap +++ b/scripts/build/bootstrap @@ -35,6 +35,7 @@ Set_defaults Setup_cleanup # Bootstrapping system +lb bootstrap_cache restore ${@} lb bootstrap_${LB_BOOTSTRAP} # Configuring chroot @@ -69,3 +70,5 @@ lb chroot_sysfs remove ${@} lb chroot_selinuxfs remove ${@} lb chroot_proc remove ${@} lb chroot_devpts remove ${@} + +lb bootstrap_cache save ${@} diff --git a/scripts/build/bootstrap_cache b/scripts/build/bootstrap_cache new file mode 100755 index 000000000..24b2f4064 --- /dev/null +++ b/scripts/build/bootstrap_cache @@ -0,0 +1,82 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2013 Daniel Baumann <mail@daniel-baumann.ch> +## +## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +## This is free software, and you are welcome to redistribute it +## under certain conditions; see COPYING for details. + + +set -e + +# Including common functions +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh + +# Setting static variables +DESCRIPTION="$(Echo 'cache bootstrap stage')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +for STAGE in ${LB_CACHE_STAGES} +do + if [ "${STAGE}" = "bootstrap" ] + then + case "${1}" in + restore) + Echo_message "Restoring bootstrap stage from cache..." + + # Checking stage file + Check_stagefile .build/bootstrap + + if [ -d cache/bootstrap ] + then + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Removing old chroot + rm -rf chroot + + # Restoring old cache + cp -a cache/bootstrap chroot + + # Creating stage file + Create_stagefile .build/bootstrap + + exit 0 + fi + ;; + + save) + Echo_message "Saving bootstrap stage to cache..." + + # Checking stage file + Check_stagefile .build/bootstrap_cache.save + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + rm -rf cache/bootstrap + + mkdir -p cache + + cp -a chroot cache/bootstrap + + # Creating stage file + Create_stagefile .build/bootstrap_cache.save + ;; + esac + fi +done diff --git a/scripts/build/bootstrap_cdebootstrap b/scripts/build/bootstrap_cdebootstrap index ea72ccfd5..7df180fab 100755 --- a/scripts/build/bootstrap_cdebootstrap +++ b/scripts/build/bootstrap_cdebootstrap @@ -104,14 +104,6 @@ def main(): print('I: use \'lb clean\' to clean up a previously incomplete build') sys.exit(1) - # stage cache - elif os.path.exists('cache/bootstrap'): - if verbose: - print('I: Copying cache/bootstrap to chroot') - - # Note: copy instead of move to make cache survive incomplete build - #shutil.copytree('cache/bootstrap', 'chroot') # FIXME: copytree() doesn't work with device files :( - cp = subprocess.call('cp -a cache/bootstrap chroot', shell=True) # packages cache elif glob.glob('cache/packages.bootstrap/*.deb'): if verbose: @@ -154,16 +146,6 @@ def main(): cdebootstrap = subprocess.call('/usr/bin/cdebootstrap ' + cdebootstrap_options, shell=True) - # stage cache - if (os.path.exists('chroot')) and (not os.path.exists('cache/bootstrap')): - if verbose: - print('I: Copying chroot to cache/bootstrap') - - # Note: copy instead of move to keep stage - #shutil.copytree('chroot', 'cache/bootstrap') # FIXME: copytree() doesn't work with device files :( - os.makedirs('cache', exist_ok=True) - cp = subprocess.call('cp -a chroot cache/bootstrap', shell=True) - ## stagefile os.makedirs('.build', exist_ok=True) open('.build/bootstrap', 'w').close() diff --git a/scripts/build/bootstrap_debootstrap b/scripts/build/bootstrap_debootstrap index 482e23f67..a9fa06ef6 100755 --- a/scripts/build/bootstrap_debootstrap +++ b/scripts/build/bootstrap_debootstrap @@ -109,14 +109,6 @@ def main(): print('I: use \'lb clean\' to clean up a previously incomplete build') sys.exit(1) - # stage cache - elif os.path.exists('cache/bootstrap'): - if verbose: - print('I: Copying cache/bootstrap to chroot') - - # Note: copy instead of move to make cache survive incomplete build - #shutil.copytree('cache/bootstrap', 'chroot') # FIXME: copytree() doesn't work with device files :( - cp = subprocess.call('cp -a cache/bootstrap chroot', shell=True) # packages cache elif glob.glob('cache/packages.bootstrap/*.deb'): if verbose: @@ -151,16 +143,6 @@ def main(): for package in glob.glob('chroot/var/cache/apt/archives/*.deb'): shutil.move(package, 'cache/packages.bootstrap') - # stage cache - if (os.path.exists('chroot')) and (not os.path.exists('cache/bootstrap')): - if verbose: - print('I: Copying chroot to cache/bootstrap') - - # Note: copy instead of move to keep stage - #shutil.copytree('chroot', 'cache/bootstrap') # FIXME: copytree() doesn't work with device files :( - os.makedirs('cache', exist_ok=True) - cp = subprocess.call('cp -a chroot cache/bootstrap', shell=True) - ## stagefile os.makedirs('.build', exist_ok=True) open('.build/bootstrap', 'w').close() |