summaryrefslogtreecommitdiff
path: root/configs/profile/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'configs/profile/build.sh')
-rwxr-xr-xconfigs/profile/build.sh24
1 files changed, 20 insertions, 4 deletions
diff --git a/configs/profile/build.sh b/configs/profile/build.sh
index 326af1e..4752c64 100755
--- a/configs/profile/build.sh
+++ b/configs/profile/build.sh
@@ -78,7 +78,17 @@ run_once() {
# Setup custom pacman.conf to cache packages on the target filesystem.
make_pacman_conf() {
- sed -r "s|^#?\\s*CacheDir.+|CacheDir = ${work_dir}/${arch}/root-image/isorepo/|g" ${releng_dir}/pacman.conf > ${pacman_conf}
+ local stash_dir=${work_dir}/isorepo-${arch}
+ local isorepo_dir=${work_dir}/${arch}/root-image/isorepo/
+
+ # restore package cache from previous build
+ if [[ -d ${stash_dir} ]]; then
+ echo "restoring package cache from ${stash_dir}"
+ mkdir -p ${isorepo_dir}
+ mv ${stash_dir}/* ${isorepo_dir} || true
+ fi
+
+ sed --regexp-extended 's|^#?\s*CacheDir.+|CacheDir = '${isorepo_dir}'|g' ${releng_dir}/pacman.conf > ${pacman_conf}
}
# Base installation, plus needed packages (root-image)
@@ -151,17 +161,23 @@ make_packages() {
# create live environment local repo or stash package cache
if [[ "$enable_offline_install" == 'true' ]]; then
- if [[ -n ${_cache_packages} ]]; then
+ if [[ -n "${_cache_packages}" ]]; then
# download any cache packages and prune obsolete packages
+ echo 'downloading "cach-only" packages'
setarch ${arch} mkparabolaiso ${verbose} -w ${work_dir}/${arch} -C ${pacman_conf} -D ${iso_dirname} -p "${_cache_packages}" ${offline_switch} cache
fi
+
# create 'isorepo' for offline install
+ echo "creating 'isorepo' for offline install"
pushd ${work_dir}/${arch}/root-image/isorepo > /dev/null
setarch ${arch} repo-add --new isorepo.db.tar.gz ./*
- popd > /dev/null
+ popd > /dev/null
else
# stash package cache for next build
- mv ${work_dir}/${arch}/root-image/isorepo ${work_dir}/../isorepo-${arch} || true
+ echo "stashing package cache to ${work_dir}/isorepo-${arch}"
+ mkdir -p ${work_dir}/isorepo-${arch}/
+ mv ${work_dir}/${arch}/root-image/isorepo/* ${work_dir}/isorepo-${arch}/
+ rmdir ${work_dir}/${arch}/root-image/isorepo
fi
}