Bug#271976: trial patch: cdrom-detect
package: cdrom-detect
severity: normal
I reported in #265636 that is was possible for cdrom-detect to
exit with status 0 but with the $suite variable (later used by
cdrom-retriever) unset.
Attached are two different attempts to detects that $suite is unset
and deal with this.
The first just causes cdrom-detect to return a failure code.
I would like for it not to give up, so in version 2 I've made a stab
at getting the user to tell cdrom-detect the right value.
This introduces extra template text, which may not be acceptable at
this stage in the release process, I dunno.
I don't know how to test these myself, with a local d-i tree, but I'm
happy to test iso images that incorporate the patches.
Cheers
Vince
--- packages.orig/cdrom-detect/debian/cdrom-detect.postinst Fri Sep 17 01:13:38 2004
+++ packages/cdrom-detect/debian/cdrom-detect.postinst Fri Sep 17 01:12:10 2004
@@ -174,6 +174,20 @@
fi
done
+# the loop above could exit without finding a Release file,
+# and therefore never setting $suite.
+# If this happens, something is seriously wrong. We should fail here
+# instead of getting mysterious failures in cdrom-retriever.
+if [ -z "$suite" ] ; then
+ log "I can't tell if this CD has stable, testing or unstable packages"
+
+ log "Unmounting CD just to be sure and giving it up."
+ umount /cdrom 2>/dev/null || true
+
+ fail
+fi
+
+
# Ask for eject to be installed into /target/, to be able to use it in
# the prebaseconfig script.
apt-install eject || true
diff -ruN packages.orig/cdrom-detect/debian/cdrom-detect.postinst packages/cdrom-detect/debian/cdrom-detect.postinst
--- packages.orig/cdrom-detect/debian/cdrom-detect.postinst Fri Sep 17 01:13:38 2004
+++ packages/cdrom-detect/debian/cdrom-detect.postinst Fri Sep 17 01:12:10 2004
@@ -163,6 +163,7 @@
# testing, stable, or unstable links will point to it. Since the
# CDs currently have many links, parse the Release file to get the
# actual suite name to use.
+suite=none
for distlink in stable testing unstable ; do
relfile=/cdrom/dists/$distlink/Release
if [ -e $relfile ] ; then
@@ -173,6 +174,30 @@
break
fi
done
+
+# the loop above could exit without finding a Release file,
+# and therefore never setting $suite.
+# If this happens, something is seriously wrong. We should fail here
+# instead of getting mysterious failures in cdrom-retriever.
+# But first give common sense a chance
+if [ "none" = "$suite" ] ; then
+ log "I can't tell if this CD has stable, testing or unstable packages"
+
+ db_input critical cdrom-detect/suite || [ $? -eq 30 ]
+ db_go
+ db_get cdrom-detect/suite
+ suite="$RET"
+
+ if [ "none" = "$suite" ] ; then
+ log "Unmounting CD just to be sure and giving it up."
+ umount /cdrom 2>/dev/null || true
+
+ fail
+ else
+ db_set mirror/suite $suite
+ fi
+fi
+
# Ask for eject to be installed into /target/, to be able to use it in
# the prebaseconfig script.
diff -ruN packages.orig/cdrom-detect/debian/cdrom-detect.templates packages/cdrom-detect/debian/cdrom-detect.templates
--- packages.orig/cdrom-detect/debian/cdrom-detect.templates Fri Sep 17 01:13:38 2004
+++ packages/cdrom-detect/debian/cdrom-detect.templates Fri Sep 17 01:13:16 2004
@@ -74,6 +74,14 @@
.
Please insert a Debian CD to continue with the installation.
+Template: cdrom-detect/suite
+Type: select
+_Choices: stable, testing, unstable, none
+_Description: Unable to determine package suite
+ cdrom-detect can't tell if this CD has stable, testing, or unstable packages.
+ .
+ Please inspect the CD from a shell and tell me which is the correct value.
+
Template: mirror/suite
Type: select
_Choices: stable, testing, unstable
Reply to: