Add memtest support.
[syslinux-debian/hramrach.git] / debian / local / extlinux.d / 0015-memtest
blob8d4e8c03a931a4be52a1a6e92268bf362e319c7f
1 #!/bin/sh
3 ## Copyright (C) 2006-2013 Daniel Baumann <mail@daniel-baumann.ch>
4 ##
5 ## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
6 ## This is free software and you are welcome to redistribute it
7 ## under certain conditions; see COPYING for details.
10 set -e
12 . /usr/share/extlinux/extlinux-update.sh
14 if [ "${EXTLINUX_MEMTEST}" != "true" ]
15 then
16 echo "I: memtest disabled in /etc/default/extlinux: Skipping ${_EXTLINUX_DIRECTORY}/memtest.cfg"
17 exit 0
20 if ! ls /boot/memtest*.bin 2>&1
21 then
22 echo "I: /boot/memtest*.bin - No such files: Skipping ${_EXTLINUX_DIRECTORY}/memtest.cfg"
23 exit 0
26 # Create memtest.cfg
27 _CONFIG="\
28 ## ${_EXTLINUX_DIRECTORY}/memtest.cfg
30 ## IMPORTANT WARNING
32 ## The configuration of this file is generated automatically.
33 ## Do not edit this file manually use: extlinux-update
38 # Find linux versions
39 _VERSIONS="$(cd /boot && ls memtest*.bin | grep -v .dpkg-tmp | sed -e 's|^memtest||g' -e 's|[.]bin$||g' | sort -Vr)"
41 for _VERSION in ${_VERSIONS}
43 if echo "${_VERSION}" | grep multiboot > /dev/null ;
44 then
45 echo "W: Memtest /boot/memtest${_VERSION}.bin unsupported..."
46 continue
48 echo "P: Writing config for /boot/memtest${_VERSION}.bin..."
50 _NUMBER="${_NUMBER:-0}"
51 _ENTRY="${_ENTRY:-1}"
52 _CONFIG="${_CONFIG}
54 label mt${_NUMBER}
55 menu label ${EXTLINUX_MENU_LABEL} memtest${_VERSION}"
57 if [ "${EXTLINUX_DEFAULT}" = "mt${_NUMBER}" ]
58 then
59 _CONFIG="${_CONFIG}
60 menu default"
63 _CONFIG="${_CONFIG}
64 linux ${_BOOT_DIRECTORY}/memtest${_VERSION}.bin"
67 _NUMBER="$((${_NUMBER} + 1))"
68 _ENTRY="$((${_ENTRY} + 1))"
70 if [ "${EXTLINUX_ENTRIES}" = "${_ENTRY}" ]
71 then
72 break
74 done
76 _NUMBER=""
78 Update "${_EXTLINUX_DIRECTORY}/memtest.cfg" "${_CONFIG}"