[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#378089: initramfs-tools: create /etc/initramfs-tools/conf.d in preinst before writing to it



Package: initramfs-tools
Version: 0.68b
Severity: important
Tags: patch

The .deb's filesystem archive hasn't yet been unpacked when the preinst
runs, so you aren't allowed to depend upon directories shipped in the
.deb existing at that point. Patch attached.

It also occurs to me that this bug may have produced
/etc/initramfs-tools as a regular file, due to this incautious code:

                        cp /etc/mkinitrd/modules /etc/initramfs-tools

You should append a trailing slash when copying to directories to defend
against this; my patch also does this.

Cheers,

-- 
Colin Watson                                       [cjwatson@debian.org]
diff -ru initramfs-tools-0.68b.orig/debian/initramfs-tools.preinst initramfs-tools-0.68b/debian/initramfs-tools.preinst
--- initramfs-tools-0.68b.orig/debian/initramfs-tools.preinst	2006-07-07 10:51:01.000000000 +0100
+++ initramfs-tools-0.68b/debian/initramfs-tools.preinst	2006-07-13 09:34:15.000000000 +0100
@@ -5,6 +5,8 @@
 case "$1" in
 	configure)
 	if [ -n "$2" ]; then
+		mkdir -p /etc/initramfs-tools/conf.d
+
 		# First time install.  Can we autodetect the RESUME partition?
 		RESUME=$(tail -n $(($(wc -l /proc/swaps | awk ' { print $1 } ') - 1)) /proc/swaps | sort -rk3 | head -n 1 | awk ' { print $1 } ')
 
@@ -18,7 +20,7 @@
 
 		# Add initrd-tools modules, while trying to minimize prompting
 		if [ -e /etc/mkinitrd/modules ]; then
-			cp /etc/mkinitrd/modules /etc/initramfs-tools
+			cp /etc/mkinitrd/modules /etc/initramfs-tools/
 			sed -i \
 			  -e 's/\/etc\/mkinitrd\/modules: Kernel modules to load for initrd./List of modules that you want to include in your initramfs./g' \
 			  -e 's/mkinitrd/update-initramfs/g' \

Reply to: