1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#!/bin/sh
. /usr/share/debconf/confmodule
FLOPPYMNT=/floppy
ask_dev() {
DEVS=""
for dev in `find /dev/floppy /dev/scsi /dev/ide /dev/disc`; do
# TODO if sfdisk or something similar were available, we could
# do this:
# SIZE=sfdisk -s $DEV
# if [ "$SIZE" -eq '1440' -o "$SIZE" -eq '2880' ]; then
if [ -b "$dev" ]; then
if [ -z "$DEVS" ]; then
DEVS="$dev"
else
DEVS="$DEVS, $dev"
fi
fi
done
db_subst retriever/floppy/device DEVS $DEVS
db_input high retriever/floppy/device
db_go
db_get retriever/floppy/device
if [ "$RET" = Cancel ]; then
exit 1
fi
echo $RET
}
if ! mount | cut -d' ' -f3 | grep -q '^/floppy$'; then
# This is a good reasonable default, but will fail for
# USB floppys.
FLOPPYDEV=/dev/floppy/0
if [ ! -e $FLOPPYDEV ]; then
modprobe floppy >> /var/log/messages 2>&1 || true
fi
if ! grep -q ^vfat /proc/modules ; then
modprobe vfat >> /var/log/messages 2>&1 || true
fi
if [ ! -e "$FLOPPYDEV" ] || ! mount $FLOPPYDEV -tauto $FLOPPYMNT; then
# Cannot find a device, or found the wrong device.
# Ask for help from the user and try it again.
FLOPPYDEV=$(ask_dev)
mount $FLOPPYDEV -tauto $FLOPPYMNT
fi
fi
|