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.
This commit is contained in:
parent
c7e50a404e
commit
b01e3ff769
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue