33 lines
1.2 KiB
Bash
33 lines
1.2 KiB
Bash
#!/usr/bin/env sh
|
|
#######################################################
|
|
# This script generates a PCMemTest entry on grub.cfg #
|
|
# if memtest is installed on the system. #
|
|
#######################################################
|
|
|
|
prefix="/usr"
|
|
exec_prefix="${prefix}"
|
|
|
|
datarootdir="/usr/share"
|
|
datadir="${datarootdir}"
|
|
|
|
. "${datadir}/grub/grub-mkconfig_lib"
|
|
|
|
MEMTEST_IMAGE="/boot/pcmemtest/memtest.bin"
|
|
CLASS="--class pcmemtest --class pcmemtest --class tool"
|
|
|
|
if [ -e "${MEMTEST_IMAGE}" ] && is_path_readable_by_grub "${MEMTEST_IMAGE}"; then
|
|
## image exists, create menu entry
|
|
echo "Found PCMemTest image: ${MEMTEST_IMAGE}" >&2
|
|
_GRUB_MEMTEST_HINTS_STRING="$(${grub_probe} --target=hints_string ${MEMTEST_IMAGE})"
|
|
_GRUB_MEMTEST_FS_UUID="$(${grub_probe} --target=fs_uuid ${MEMTEST_IMAGE})"
|
|
_GRUB_MEMTEST_REL_PATH="$(make_system_path_relative_to_its_root ${MEMTEST_IMAGE})"
|
|
cat << EOF
|
|
if [ "\${grub_platform}" == "pc" ]; then
|
|
menuentry "Memory Tester (PCMemTest)" ${CLASS} {
|
|
search --fs-uuid --no-floppy --set=root ${_GRUB_MEMTEST_HINTS_STRING} ${_GRUB_MEMTEST_FS_UUID}
|
|
linux16 ${_GRUB_MEMTEST_REL_PATH} ${GRUB_CMDLINE_PCMEMTEST}
|
|
}
|
|
fi
|
|
EOF
|
|
fi
|