From b01e3ff7695f039426e590c95b9d3af936bbe2c8 Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Sun, 28 Oct 2007 03:14:42 +0100 Subject: [PATCH] Added feature to exclude paths from the root filesystem. To make the root filesystem as small as possible, it can be useful to exclude certain files or directories. This is now possible by using the file config/binary_rootfs/exclude, which contains a whitespace separated list of file paths to exclude; wildcards are allowed. These paths are removed from the chroot copy before the root filesystem is built. --- helpers/lh_binary_chroot | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/helpers/lh_binary_chroot b/helpers/lh_binary_chroot index f6615e1c2..50d3d675d 100755 --- a/helpers/lh_binary_chroot +++ b/helpers/lh_binary_chroot @@ -78,6 +78,21 @@ ${LH_ROOT_COMMAND} rm -rf chroot.tmp ${LH_ROOT_COMMAND} cp -a chroot chroot.tmp ${LH_ROOT_COMMAND} mv chroot.tmp chroot/chroot +if [ -f config/binary_rootfs/exclude ] +then + # Read exclude file and expand wildcards. + for EXCLUDE in `cat config/binary_rootfs/exclude` + do + if [ -e chroot/chroot/"${EXCLUDE}" ] + then + # Run "rm" inside the chroot so it cannot possibly remove host files. + Chroot "rm -r chroot/${EXCLUDE}" + else + Echo_warning "Excluded path does not exist: ${EXCLUDE}" + fi + done +fi + if [ -n "${LH_ROOT_COMMAND}" ] then ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot