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

Merging Ubuntu changes to di-utils, cdrom-detect, apt-setup, and partman-target.



I am proposing that the attached patches be merged from Ubuntu.  These
allow d-i to work when the contents of a Debian install ISO are
written to a USB disk.

For more background on the cdrom-detect change, please read through
the discussion here:
https://bugs.launchpad.net/ubuntu/+bug/234185

Additionally, I would like to request that someone sponsor an upload
of usb-creator, a tool originally created for Ubuntu that takes a CD
or ISO file, writes it to a USB disk, and modifies the syslinux
configuration to add the try-usb option.

Thank you for your consideration.
=== modified file 'debian/cdrom-detect.postinst'
--- debian/cdrom-detect.postinst	2008-06-22 21:58:03 +0000
+++ debian/cdrom-detect.postinst	2008-12-05 19:18:41 +0000
@@ -32,13 +32,42 @@
 do
 	mounted=0
 
+	if db_get cdrom-detect/try-usb && [ "$RET" = "true" ]; then
+		devices="$(list-devices usb-partition)"
+		for device in $devices; do
+			if mount -t vfat -o ro,exec $device /cdrom &&
+			   [ -e /cdrom/.disk/info ]; then
+				log "CD-ROM mount succeeded: device=$device"
+				mounted=1
+				db_set cdrom-detect/cdrom_device $device
+				break
+			else
+				log "CD-ROM mount failed: device=$device"
+				umount /cdrom 2>/dev/null || true
+			fi
+		done
+	fi
+	
+	if [ "$mounted" = "1" ]; then
+		break
+	fi
+	
+	wrong=0
 	devices="$(list-devices cd; list-devices maybe-usb-floppy)"
 	for device in $devices; do
 		if mount -t iso9660 -o ro,exec $device /cdrom; then
 			log "CD-ROM mount succeeded: device=$device"
-			mounted=1
-			db_set cdrom-detect/cdrom_device $device
-			break
+			if [ -e /cdrom/.disk/info ]; then
+				CDNAME=`cat /cdrom/.disk/info`
+				log "Detected CD '$CDNAME'"
+				mounted=1
+				db_set cdrom-detect/cdrom_device $device
+				break
+			else
+				log "The CD on $device is not a Debian CD!"
+				wrong=1
+				umount /cdrom 2>/dev/null || true
+			fi
 		else
 			log "CD-ROM mount failed: device=$device"
 		fi
@@ -48,6 +77,12 @@
 		break
 	fi
 
+	if [ "$wrong" = "1" ]; then
+		db_input critical cdrom-detect/wrong-cd || [ $? -eq 30 ]
+		db_go
+		fail
+	fi
+
 	# If a device was detected but the mount failed, ask for the CD.
 	if [ -n "$devices" ]; then
 		db_input critical cdrom-detect/retry || [ $? -eq 30 ]

=== modified file 'debian/cdrom-detect.templates'
--- debian/cdrom-detect.templates	2008-06-22 21:58:03 +0000
+++ debian/cdrom-detect.templates	2008-12-05 19:29:10 +0000
@@ -84,6 +84,11 @@
  .
  Please insert a suitable CD to continue with the installation.
 
+Template: cdrom-detect/try-usb
+Type: boolean
+Description: for internal use only
+ Preseed this to true to try to mount /cdrom from USB partitions.
+
 Template: cdrom-detect/no-release
 Type: error
 # Translators: DO NOT TRANSLATE "Release". This is the name of a file.

=== modified file 'debian/changelog'
--- debian/changelog	2008-09-21 21:55:47 +0000
+++ debian/changelog	2008-12-05 19:57:03 +0000
@@ -1,3 +1,14 @@
+cdrom-detect (1.31) UNRELEASED; urgency=low
+
+  * Merge from Ubuntu:
+    - Try to find an image on every CD device, not just the first.
+    - allow installation from USB media with CD contents
+      - enabled if template cdrom-detect/try-usb=true
+      - probe vfat partitions on USB drives
+  * Bump the dependency on di-utils to 1.66 for the above change.
+
+ -- Evan Dandrea <evand@ubuntu.com>  Fri, 05 Dec 2008 11:44:43 -0800
+
 cdrom-detect (1.30) unstable; urgency=low
 
   [ Updated translations ]

=== modified file 'debian/control'
--- debian/control	2008-04-08 11:22:07 +0000
+++ debian/control	2008-12-05 19:43:35 +0000
@@ -10,6 +10,6 @@
 Package: cdrom-detect
 XC-Package-Type: udeb
 Architecture: all
-Depends: ${misc:Depends}, hw-detect, di-utils (>= 1.48)
+Depends: ${misc:Depends}, hw-detect, di-utils (>= 1.66)
 XB-Installer-Menu-Item: 1300
 Description: Detect CDROM devices and mount the CD

=== modified file 'debian/changelog'
--- debian/changelog	2008-09-29 18:30:48 +0000
+++ debian/changelog	2008-12-05 19:40:21 +0000
@@ -1,3 +1,11 @@
+debian-installer-utils (1.66) UNRELEASED; urgency=low
+
+  * Merge from Ubuntu:
+    - list-devices: new "usb-partition" type for detecting partitions on USB
+      drives.
+
+ -- Evan Dandrea <evand@ubuntu.com>  Fri, 05 Dec 2008 11:38:33 -0800
+
 debian-installer-utils (1.65) unstable; urgency=low
 
   * When looking for partitions, only consider device subdirectories that end

=== modified file 'list-devices'
--- list-devices	2008-09-29 18:22:57 +0000
+++ list-devices	2008-12-05 19:37:11 +0000
@@ -6,9 +6,9 @@
 	logger -t list-devices "deprecated parameter maybe-floppy"
 	TYPE=floppy
 	;;
