summaryrefslogtreecommitdiff
path: root/functions/chroot.sh
diff options
context:
space:
mode:
authorThore Sommer <debian@thson.de>2020-10-27 15:07:11 +0000
committerLuca Boccassi <bluca@debian.org>2020-10-27 15:07:11 +0000
commit7360d50fa6b7ef4809d28cf873ab7d29dc2a6f97 (patch)
tree609b88fd0c2840a14688a6bd18b185fd686a7781 /functions/chroot.sh
parent7b19209aaeb14719d8029fa321aa39aef08b6e94 (diff)
downloadvyos-live-build-7360d50fa6b7ef4809d28cf873ab7d29dc2a6f97.tar.gz
vyos-live-build-7360d50fa6b7ef4809d28cf873ab7d29dc2a6f97.zip
Added the option to include files before and after package installation
Moved includes.chroot to includes.chroot_after_packages and added includes.chroot_before_packages. includes.chroot does still work as before. We also now use rsync for copying files if it is installed. This improves runtime and space consumption for large includes. Gbp-Dch: Short Closes: #927128
Diffstat (limited to 'functions/chroot.sh')
-rwxr-xr-xfunctions/chroot.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/functions/chroot.sh b/functions/chroot.sh
index 76733e50e..d62a4fad0 100755
--- a/functions/chroot.sh
+++ b/functions/chroot.sh
@@ -56,3 +56,23 @@ Chroot_package_list() {
dpkg-query --admindir=${CHROOT}/var/lib/dpkg -W -f'${Package}\n'
}
+
+Chroot_copy_dir() {
+ local DIR="${1}"
+ local NAME="${2:-$(basename ${DIR})}"
+
+ Check_installed host /usr/bin/rsync rsync
+ if [ "${INSTALL_STATUS}" -eq "0" ]
+ then
+ Echo_message "Copying ${NAME} into chroot using rsync..."
+ rsync -Klrv --chown=0:0 "${DIR}" chroot/
+ else
+ cd "${DIR}"
+ Echo_message "Creating a tarball with files from ${NAME}..."
+ tar cf "${OLDPWD}"/chroot/"${NAME}".tar .
+ cd "${OLDPWD}"
+ Echo_message "Extracting the tarball in the chroot..."
+ Chroot chroot "tar -xvf ${NAME}.tar --no-same-owner --keep-directory-symlink --overwrite"
+ rm chroot/"${NAME}".tar
+ fi
+}