summaryrefslogtreecommitdiff
path: root/sys-apps/memtest86+/files/39_memtest86+-r3
blob: 5350f6691d688c729cbae055a21f72b5a6977ebf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh

. /usr/share/grub/grub-mkconfig_lib

mt32=/boot/memtest86plus/memtest.i586
mt64=/boot/memtest86plus/memtest.x86_64

if [ $(ls /boot/memtest86plus | wc -l) -gt 1 ]; then
	multiple_memtest=true
fi

submenu_indentation=""
if [ "${multiple_memtest}" = "true" ] && [ "${GRUB_DISABLE_SUBMENU}" != "y" ]; then
	submenu_indentation="${grub_tab}"
	cat <<EOF
submenu 'Memtest86+' {
EOF
fi

# Start i586
if [ -f "${mt32}" ]; then
	gettext_printf "Found memtest image: %s\n" "${mt32}" >&2

	device="$("${grub_probe}" --target=device "${mt32}")"
	path="$(make_system_path_relative_to_its_root "${mt32}")"
	cat <<EOF
${submenu_indentation}menuentry 'Memtest86+ 32bit' {
EOF

	if [ -n "${submenu_indentation}" ]; then
		prepare_grub_to_access_device "${device}" | grub_add_tab | grub_add_tab
	else
		prepare_grub_to_access_device "${device}" | grub_add_tab
	fi

	cat <<EOF
	${submenu_indentation}linux "${path}"
${submenu_indentation}}
EOF
fi
# End i586

# Start x86_64
if [ -f "${mt64}" ]; then
        gettext_printf "Found memtest image: %s\n" "${mt64}" >&2

        device="$("${grub_probe}" --target=device "${mt64}")"
        path="$(make_system_path_relative_to_its_root "${mt64}")"
        cat <<EOF
${submenu_indentation}menuentry 'Memtest86+ 64bit' {
EOF

        if [ -n "{submenu_indentation}" ]; then
                prepare_grub_to_access_device "${device}" | grub_add_tab | grub_add_tab
        else
                prepare_grub_to_access_device "${device}" | grub_add_tab
        fi

        cat <<EOF
        ${submenu_indentation}linux "${path}"
${submenu_indentation}}
EOF
fi
# End x86_64

if [ "${multiple_memtest}" = "true" ] && [ "${GRUB_DISABLE_SUBMENU}" != "y" ]; then
	cat <<EOF
}
EOF
fi