summaryrefslogtreecommitdiff
blob: 9c9067a5e736bd39a033c15f9c7d2bdd74608cdc (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
#!/bin/sh

. /usr/share/grub/grub-mkconfig_lib

memtest=/boot/memtest86plus/memtest

memtestbsd=/boot/memtest86plus/memtest.netbsd

if [ -f "${memtest}" ] && [ -f "${memtestbsd}" ]; 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

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

	device="$("${grub_probe}" --target=device "${memtest}")"
	path="$(make_system_path_relative_to_its_root "${memtest}")"
	cat <<EOF
${submenu_indentation}menuentry 'Memtest86+' {
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}linux16 "${path}"
${submenu_indentation}}
EOF
fi

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

	device="$("${grub_probe}" --target=device "${memtestbsd}")"
	path="$(make_system_path_relative_to_its_root "${memtestbsd}")"
	cat <<EOF
${submenu_indentation}menuentry 'Memtest86+ (netbsd)' {
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}knetbsd "${path}"
${submenu_indentation}}
EOF
fi

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