diff options
-rwxr-xr-x | components/bootstrap_cdebootstrap | 23 | ||||
-rwxr-xr-x | components/bootstrap_debootstrap | 23 | ||||
-rwxr-xr-x | scripts/build/bootstrap | 3 | ||||
-rwxr-xr-x | scripts/build/bootstrap_cache | 82 |
4 files changed, 46 insertions, 85 deletions
diff --git a/components/bootstrap_cdebootstrap b/components/bootstrap_cdebootstrap index fc0b663d6..3ac2b95d6 100755 --- a/components/bootstrap_cdebootstrap +++ b/components/bootstrap_cdebootstrap @@ -106,6 +106,20 @@ def main(): sys.exit(1) + # stage cache + if os.path.exists('cache/bootstrap'): + if verbose: + print('I: Copying cache/bootstrap to chroot') + + # Notes: + # * there's no Python equivalent to 'cp -a' that handels both symlinks and device nodes properly. + cache = subprocess.call('cp -a cache/bootstrap chroot', shell=True) + + os.makedirs('.build', exist_ok=True) + open('.build/bootstrap', 'w').close() + + sys.exit(0) + # packages cache if glob.glob('cache/packages.bootstrap/*.deb'): if verbose: @@ -151,6 +165,15 @@ def main(): cdebootstrap = subprocess.call('/usr/bin/cdebootstrap ' + cdebootstrap_options, shell=True) + # stage cache + if not os.path.exists('cache/bootstrap'): + if verbose: + print('I: Copying chroot to cache/bootstrap') + + # Notes: + # * there's no Python equivalent to 'cp -a' that handels both symlinks and device nodes properly. + cache = subprocess.call('cp -a chroot cache/bootstrap', shell=True) + ## stagefile os.makedirs('.build', exist_ok=True) open('.build/bootstrap', 'w').close() diff --git a/components/bootstrap_debootstrap b/components/bootstrap_debootstrap index 2f5c128e7..0d76d627d 100755 --- a/components/bootstrap_debootstrap +++ b/components/bootstrap_debootstrap @@ -111,6 +111,20 @@ def main(): sys.exit(1) + # stage cache + if os.path.exists('cache/bootstrap'): + if verbose: + print('I: Copying cache/bootstrap to chroot') + + # Notes: + # * there's no Python equivalent to 'cp -a' that handels both symlinks and device nodes properly. + cache = subprocess.call('cp -a cache/bootstrap chroot', shell=True) + + os.makedirs('.build', exist_ok=True) + open('.build/bootstrap', 'w').close() + + sys.exit(0) + # packages cache if glob.glob('cache/packages.bootstrap/*.deb'): if verbose: @@ -148,6 +162,15 @@ def main(): for package in glob.glob('chroot/var/cache/apt/archives/*.deb'): shutil.move(package, 'cache/packages.bootstrap') + # stage cache + if not os.path.exists('cache/bootstrap'): + if verbose: + print('I: Copying chroot to cache/bootstrap') + + # Notes: + # * there's no Python equivalent to 'cp -a' that handels both symlinks and device nodes properly. + cache = 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 b/scripts/build/bootstrap index b50cd49b0..1d30dfe87 100755 --- a/scripts/build/bootstrap +++ b/scripts/build/bootstrap @@ -35,7 +35,6 @@ Set_defaults Setup_cleanup # Bootstrapping system -lb bootstrap_cache restore ${@} lb bootstrap_${LB_BOOTSTRAP} # Configuring chroot @@ -70,5 +69,3 @@ 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 deleted file mode 100755 index 24b2f4064..000000000 --- a/scripts/build/bootstrap_cache +++ /dev/null @@ -1,82 +0,0 @@ -#!/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 |