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

Bug#594344: Patch to set codename and suite when /cdrom premounted



Package: debian-installer
Severity: normal

Enclosed is a patch to set cdrom/codename and cdrom/suite when /cdrom is found
premounted.

I wonder, though, if some of the other steps later on (after the exit 0 when a
premounted /cdrom is found) might be also useful to do, such as validating the
Release file, precaching, and falling back to looking for a mirror when all
else fails.  But this patch will at least allow debian-installer-launcher to
work in what I hope is a fairly unintrusive way.

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (900, 'testing'), (800, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-5-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
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 <synrg@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)
@@ -64,6 +82,7 @@
 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 to: