summaryrefslogtreecommitdiff
path: root/functions/chroot.sh
diff options
context:
space:
mode:
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
+}