2014-08-27 21:14:12 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
## live-build(7) - System Build Scripts
|
2020-03-11 09:07:21 -01:00
|
|
|
## Copyright (C) 2016-2020 The Debian Live team
|
2015-01-04 18:05:39 -01:00
|
|
|
## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
|
2014-08-27 21:14:12 +00:00
|
|
|
##
|
|
|
|
## 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
|
2015-02-05 02:30:47 -01:00
|
|
|
DESCRIPTION="Cache bootstrap stage"
|
2014-08-27 21:14:12 +00:00
|
|
|
USAGE="${PROGRAM} [--force]"
|
|
|
|
|
2015-02-05 02:30:47 -01:00
|
|
|
# Processing arguments and configuration files
|
|
|
|
Init_config_data "${@}"
|
2014-08-27 21:14:12 +00:00
|
|
|
|
|
|
|
# Check architecture
|
|
|
|
Check_crossarchitectures
|
|
|
|
|
2015-01-06 02:43:43 -01:00
|
|
|
if ! In_list "bootstrap" ${LB_CACHE_STAGES}
|
|
|
|
then
|
|
|
|
exit 0
|
|
|
|
fi
|
2014-08-27 21:14:12 +00:00
|
|
|
|
2020-03-13 16:11:53 -01:00
|
|
|
_ACTION="${1}"
|
|
|
|
shift
|
|
|
|
|
|
|
|
# Set non-default stage file name (auto picked up by the functions)
|
2020-03-12 00:21:39 -01:00
|
|
|
# Note, this (plus the applicable extension added below) must match that used in `bootstrap_debootstrap`
|
2020-03-13 16:11:53 -01:00
|
|
|
STAGE_FILE="bootstrap_cache.${_ACTION}"
|
2020-03-12 00:21:39 -01:00
|
|
|
|
2020-03-13 16:11:53 -01:00
|
|
|
case "${_ACTION}" in
|
2015-01-06 02:43:43 -01:00
|
|
|
restore)
|
|
|
|
# Checking stage file
|
2020-03-12 00:21:39 -01:00
|
|
|
Check_stagefile "${STAGE_FILE}"
|
2015-01-07 04:02:13 -01:00
|
|
|
|
2015-01-06 02:43:43 -01:00
|
|
|
if [ -d cache/bootstrap ]
|
|
|
|
then
|
|
|
|
Echo_message "Restoring bootstrap stage from cache..."
|
2014-08-27 21:14:12 +00:00
|
|
|
|
2020-03-13 15:19:59 -01:00
|
|
|
# Acquire lock file
|
2015-02-05 02:30:47 -01:00
|
|
|
Acquire_lockfile
|
2014-08-27 21:14:12 +00:00
|
|
|
|
2015-01-06 02:43:43 -01:00
|
|
|
# Removing old chroot
|
|
|
|
rm -rf chroot
|
2014-08-27 21:14:12 +00:00
|
|
|
|
2015-01-06 02:43:43 -01:00
|
|
|
# Restoring old cache
|
|
|
|
cp -a cache/bootstrap chroot
|
2014-08-27 21:14:12 +00:00
|
|
|
|
2015-01-06 02:43:43 -01:00
|
|
|
# Creating stage file
|
2020-03-12 00:21:39 -01:00
|
|
|
Create_stagefile "${STAGE_FILE}"
|
2020-03-13 16:11:53 -01:00
|
|
|
Create_stagefile "bootstrap"
|
2014-08-27 21:14:12 +00:00
|
|
|
|
2015-01-06 02:43:43 -01:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
;;
|
2014-08-27 21:14:12 +00:00
|
|
|
|
2015-01-06 02:43:43 -01:00
|
|
|
save)
|
|
|
|
Echo_message "Saving bootstrap stage to cache..."
|
2014-08-27 21:14:12 +00:00
|
|
|
|
2015-01-06 02:43:43 -01:00
|
|
|
# Checking stage file
|
2020-03-12 00:21:39 -01:00
|
|
|
Check_stagefile "${STAGE_FILE}"
|
2014-08-27 21:14:12 +00:00
|
|
|
|
2020-03-13 15:19:59 -01:00
|
|
|
# Acquire lock file
|
2015-02-05 02:30:47 -01:00
|
|
|
Acquire_lockfile
|
2014-08-27 21:14:12 +00:00
|
|
|
|
2015-01-06 02:43:43 -01:00
|
|
|
rm -rf cache/bootstrap
|
2014-08-27 21:14:12 +00:00
|
|
|
|
2015-01-06 02:43:43 -01:00
|
|
|
mkdir -p cache
|
2014-08-27 21:14:12 +00:00
|
|
|
|
2015-01-06 02:43:43 -01:00
|
|
|
cp -a chroot cache/bootstrap
|
|
|
|
|
|
|
|
# Creating stage file
|
2020-03-12 00:21:39 -01:00
|
|
|
Create_stagefile "${STAGE_FILE}"
|
2015-01-06 02:43:43 -01:00
|
|
|
;;
|
|
|
|
esac
|