• Bug#267219: Why just floppy, why not USB stick.

    From Osamu Aoki@1:229/2 to All on Sat Aug 21 10:10:09 2004
    XPost: linux.debian.maint.boot
    From: [email protected]

    --NzB8fVQJ5HfG6fxh
    Content-Type: text/plain; charset=us-ascii
    Content-Disposition: inline
    Content-Transfer-Encoding: quoted-printable

    Package: bugreporter-udeb
    Version: 0.27
    Severity: wishlist
    Tags: patch, d-i

    Hi,

    As you all know, there are more PC with USB port than one with floppy
    drive these days. But, bugreporter-udeb try to save data in floppy.

    As I start playing d-i, I realized pluging in empty vfat formatted USB
    key before hw-detect was very convienient way to get log out. I just
    mount a scsi device which happen to be USB key.

    THis can be done with any USB storage such as USB HDD.

    Can we do the same for bugreporter-udeb? I used init code from rootskel/src-bootfloppy and updated bugreporter-udeb.postinst script (no testing yet). This will not only mount floppy but any USB key (or USB
    storage) devices formatted with vfat partition and save log there. Also
    this now create new directory so old report will not be overwritte.

    Code (untested) is short and attached.

    Code review or your thought is appreciated.

    This should address practical functional issues of "USB floppy not
    detected" since you can plug in USB key to get data out. #220306, #221575

    BTW, where the USB floppies show up? These bugs may even be taken care
    with the followng code for current code:

    find /dev/scsi -name 'part?'||true

    (I am sure removing -name 'part?' will take care but makes less
    efficient.) Hmmm... this seem to really fix these bugs too.

    Osamu

    PS: I found minor efficiency bug in rootskel/src-bootfloppy

    PPS: I guess I need to update Release file in CD too to get it working.
    But what else is needed to replace udeb in netinst CD? I need to test
    this udeb. Doing upkg -i bugreporter-udeb* from console while $PWD on /cdrom/..../bugreporter-udeb* is sufficient?


    --NzB8fVQJ5HfG6fxh
    Content-Type: text/plain; charset=us-ascii
    Content-Disposition: attachment; filename="bugreporter-udeb.postinst" Content-Transfer-Encoding: quoted-printable

    #!/bin/sh -e

    . /usr/share/debconf/confmodule

    log() {
    logger -t bugreporter-udeb -p user.debug "$@"
    }

    if [ "" = "$DILOGDIR" ]; then
    DILOGDIR=/var/log/
    fi
    # make sure we have a directory
    if [ ! -d $DILOGDIR ]; then
    mkdir -p $DILOGDIR
    fi

    copy_cdebconf_db() {
    destdir="$1"
    # Save database to disk
    # kill -? <pid-of-debconf>
    cp -a /var/lib/cdebconf "$destdir"
    }

    db_input critical bugreporter-udeb/insert_floppy || [ $? -eq 30 ]
    db_go

    # generate files with HW info, debconf database info etc, and store
    # them in $DILOGDIR
    db_progress START 0 3 debian-installer/bugreporter-udeb/title

    /bin/package-versions > $DILOGDIR/package-versions
    db_progress STEP 1

    /bin/report-hw > $DILOGDIR/hardware-summary
    db_progress STEP 1

    # Mostly copied from rootskel/src-bootfloppy. [2004-08-20]
    mountfloppy() {
    # Try mounting USB memory key
    if [ -x /usr/sbin/usb-discover ]; then
    /usr/sbin/usb-discover
    fi
    # This is currently needed or usb-storage won't load (for ide_fix_driveid).
    modprobe ide-core >/dev/null
    modprobe usb-storage >/dev/null
    modprobe sd_mod >/dev/null
    MOUNTED=0
    while [ "$MOUNTED" = 0 ]; do
    DEVS=""
    if [ -d /dev/floppy ]; then
    # Should I keep /dev/floppy/?
    DEVS=/dev/floppy/0
    fi
    # Assuming USB storage partition to be formated with vfat partition
    if [ -d /dev/scsi ]; then
    DEVS="$DEVS `find /dev/scsi -name 'part?'||true`"
    fi

    ERR=""
    for dev in $DEVS; do
    if [ "$MOUNTED" = 0 ] && [ -b $dev ]; then
    # Use /floppy as mount point even if USB storage.
    if mount $dev -o rw -tvfat /floppy 2>/dev/null; then
    MOUNTED=1
    else
    ERR="$ERR $dev: cannot mount"
    umount /floppy 2>/dev/null || true
    fi
    fi
    done

    if [ "$MOUNTED" = 0 ]; then
    if [ -n "$ERR" ]; then
    # ERR begins with a semicolon
    log "Cannot find $ERR"
    else
    log "No devices found!"
    fi
    exit 1
    fi
    log "Mounted floppy: $dev"
    return 0
    }

    test -d /floppy || mkdir /floppy
    umount /floppy 2>/dev/null || true

    if mountfloppy ; then
    log "Floppy or USB storage mounted on /floppy"
    # Since USB key is big, let's try to many several install logs there.
    for i in
    00 01 02 03 04 05 06 07 08 09 \
    10 11 12 13 14 15 16 17 18 19 \
    20 21 22 23 24 25 26 27 28 29 END ; do
    LOGDIR=debian${i}
    if [ ! -e "$LOGDIR" ] ; then
    break
    fi
    if [ "$i" = "END" ] ; then
    log "No space in the storage media."
    exit 1
    fi
    done
    log "Save d-i install logs to $LOGDIR"
    mkdir /floppy/$LOGDIR
    for file in \
    /var/log/messages \
    /var/log/syslog \
    /var/log/partman \
    $DILOGDIR/hardware-summary \
    $DILOGDIR/package-versions; do
    if [ -e $file ]; then
    cp $file /floppy/$LOGDIR/
    fi
    done

    umount /floppy 2>/dev/null || true
    db_progress STEP 1
    db_progress STOP
    else
    db_progress STEP 1
    db_progress STOP
    db_input critical bugreporter-udeb/no_floppy || [ $? -eq 30 ]
    db_go
    fi

    --NzB8fVQJ5HfG6fxh--

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.5 (GNU/Linux)

    iD8DBQFBJwGh6A/EwagGHzIRAjpVAJsGLUbwyeLwuUVgtnmjAxorda+A0wCeIaa+ A4FfESSUdLXfib1+kB2CL9o=
    =6D28
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)