Package: memtest86+
Version: 1.65-1
Followup-For: Bug #412255

Patch and fixed copy of the make-memtest86+-boot-floppy script
(well, It Works For Me) for the convenience of stable Etch users.

-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i586)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18.hurakan
Locale: LANG=en_GB, LC_CTYPE=en_GB (charmap=ISO-8859-1)

-- no debconf information

-- 
JBR
Ankh kak! (Ancient Egyptian blessing)
#!/bin/sh
#
# Script for making a memtest86 boot floppy using GRUB as bootloader
#

# (c) 2003 Peter Loje Hansen <[EMAIL PROTECTED]>
#  - original version
# (c) 2004 Yann Dirson <[EMAIL PROTECTED]>
#  - added parameters
#  - ability to work on a floppy image instead of a real floppy
#  - adapted patches from Martin Koeppe <[EMAIL PROTECTED]>, to use
#    mtools and install full grub

# TODO:
# - add a flag to generate a default boot entry for (hd0)

set -e

MEMTEST=/boot/memtest86+.bin
FLOPPYIMAGE=/dev/fd0

error()
{
    echo >&2 "$0: $*"
    exit 1
}

needsarg()
{
    [ $1 -ge 2 ] || error "syntax error"
}

[ -d /usr/lib/grub ] || error "Can't find /usr/lib/grub - did you install a 
recent grub package (0.95+cvs20040624 or later) ?"
[ -x /usr/bin/mformat ] || error "Can't find mformat - did you install the 
mtools package ?"

while [ $# -gt 0 ]
do
    case "$1" in
    --help) echo "$0 [--memtest $MEMTEST] [--floppyimage $FLOPPYIMAGE]"; exit 0 
;;
    --memtest) needsarg $#; MEMTEST="$2"; shift ;;
    --floppyimage) needsarg $#; FLOPPYIMAGE="$2"; shift ;;
    *) error "syntax error" ;;
    esac
    shift
done

MOUNTPOINT=$(mktemp -d)

if [ -b "$FLOPPYIMAGE" ]
then
    FINALDEV="$FLOPPYIMAGE"
    FLOPPYIMAGE="$(mktemp)"
else
    FINALDEV=""
fi

echo "* Creating msdos file system"
echo
if [ ! -s "$FLOPPYIMAGE" ]; then
    # unless a non-empty image exists, create a blank one first
    dd bs=1024 count=1440 if=/dev/zero of="$FLOPPYIMAGE"
fi
# FIXME: "-f 1440" should probably be dropped
mformat -i $FLOPPYIMAGE -f 1440 :: 

mmd -i $FLOPPYIMAGE ::/boot 
mmd -i $FLOPPYIMAGE ::/boot/grub 

echo
echo "* Installing GRUB files"
mcopy -v -i "$FLOPPYIMAGE" - ::/boot/grub/menu.lst <<EOF
color green/black light-green/black
default 0
timeout 10
title  memtest
kernel (fd0)/boot/memtest.bin
EOF
#mcopy -v -i "$FLOPPYIMAGE" /lib/grub/i386-pc/stage? ::/boot/grub 
mcopy -v -i "$FLOPPYIMAGE" /usr/lib/grub/i386-pc/* ::/boot/grub 

echo
echo "* Installing $MEMTEST"
mcopy -v -i "$FLOPPYIMAGE" "$MEMTEST" ::/boot/memtest.bin 

echo
echo -n "* Installing GRUB"
/usr/sbin/grub --batch --device-map=/dev/null <<EOF
device (fd0) $FLOPPYIMAGE
root (fd0)
setup (fd0)
quit
EOF

if [ -n "$FINALDEV" ]; then
    echo
    echo "Insert a writable floppy for $FINALDEV and press enter"
    read FOO

    dd bs=1024 if="$FLOPPYIMAGE" of="$FINALDEV"
    rm "$FLOPPYIMAGE"
fi
diff -ruN memtest86+-1.65.orig/debian/make-memtest86+-boot-floppy memtest86+-1.65/debian/make-memtest86+-boot-floppy
--- memtest86+-1.65.orig/debian/make-memtest86+-boot-floppy	2007-03-21 16:23:36.000000000 +0000
+++ memtest86+-1.65/debian/make-memtest86+-boot-floppy	2007-03-21 16:25:40.000000000 +0000
@@ -30,7 +30,7 @@
     [ $1 -ge 2 ] || error "syntax error"
 }
 
-[ -d /lib/grub ] || error "Can't find /lib/grub - did you install a recent grub package (0.95+cvs20040624 or later) ?"
+[ -d /usr/lib/grub ] || error "Can't find /usr/lib/grub - did you install a recent grub package (0.95+cvs20040624 or later) ?"
 [ -x /usr/bin/mformat ] || error "Can't find mformat - did you install the mtools package ?"
 
 while [ $# -gt 0 ]
@@ -76,7 +76,7 @@
 kernel (fd0)/boot/memtest.bin
 EOF
 #mcopy -v -i "$FLOPPYIMAGE" /lib/grub/i386-pc/stage? ::/boot/grub 
-mcopy -v -i "$FLOPPYIMAGE" /lib/grub/i386-pc/* ::/boot/grub 
+mcopy -v -i "$FLOPPYIMAGE" /usr/lib/grub/i386-pc/* ::/boot/grub 
 
 echo
 echo "* Installing $MEMTEST"
@@ -84,7 +84,7 @@
 
 echo
 echo -n "* Installing GRUB"
-/sbin/grub --batch --device-map=/dev/null <<EOF
+/usr/sbin/grub --batch --device-map=/dev/null <<EOF
 device (fd0) $FLOPPYIMAGE
 root (fd0)
 setup (fd0)

Reply via email to