summaryrefslogtreecommitdiff
path: root/helpers
diff options
context:
space:
mode:
authorMaarten ter Huurne <maarten@treewalker.org>2007-10-28 03:14:42 +0100
committerDaniel Baumann <daniel@debian.org>2011-03-09 18:22:28 +0100
commiteb1e09d9e9415cd963efc03707422621edfd15b2 (patch)
tree689ff3160b3b80527fb19e593faeb455d5e5caf3 /helpers
parent4046c781f8f7d5ec9c49ab00d485a7ff4a7847ec (diff)
downloadvyos-live-build-eb1e09d9e9415cd963efc03707422621edfd15b2.tar.gz
vyos-live-build-eb1e09d9e9415cd963efc03707422621edfd15b2.zip
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.
Diffstat (limited to 'helpers')
-rwxr-xr-xhelpers/lh_binary_chroot15
1 files changed, 15 insertions, 0 deletions
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