diff options
Diffstat (limited to 'functions')
-rwxr-xr-x | functions/chroot.sh | 20 | ||||
-rwxr-xr-x | functions/compatibility.sh | 30 |
2 files changed, 50 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 +} diff --git a/functions/compatibility.sh b/functions/compatibility.sh new file mode 100755 index 000000000..f0ae08346 --- /dev/null +++ b/functions/compatibility.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2016-2020 The Debian Live team +## Copyright (C) 2006-2015 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. + +# We've added the option to also include files before packages renamed the old directory. +# This function auto detects which version should be used. +select_includes_chroot(){ + local OLD_DIR="includes.chroot" + local NEW_DIR="includes.chroot_after_packages" + + if Find_files "config/${NEW_DIR}/" && Find_files "config/${OLD_DIR}/" + then + Echo_error "You have files in ${OLD_DIR} and ${NEW_DIR}. Only one directory is allowed." + exit 1 + fi + + if Find_files "config/${NEW_DIR}/" + then + echo -n "${NEW_DIR}" + elif Find_files "config/${OLD_DIR}/" + then + echo -n "${OLD_DIR}" + fi +} |