-    cd|disk|partition|floppy|maybe-usb-floppy) ;;
+    cd|disk|partition|floppy|maybe-usb-floppy|usb-partition) ;;
     *)
-	echo "Usage: $0 cd|disk|partition|floppy|maybe-usb-floppy" >&2
+	echo "Usage: $0 cd|disk|partition|floppy|maybe-usb-floppy|usb-partition" >&2
 	exit 2
 	;;
 esac
@@ -40,6 +40,12 @@
 	# Also allow misdetected USB devices
 	scan_partition=:
 	;;
+    usb-partition)
+       for x in /sys/block/*/*; do
+               [ -d "$x" ] || continue
+               syspaths="${syspaths:+$syspaths }$x"
+       done
+       ;;
     *)
 	for x in /sys/block/*; do
 		[ -d "$x" ] || continue
@@ -85,6 +91,13 @@
 			match=:
 		fi
 	fi
+	# Disk partitions, but only on USB drives
+	if ! $match && [ "$TYPE" = usb-partition ]; then
+	       if device_info env "$devpath" | grep -q '^ID_BUS=usb' && \
+		  device_info env "$devpath" | grep -q '^ID_TYPE=disk'; then
+		       match=:
+	       fi
+	fi
 	if $match; then
 		if ! name="$(device_info name "$devpath")"; then
 			name="$(printf %s "${devpath##*/}" | \

=== modified file 'debian/changelog'
--- debian/changelog	2008-09-22 00:48:37 +0000
+++ debian/changelog	2008-12-06 00:16:06 +0000
@@ -1,3 +1,12 @@
+apt-setup (1:0.41) UNRELEASED; urgency=low
+
+  * Merge from Ubuntu:
+    - Check to make sure the CD filesystem is iso9660 before remounting it as
+      such.  Do not write a CD identifier if we're not working with iso9660
+      so pkgsel does not try to unmount such disks.
+
+ -- Evan Dandrea <evand@ubuntu.com>  Fri, 05 Dec 2008 16:15:08 -0800
+
 apt-setup (1:0.40) unstable; urgency=low
 
   [ Colin Watson ]

=== modified file 'generators/40cdrom'
--- generators/40cdrom	2008-09-18 11:00:54 +0000
+++ generators/40cdrom	2008-12-06 00:14:02 +0000
@@ -9,8 +9,14 @@
 	exit 0
 fi
 
+cdfstype=$(mount | grep "on /cdrom " | cut -d' ' -f5)
+isofs=
+if [ "$cdfstype" = "iso9660" ]; then
+	isofs=1
+fi
+
 remount_cd() {
-	if [ "$ROOT" ] && [ ! -d /hd-media ]; then
+	if [ "$ROOT" ] && [ -n "$isofs" ] && [ ! -d /hd-media ]; then
 		db_get cdrom-detect/cdrom_device
 		$logoutput mount -t iso9660 -o ro,exec $RET /cdrom || true
 	fi
@@ -52,7 +58,7 @@
 
 	# Allow apt-cdrom to manage mounting/unmounting CDs in /target
 	# (except for hd-media installs)
-	if [ ! -d /hd-media ]; then
+	if [ ! -d /hd-media ] && [ -n "$isofs" ]; then
 		rm -f $ROOT/etc/apt/apt.conf.d/00NoMountCDROM
 
 		# Also removes the bind-mount in /target
@@ -68,7 +74,7 @@
    </dev/null; then
 	cat $ROOT$tmp >> $file
 
-	if [ "$ROOT" ] && [ ! -d /hd-media ]; then
+	if [ "$ROOT" ] && [ -n "$isofs" ] && [ ! -d /hd-media ]; then
 		save_label
 	fi
 else

=== modified file 'debian/changelog'
--- debian/changelog	2008-09-22 01:13:33 +0000
+++ debian/changelog	2008-12-06 00:24:08 +0000
@@ -1,3 +1,10 @@
+partman-target (59) UNRELEASED; urgency=low
+
+  * Merge from Ubuntu:
+    - Remove the cdrom mounpoint if the filesystem is not iso9660 or udf.
+
+ -- Evan Dandrea <evand@ubuntu.com>  Fri, 05 Dec 2008 16:23:44 -0800
+
 partman-target (58) unstable; urgency=low
 
   [ Giuseppe Iuculano ]

=== added file 'debian/partman-target.install'
--- debian/partman-target.install	1970-01-01 00:00:00 +0000
+++ debian/partman-target.install	2008-12-06 00:31:26 +0000
@@ -0,0 +1,1 @@
+finish-install.d usr/lib

=== added directory 'finish-install.d'
=== added file 'finish-install.d/02remove_broken_cdrom'
--- finish-install.d/02remove_broken_cdrom	1970-01-01 00:00:00 +0000
+++ finish-install.d/02remove_broken_cdrom	2008-12-06 00:23:07 +0000
@@ -0,0 +1,16 @@
+#!/bin/sh
+while read line; do
+       set -- $line
+        if echo "$2" | grep -qs "\(/cdrom\|/media/cdrom\)"; then
+                fs="$(PATH="/lib/udev:$PATH" vol_id --type "$1" || true)"
+                if [ -n "$fs" ] && [ "$fs" != "iso9660" ] && [ "$fs" != "udf" ]; then
+
+                        :
+                else
+                        echo "$line"
+                fi
+        else
+                echo "$line"
+        fi
+done < /target/etc/fstab > /target/etc/fstab.new
+mv /target/etc/fstab.new /target/etc/fstab


Reply to: