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

[patch ] Add /dev/mapper in all cases needed in bsae-installer


Now /dev/mapper structure is created only if lvm2 is detected. However,
device-mapper is also used by dm-crypt and EVMS. This patch creates
/target/dev/mapper in case device-mapper module is loaded. This
directory is needed (atleast) to get grub installed.

The approach in the patch has the slight inconvinience of creating the
directory in some cases even if not really needed. For example in case
user has created encrypted partitions that are not / or /boot related.
In My (lazy) opinion, wasting few nodes on target is accepteble, since 
adding more fine grained tests would instead bloat the base-installer 
script and make it more fragile. 

Index: postinst
--- postinst	(revision 36896)
+++ postinst	(working copy)
@@ -323,18 +323,20 @@
 	if [ -e /proc/mdstat ] && grep -q ^md /proc/mdstat ; then
 		apt-install mdadm
-	# LVM: create VG and LV devices
-	if pvdisplay | grep -iq "physical volume ---" && grep -q " device-mapper$" /proc/misc; then
-		apt-install lvm2
-		mount -t proc proc /target/proc
+	# device-mapper
+	if grep -q " device-mapper$" /proc/misc; then
 		mkdir -p /target/dev/mapper
 		if [ ! -e /target/dev/mapper/control ] ; then
 			major=$(grep "[0-9] misc$" /proc/devices | sed 's/[ ]\+misc//')
 			minor=$(grep "[0-9] device-mapper$" /proc/misc | sed 's/[ ]\+device-mapper//')
 			mknod /target/dev/mapper/control c $major $minor
-		chroot /target vgscan --mknodes || true
-		umount /target/proc
+		if pvdisplay | grep -iq "physical volume ---"; then
+			apt-install lvm2
+			mount -t proc proc /target/proc
+			chroot /target vgscan --mknodes || true
+			umount /target/proc
+		fi
 	# UML: create ubd devices
 	if grep -q "model.*UML" /proc/cpuinfo; then

Reply to: