Hi, I've had another swing at patching cdrom-detect to handle the case where $suite never gets set. This patch (v3) is a svn diff against svn://svn.debian.org/d-i/trunk.
After poring over the docs for some time I still am not sure how to give user feedback, ie the correct use of db_subst, db_input, db_go. Any guidance would be welcome. I noticed that iso-scan makes the same assumption about $suite being set. When is that normally run - in expert mode? Cheers Vince
Index: d-i/packages/cdrom-detect/debian/cdrom-detect.templates =================================================================== --- d-i/packages/cdrom-detect/debian/cdrom-detect.templates (revision 22073) +++ d-i/packages/cdrom-detect/debian/cdrom-detect.templates (working copy) @@ -74,6 +74,29 @@ . Please insert a Debian CD to continue with the installation. +Template: cdrom-detect/select-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 then select the correct value from + the list. Choose "none" to give up. + +Template: cdrom-detect/no-suite +Type: error +_Description: Unable to determine package suite + cdrom-detect can't tell if this CD has stable, testing, or unstable packages. + . + The CD may be corrupt. + Please do a network install instead, or try another CD. + +Template: cdrom-detect/suite-success +Type: note +_Description: Successfully detected the Release file + cdrom-detect successfully detected the Release file for the ${suite} suite + of packages. + Template: mirror/suite Type: select _Choices: stable, testing, unstable Index: d-i/packages/cdrom-detect/debian/cdrom-detect.postinst =================================================================== --- d-i/packages/cdrom-detect/debian/cdrom-detect.postinst (revision 22073) +++ d-i/packages/cdrom-detect/debian/cdrom-detect.postinst (working copy) @@ -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 @@ -174,6 +175,46 @@ 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 later steps, eg cdrom-retriever. +# But first give common sense a chance +if [ "none" = "$suite" ] ; then + log "Can't tell if this CD has stable, testing or unstable packages" + + while true ; do + + db_input critical cdrom-detect/select-suite || [ $? -eq 30 ] + db_go + db_get cdrom-detect/select-suite + suite="$RET" + + if [ "none" = "$suite" ] ; then + db_input critical cdrom-detect/no-suite || true + log "Unmounting CD just to be sure and giving it up." + umount /cdrom 2>/dev/null || true + unset $suite + + fail + fi + + relfile=/cdrom/dists/$suite/Release + if [ -e $relfile ] ; then + log "Detected the Release file for the $suite suite" + db_subst cdrom-detect/suite-success suite $suite + db_input low cdrom-detect/suite-success || [ $? -eq 30 ] + db_go + + break + else + log "File $relfile not detected, trying again" + fi + done + db_set mirror/suite $suite +fi + + # Ask for eject to be installed into /target/, to be able to use it in # the prebaseconfig script. apt-install eject || true