Hi,

With some help from otavio and SynrG on IRC, here is a different patch for 
excluding files and directories from the root filesystem. It removes the 
excluded dirs from the chroot copy, which means it works for any current or 
future root filesystem format.

It treats any whitespace in the exclusion file as a separator, which means 
means it's impossible to exclude a file or directory that contains a space 
in its name. I don't think any Debian package uses spaces in file names, so 
I guess this is not a problem.

Please tell me whether the patch is acceptable like this or whether there 
are things I should change.

Bye,
                Maarten
--- lh_binary_chroot.org	2007-10-24 16:52:33.000000000 +0200
+++ lh_binary_chroot	2007-10-24 18:44:12.000000000 +0200
@@ -78,6 +78,22 @@
 ${LH_ROOT_COMMAND} cp -a chroot chroot.tmp
 ${LH_ROOT_COMMAND} mv chroot.tmp chroot/chroot
 
+if [ -f config/binary_rootfs/exclude ]
+then
+	EXCLUDES=""
+	for EXCLUDE in `cat config/binary_rootfs/exclude`
+	do
+		if [ -e chroot/chroot/"${EXCLUDE}" ]
+		then
+			EXCLUDES="${EXCLUDES} chroot/${EXCLUDE}"
+		else
+			Echo_warning "Excluded path does not exist: ${EXCLUDE}"
+		fi
+	done
+	# Run "rm" inside the chroot so it cannot possibly remove host files.
+	Chroot "rm -rf ${EXCLUDES}"
+fi
+
 if [ -n "${LH_ROOT_COMMAND}" ]
 then
 	${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
debian-live-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/debian-live-devel

Reply via email to