Meh. I just realized I omitted one line I had fixed inside my test image, but not in my svn workspace. Updated patch attached. Sorry about that.

Index: debian/changelog
===================================================================
--- debian/changelog	(revision 64584)
+++ debian/changelog	(working copy)
@@ -1,3 +1,10 @@
+cdrom-detect (1.35+nmu1) UNRELEASED; urgency=low
+
+  * Non-maintainer upload.
+  * Set cdrom/suite and cdrom/codename when premounted /cdrom found.
+
+ -- Ben Armstrong <sy...@sanctuary.nslug.ns.ca>  Thu, 02 Sep 2010 05:43:10 -0300
+
 cdrom-detect (1.35) UNRELEASED; urgency=low
 
   [ Samuel Thibault ]
Index: debian/cdrom-detect.postinst
===================================================================
--- debian/cdrom-detect.postinst	(revision 64584)
+++ debian/cdrom-detect.postinst	(working copy)
@@ -39,6 +39,24 @@
 	return $ret
 }
 
+# Set the suite and codename used by base-installer and base-config
+# to the suite/codename that is on the CD. In case there are multiple
+# suites, prefer the one in default-release.
+set_suite_and_codename() {
+	for dir in $(cat /etc/default-release) $(ls -1 /cdrom/dists/); do
+		relfile="/cdrom/dists/$dir/Release"
+		if [ -e $relfile ]; then
+			suite=$(sed -n 's/^Suite: *//p' "$relfile")
+			codename=$(sed -n 's/^Codename: *//p' "$relfile")
+			log "Detected CD with '$suite' ($codename) distribution"
+			db_set cdrom/suite "$suite"
+			db_set cdrom/codename "$codename"
+
+			break
+		fi
+	done
+}
+
 OS=$(udpkg --print-os)
 case "$OS" in
 	kfreebsd)
@@ -60,10 +78,11 @@
 esac
  
 # Is a cdrom already mounted? If so, assume it's the right one.
-mount | grep -q 'on /cdrom' && exit 0
+mount | grep -q 'on /cdrom' && set_suite_and_codename && exit 0
 if [ -e /cdrom/.disk/info ]; then
 	CDNAME=$(cat /cdrom/.disk/info)
 	log "Detected CD '$CDNAME'"
+	set_suite_and_codename
 	exit 0
 fi
 
@@ -201,22 +220,8 @@
 done
 db_progress STOP
 
-# Set the suite and codename used by base-installer and base-config
-# to the suite/codename that is on the CD. In case there are multiple
-# suites, prefer the one in default-release.
-for dir in $(cat /etc/default-release) $(ls -1 /cdrom/dists/); do
-	relfile="/cdrom/dists/$dir/Release"
-	if [ -e $relfile ]; then
-		suite=$(sed -n 's/^Suite: *//p' "$relfile")
-		codename=$(sed -n 's/^Codename: *//p' "$relfile")
-		log "Detected CD with '$suite' ($codename) distribution"
-		db_set cdrom/suite "$suite"
-		db_set cdrom/codename "$codename"
+set_suite_and_codename
 
-		break
-	fi
-done
-
 if [ -z "$suite" ]; then
 	log "Error reading Release file; unable to determine distribution"
 	db_input critical cdrom-detect/no-release || [ $? -eq 30 ]

Reply via email to