#!/bin/bash
if [ -d /sys/firmware/efi ]; then
echo "memtest86+ does not support EFI platforms."
exit 254
fi
MTVERSION=`rpm -q --qf '%{version}' memtest86+`
MTPATH="/boot/memtest86+-$MTVERSION"
/sbin/grubby --info=$MTPATH > /dev/null 2> /dev/null
if [ "$?" = 0 ]; then
echo "$MTPATH is already configured. Exiting..."
exit 0
if [ ! -f $MTPATH ]; then
echo "ERROR: $MTPATH does not exist."
exit 255
/sbin/new-memtest-pkg --install $MTVERSION --banner="Memtest86+"
RETVAL="$?"
if [ "$RETVAL" != "0" ]; then
echo "ERROR: grubby failed to configure your bootloader for $MTPATH."
exit $RETVAL
echo "Setup complete."