#!/bin/sh

#     DESCRIPTION
#
# Copy memtest program to work (image) chroot.
# memtest called from bootloader boot menu.
# Used in isolinux.cfd file


#     REQUIRES
#
# Install to instrumental chroot package memtest86+


#     INFO
# $ rpm -qpl /raid/ALT/Sisyphus/files/x86_64/RPMS/memtest86+-2.01-alt1.x86_64.rpm 
# /boot/memtest-2.01.bin
# /usr/sbin/installmemtest86+
# /usr/share/doc/memtest86+-2.01
# /usr/share/doc/memtest86+-2.01/FAQ
# /usr/share/doc/memtest86+-2.01/README
# /usr/share/doc/memtest86+-2.01/README.build-process

NAME="memtest"

verbose()
{
    if [ -n "$GLOBAL_VERBOSE" ]; then
        echo "HOOK: $NAME: $@"
    fi
}

MEMTEST="$(find /boot/ -name 'memtest*' -print -quit)"

verbose "has started"

mkdir -p "$WORKDIR"/syslinux

if [ -n "$MEMTEST" ]; then
    verbose "Found memtest, copy them to image chroot"
    cp -f "$MEMTEST" "$WORKDIR"/syslinux/memtest
else
    verbose "Can't found memtest in instrumental chroot. Did you install memtest86+ package?"
fi

verbose "finished"
