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

Bug#498143: Please detect non-ISO block devices masquerading as Debian CDs



Package: cdrom-detect
Version: 1.29
Severity: wishlist
Tags: patch

Hi,

In Debian Live, integration with the Debian Installer works perfectly with
ISO images; cdrom-detect mounts the live image containing the installer
components and proceeds with the installation.

However, on USB/HDD images, cdrom-detect naturally fails to locate the
partition on which the d-i components reside, as it is neither an ISO9660
image nor contained on a block device returned by `list-devices cd` or
`list-devices maybe-usb-floppy`.

The attached patch rectifies this by additionally detecting vfat and ext disk
partitions masquerading as Debian CDs. We only concern ourselves with these
filesystem types as well as restricting the search to partitions as live-
helper will only generate images with these combinations.


Regards,

-- 
Chris Lamb, UK                                       chris@chris-lamb.co.uk
                                                            GPG: 0x634F9A20
From f7765eba7435a1d55ae1b442b726ac7ce6f2659a Mon Sep 17 00:00:00 2001
From: Chris Lamb <chris@chris-lamb.co.uk>
Date: Sun, 7 Sep 2008 15:03:23 +0100
Subject: [PATCH] Try vfat and ext disk partitions masquerading as Debian CDs.

---
 packages/cdrom-detect/debian/cdrom-detect.postinst |   22 ++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/packages/cdrom-detect/debian/cdrom-detect.postinst b/packages/cdrom-detect/debian/cdrom-detect.postinst
index da0c1bb..ff32ef0 100755
--- a/packages/cdrom-detect/debian/cdrom-detect.postinst
+++ b/packages/cdrom-detect/debian/cdrom-detect.postinst
@@ -44,6 +44,28 @@ do
 		fi
 	done
 
+	# Try disk partitions masquerading as Debian CDs for Debian Live
+	# "usb-hdd" images. Only vfat and ext are supported.
+	modprobe vfat >/dev/null 2>&1 || true
+	for device in $(list-devices partition); do
+		if mount -t vfat -o ro,exec $device /cdrom ||
+		   mount -t ext2 -o ro,exec $device /cdrom; then
+			log "Pseudo CD-ROM mount succeeded: device=$device"
+
+			# Test whether it's a Debian CD
+			if [ -e /cdrom/.disk/info ]; then
+				mounted=1
+				db_set cdrom-detect/cdrom_device $device
+				break
+			else
+				log "Ignoring pseudo CD-ROM device $device - it is not a Debian CD"
+				umount /cdrom 2>/dev/null || true
+			fi
+		else
+			log "Psuedo CD-ROM mount failed: device=$device"
+		fi
+	done
+
 	if [ "$mounted" = "1" ]; then
 		break
 	fi
-- 
1.5.6.5

Attachment: signature.asc
Description: PGP signature


Reply to: