tags 265636 patch On Tue, Aug 17, 2004 at 08:28:41AM +0100, Joey Hess wrote: > Osamu Aoki wrote: > > Proposed ERRATA: ... > We have plenty of time to fix cdrom-detect before rc2 without resorting > to ugly errata like that. I'd rather turn off DMA for all CDs than have > that errata, personally. OK. I was afraid of my TeX/LaTeX related FTBFS RC bugs burning my time. I got patch from Atsuhito Kohda and I am happy :) > > +elif [ ! -e "/cdrom/dists/$suite/Release" ]; then > > + log "No such file '/cdrom/dists/$suite/Release'. Is the cdrom OK?" > > + fail > > +fi > > Couldn't it retry the mount if the Release file was not found, rather > than immediatly failing? If you want equivalent of such behaviour, just enable commented out codes after applying patch. That is the low impact solution. But this code is getting messy if I add code to loop for this. On the other hand, proper solution seems clean up of existing while-loop structure and error handling in a consistent way. Since I moved many codes, patch is bigger than original file. So I attach file itself. This worked on my DELL and normal PC. Somehow DELL caused mount error instead of quiet symlink failure. But code should detect it too. Manual module and floppy has not been tested. Quiet retry number can be adjusted but code around it needs careful proofing since this is just my quick hack. Also some indentation clean up will be nice. Osamu I will put my hacked RC1 image with this change in http://people.debian.org/~osamu/pub/sarge-i386-netinst-rc1-hacked.iso (Please wait for its upload in about 90 min.)
#! /bin/sh
set -e
. /usr/share/debconf/confmodule
#set -x
log() {
logger -t cdrom-detect "$@"
}
fail () {
log "$@"
db_input critical cdrom-detect/failure || [ $? -eq 30 ]
db_go
# redundant but to be sure
umount /cdrom 2>/dev/null || true
exit 1
}
hw-detect cdrom-detect/detect_progress_title || true
log "Searching for Debian installation media..."
maxmount=2 # max count of the mount try
imount=0 # mount counter
while true
do
if [ "$imount" -gt "$maxmount" ] ; then
fail "Tried to mount CD $maxmount times and failed."
fi
# Is a cdrom (image) already mounted at /cdrom? Sanity check!
if [ ! -e /cdrom ] ; then
# First run of cdrom-detect
mkdir /cdrom 2>/dev/null || true
elif [ -e /cdrom/.disk/info ] ; then
# Second run or looped after cdrom mount
CDNAME=`cat /cdrom/.disk/info`
log "Detected CD '$CDNAME'"
# Sanity check of CD
# Set the suite used by base-installer and base-config to
# the suite that is on the CD. This assumes that there will
# be no more than one distribution on the CD, and that one of the
# 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.
for distlink in stable testing unstable ; do
relfile=/cdrom/dists/$distlink/Release
if [ -e $relfile ] ; then
suite=$(sed -n 's/^Suite: *//p' $relfile)
log "Detected CD with '$suite' distribution"
db_set mirror/suite $suite
break # for distlink loop
fi
done
if [ "X" = "X${suite}" ]; then
log "Could not determine the package 'suite'. Is the cdrom OK?"
umount /cdrom 2>/dev/null || true
continue
elif [ ! -e "/cdrom/dists/$suite/Release" ]; then
log "No such file '/cdrom/dists/$suite/Release'. Is the cdrom OK?"
umount /cdrom 2>/dev/null || true
continue
fi
# successful mount, exit while loop
break
elif mount | grep -q 'on /cdrom ' ; then
log "The available CD is not a Debian CD!"
umount /cdrom 2>/dev/null || true
db_input critical cdrom-detect/wrong-cd || [ $? -eq 30 ]
db_go
imount=$((${imount}-1))
continue
fi
# mount CD
imount=$((${imount}+1))
# Auto detect CDROM by devfs
if [ -d /dev/cdroms ]; then
devices="`echo /dev/cdroms/*`"
else
devices=""
fi
mounted=0 # flag for having mounted CD
for device in $devices
do
if mount -t iso9660 -o ro,exec $device /cdrom; then
log "CDROM-mount succeeded: device=$device"
mounted=1
db_set cdrom-detect/cdrom_device $device
break # for device loop
else
log "CDROM-mount failed (error=$?): device=$device"
log "Unmounting CD just to be sure."
umount /cdrom 2>/dev/null || true
fi
done
if [ "$mounted" = "1" ]; then
continue
fi
# If a device was detected but the mount failed, ask for the CD.
if [ -n "$devices" ]; then
log "CDROM device was detected but the mount failed."
db_input critical cdrom-detect/retry || [ $? -eq 30 ]
db_go
db_get cdrom-detect/retry
if [ "$RET" = "true" ]; then
imount=$((${imount}-1))
continue
else
fail "a device was detected but the mount failed."
fi
fi
# Mount floppy if CD auto detect fails
# If no device was detected, perhaps a driver floppy is needed.
if [ -e /usr/lib/debian-installer/retriever/floppy-retriever ]; then
db_input critical cdrom-detect/load_floppy
db_go
db_get cdrom-detect/load_floppy
if [ "$RET" = true ]; then
anna floppy-retriever
hw-detect cdrom-detect/detect_progress_title || true
continue
fi
fi
# Otherwise manual configuration may be needed
db_input critical cdrom-detect/manual_config || [ $? -eq 30 ]
db_go
db_get cdrom-detect/manual_config
modules=none
for i in `ls -1 /lib/modules/*/kernel/drivers/cdrom/ | sed 's/\.ko$//' | sed 's/\.o$//'`
do
modules="$modules, $i"
done
if [ "$RET" = "true" ]; then
db_subst cdrom-detect/cdrom_module choices "$modules"
db_input critical cdrom-detect/cdrom_module || [ $? -eq 30 ]
db_go
db_get cdrom-detect/cdrom_module
module="$RET"
db_input critical cdrom-detect/cdrom_device || [ $? -eq 30 ]
db_go
db_get cdrom-detect/cdrom_device
device="$RET"
if [ "$module" != "none" ]; then
modprobe $module
fi
if mount -t iso9660 -o ro,exec $device /cdrom; then
log "CDROM-mount succeeded: device=$device"
mounted=1
else
log "CDROM-mount failed (error=$?): device=$device"
log "Unmounting CD just to be sure and giving it up."
umount /cdrom 2>/dev/null || true
fi
continue
else
fail "Manual CD mount refused."
fi
done
# Ask for eject to be installed into /target/, to be able to use it in
# the prebaseconfig script.
apt-install eject || true
# Hey, we're done
db_subst cdrom-detect/success cdname "$CDNAME"
db_input low cdrom-detect/success || [ $? -eq 30 ]
db_go
exit 0
Attachment:
signature.asc
Description: Digital signature