Compare commits
No commits in common. 'c9' and 'cs10' have entirely different histories.
@ -1 +1 @@
|
|||||||
SOURCES/memtest86+-5.31b.tar.gz
|
SOURCES/memtest86-plus-7.00.tar.gz
|
||||||
|
@ -1 +1 @@
|
|||||||
7f4c16c6b04eb894154347047226b6e79ebe3c03 SOURCES/memtest86+-5.31b.tar.gz
|
bc409865f58d9d4101245a7467127ae3affd307f SOURCES/memtest86-plus-7.00.tar.gz
|
||||||
|
@ -1,142 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# grub-mkconfig helper script.
|
|
||||||
# Copyright (C) 2011 Michal Ambroz <rebus@seznam.cz>
|
|
||||||
#
|
|
||||||
# you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with the script. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
prefix=/usr
|
|
||||||
exec_prefix=/usr
|
|
||||||
bindir=/usr/bin
|
|
||||||
grublibdir=/usr/share/grub
|
|
||||||
. ${grublibdir}/grub-mkconfig_lib
|
|
||||||
|
|
||||||
export TEXTDOMAIN=grub
|
|
||||||
export TEXTDOMAINDIR=${prefix}/share/locale
|
|
||||||
|
|
||||||
CLASS=""
|
|
||||||
|
|
||||||
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
|
|
||||||
OS=Memtest
|
|
||||||
else
|
|
||||||
OS="${GRUB_DISTRIBUTOR} Memtest"
|
|
||||||
fi
|
|
||||||
|
|
||||||
CONF_FILE="/etc/memtest86+.conf"
|
|
||||||
CONF_ELF_VAR="INSTALL_ELF"
|
|
||||||
|
|
||||||
MEMTEST86_ELF=`[ -r "$CONF_FILE" ] && sed -n "/^\s*${CONF_ELF_VAR}\s*=/ {s/^\s*${CONF_ELF_VAR}\s*=\s*\(.*\)$/\1/; T end; s/\s*\(\S\)*\s*/\1/; p; :end}" "$CONF_FILE" 2>/dev/null`
|
|
||||||
if [ "x${MEMTEST86_ELF}" = "x" ] || [ "x${MEMTEST86_ELF}" = "x1" ] || [ "x${MEMTEST86_ELF}" = "xtrue" ]; then
|
|
||||||
MEMTEST86_ELF=1
|
|
||||||
BANNER_SUFFIX=
|
|
||||||
IMAGE="elf-memtest"
|
|
||||||
else
|
|
||||||
MEMTEST86_ELF=0
|
|
||||||
IMAGE="memtest"
|
|
||||||
BANNER_SUFFIX=" (non-ELF)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# loop-AES arranges things so that /dev/loop/X can be our root device, but
|
|
||||||
# the initrds that Linux uses don't like that.
|
|
||||||
case ${GRUB_DEVICE} in
|
|
||||||
/dev/loop/*|/dev/loop[0-9])
|
|
||||||
GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
|
|
||||||
|| ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \
|
|
||||||
|| uses_abstraction "${GRUB_DEVICE}" lvm; then
|
|
||||||
LINUX_ROOT_DEVICE=${GRUB_DEVICE}
|
|
||||||
else
|
|
||||||
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`" = xbtrfs ]; then
|
|
||||||
rootsubvol="`make_system_path_relative_to_its_root /`"
|
|
||||||
rootsubvol="${rootsubvol#/}"
|
|
||||||
if [ "x${rootsubvol}" != x ]; then
|
|
||||||
GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
memtest_entry ()
|
|
||||||
{
|
|
||||||
os="$1"
|
|
||||||
version="$2"
|
|
||||||
recovery="$3"
|
|
||||||
args="$4"
|
|
||||||
title="$(gettext_quoted "%s %s")"
|
|
||||||
printf "menuentry '${title}${BANNER_SUFFIX}' {\n" "${os}" "${version}"
|
|
||||||
|
|
||||||
|
|
||||||
if [ x$dirname = x/ ]; then
|
|
||||||
if [ -z "${prepare_root_cache}" ]; then
|
|
||||||
prepare_root_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/")"
|
|
||||||
fi
|
|
||||||
printf '%s\n' "${prepare_root_cache}"
|
|
||||||
else
|
|
||||||
if [ -z "${prepare_boot_cache}" ]; then
|
|
||||||
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
|
|
||||||
fi
|
|
||||||
printf '%s\n' "${prepare_boot_cache}"
|
|
||||||
fi
|
|
||||||
message="$(gettext_printf "Loading %s %s ..." "${os}" "${version}")"
|
|
||||||
if [ "x${MEMTEST86_ELF}" = "x1" ]; then
|
|
||||||
cat << EOF
|
|
||||||
insmod bsd
|
|
||||||
echo '$message'
|
|
||||||
knetbsd ${rel_dirname}/${basename}
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
else
|
|
||||||
cat << EOF
|
|
||||||
echo '$message'
|
|
||||||
linux16 ${rel_dirname}/${basename}
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
case x`uname -m` in
|
|
||||||
xi?86 | xx86_64)
|
|
||||||
list=`for i in /boot/${IMAGE}* ; do
|
|
||||||
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
|
|
||||||
done` ;;
|
|
||||||
*)
|
|
||||||
list=`for i in /boot/${IMAGE}* ; do
|
|
||||||
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
|
|
||||||
done` ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
prepare_boot_cache=
|
|
||||||
prepare_root_cache=
|
|
||||||
|
|
||||||
while [ "x$list" != "x" ] ; do
|
|
||||||
linux=`version_find_latest $list`
|
|
||||||
echo "Found memtest image: $linux" >&2
|
|
||||||
basename=`basename $linux`
|
|
||||||
dirname=`dirname $linux`
|
|
||||||
rel_dirname=`make_system_path_relative_to_its_root $dirname`
|
|
||||||
version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
|
|
||||||
alt_version=`echo $version | sed -e "s,\.old$,,g"`
|
|
||||||
linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
|
|
||||||
|
|
||||||
|
|
||||||
memtest_entry "${OS}" "${version}" false \
|
|
||||||
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
|
|
||||||
|
|
||||||
list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
|
|
||||||
done
|
|
@ -1,82 +0,0 @@
|
|||||||
Install memtest86+ into your grub menu by the following command:
|
|
||||||
|
|
||||||
# memtest-setup
|
|
||||||
|
|
||||||
It will install 20_memtest86+ GRUB 2 template into /etc/grub.d and you will also
|
|
||||||
need to regenerate GRUB 2 config by running:
|
|
||||||
|
|
||||||
# grub2-mkconfig -o /boot/grub2/grub.cfg
|
|
||||||
|
|
||||||
This is not done automatically because it could overwrite any custom changes
|
|
||||||
in /boot/grub2/grub.cfg.
|
|
||||||
|
|
||||||
By default ELF version of memtest86+ is installed, which should work on most of
|
|
||||||
the systems. In case it doesn't work for you, you can try to install the non-ELF
|
|
||||||
version by running:
|
|
||||||
|
|
||||||
# memtest-setup -b
|
|
||||||
|
|
||||||
Or you can switch between ELF and non-ELF versions of memtest86+ by using
|
|
||||||
INSTALL_ELF variable from /etc/memtest86+.conf. Setting it to '1' will instruct
|
|
||||||
GRUB 2 to install ELF version of memtest86+ and setting it to '0' will instruct
|
|
||||||
GRUB 2 to install non-ELF version. If the variable is empty or unset, the ELF
|
|
||||||
version is installed (it's due to backward compatibility). For the change
|
|
||||||
to take effect you need to regenerate your GRUB 2 config by running:
|
|
||||||
|
|
||||||
# grub2-mkconfig -o /boot/grub2/grub.cfg
|
|
||||||
|
|
||||||
The non-ELF version is known to cause various problems and it may not work on
|
|
||||||
several systems. That's why the ELF version is installed by default.
|
|
||||||
|
|
||||||
In case of problems you can also try to install the non-ELF version of
|
|
||||||
memtest86+ on floppy disk or USB flash disk and boot the memtest86+ from it.
|
|
||||||
The following command installs the memtest86+ on floppy disk
|
|
||||||
(WARNING: all data previosly stored on the disk will be lost):
|
|
||||||
|
|
||||||
# dd if=/boot/memtest86+-VERSION of=/dev/fd0
|
|
||||||
|
|
||||||
For USB flash disk the command is the same, just change the 'of' device
|
|
||||||
appropriately (usually USB flash disk is /dev/sdb, but double check that
|
|
||||||
the device string matches your USB flash disk before you run the command,
|
|
||||||
wrong device string may cause significat harm, e.g. it can destroy content
|
|
||||||
of your system or data disks).
|
|
||||||
|
|
||||||
The memtest86+ now supports some command line parameters:
|
|
||||||
console= - serial console can be used for memtest86+ control/display,
|
|
||||||
example of usage:
|
|
||||||
console=ttyS0
|
|
||||||
console=ttyS0,115200
|
|
||||||
console=ttyS1,115200n8
|
|
||||||
Only ttyS0 and ttyS1 are supported.
|
|
||||||
|
|
||||||
btrace - enable boot trace.
|
|
||||||
|
|
||||||
maxcpus= - limit number of CPUs to use.
|
|
||||||
|
|
||||||
onepass - run one pass and exit if there are no errors.
|
|
||||||
|
|
||||||
tstlist= - setup a list of tests to run.
|
|
||||||
|
|
||||||
cpumask= - set a CPU (hexadecimal) mask to select CPU's to use for testing.
|
|
||||||
|
|
||||||
You can add memtest86+ command line parameters into grub like you are
|
|
||||||
used with kernel command line parameters, e.g.:
|
|
||||||
linux16 /memtest86+-VERSION console=ttyS0
|
|
||||||
|
|
||||||
Unfortunately this is currently supported only with non-ELF memtest86+ image.
|
|
||||||
You cannot use the command line parameters with the ELF image, because the
|
|
||||||
command line handling is currently not supported by grub for ELF images.
|
|
||||||
|
|
||||||
If you need to use serial console with ELF image, you need to recompile
|
|
||||||
memtest86+ and explicitly enable/configure serial line. In such case
|
|
||||||
edit the config.h in memtest86+ sources the following way:
|
|
||||||
|
|
||||||
#define SERIAL_CONSOLE_DEFAULT 1
|
|
||||||
#define SERIAL_TTY 0
|
|
||||||
#define SERIAL_BAUD_RATE 9600
|
|
||||||
|
|
||||||
and recompile memtest86+. This will explicitly enable serial console and
|
|
||||||
set it to use ttyS0,9600.
|
|
||||||
|
|
||||||
NOTE: explicitly enabled serial console may significantly slow down the memory
|
|
||||||
testing.
|
|
@ -1,90 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# GRUB 2 template
|
|
||||||
G2TEMPL="20_memtest86+"
|
|
||||||
|
|
||||||
# GRUB 2 environment file
|
|
||||||
CONF_FILE="/etc/memtest86+.conf"
|
|
||||||
|
|
||||||
# GRUB2 configuration file
|
|
||||||
GRUB2CFG="/boot/grub2/grub.cfg"
|
|
||||||
|
|
||||||
# GRUB2 environment variable to control image type
|
|
||||||
CONF_VAR="INSTALL_ELF"
|
|
||||||
|
|
||||||
# whether to install ELF image
|
|
||||||
ELF=1
|
|
||||||
|
|
||||||
if [ "$1" = "--help" -o "$1" = "-h" ]; then
|
|
||||||
cat <<:EOF
|
|
||||||
Usage:
|
|
||||||
memtest-setup [-b|-e|-h]
|
|
||||||
memtest-setup [--bin|--elf|--help]
|
|
||||||
|
|
||||||
The memtest-setup utility installs Memtest86+ into GRUB 2 boot loader menu.
|
|
||||||
It installs GRUB 2 template into /etc/grub.d directory.
|
|
||||||
|
|
||||||
GRUB 2 configuration file needs to be regenerated manually by running:
|
|
||||||
|
|
||||||
grub2-mkconfig -o $GRUB2CFG
|
|
||||||
|
|
||||||
This is not done automatically because it could overwrite any custom changes
|
|
||||||
in GRUB 2 configuration file.
|
|
||||||
|
|
||||||
Options:
|
|
||||||
-b, --bin Install a binary Memtest86+ image.
|
|
||||||
-e, --elf Install an ELF Memtest86+ image (the default).
|
|
||||||
-h, --help Print a help message and exit.
|
|
||||||
|
|
||||||
:EOF
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ "$1" = "-b" -o "$1" = "--bin" ] && ELF=0
|
|
||||||
[ "$1" = "-e" -o "$1" = "--elf" ] && ELF=1
|
|
||||||
|
|
||||||
if [ -d /sys/firmware/efi ]; then
|
|
||||||
echo "ERROR: memtest86+ does not support EFI platforms."
|
|
||||||
exit 254
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -r "$GRUB2CFG" ]; then
|
|
||||||
echo "ERROR: unable to read grub configuration file. Do you have enough permissions?"
|
|
||||||
echo "Try to run as root."
|
|
||||||
exit 249
|
|
||||||
fi
|
|
||||||
|
|
||||||
# install GRUB 2 template
|
|
||||||
if [ ! -d /etc/grub.d ]; then
|
|
||||||
echo "ERROR: unable to find /etc/grub.d"
|
|
||||||
exit 253
|
|
||||||
fi
|
|
||||||
if [ ! -r /usr/share/memtest86+/$G2TEMPL ]; then
|
|
||||||
echo "ERROR: unable to find GRUB 2 template."
|
|
||||||
exit 251
|
|
||||||
fi
|
|
||||||
if ! cp /usr/share/memtest86+/$G2TEMPL /etc/grub.d; then
|
|
||||||
echo "ERROR: unable to copy GRUB 2 template, do you have write permission to"
|
|
||||||
echo "/etc/grub.d?"
|
|
||||||
# EX_IOERR
|
|
||||||
exit 74
|
|
||||||
fi
|
|
||||||
if [ ! -w "$CONF_FILE" ]
|
|
||||||
then
|
|
||||||
echo "ERROR: file '$CONF_FILE' is not writable."
|
|
||||||
exit 250
|
|
||||||
fi
|
|
||||||
chmod a+x /etc/grub.d/$G2TEMPL
|
|
||||||
echo "GRUB 2 template installed."
|
|
||||||
echo "Do not forget to regenerate your grub.cfg by:"
|
|
||||||
echo " # grub2-mkconfig -o $GRUB2CFG"
|
|
||||||
|
|
||||||
# update/add configuration variable to the configuration file
|
|
||||||
if grep -q "^\s*$CONF_VAR\s*=" "$CONF_FILE"
|
|
||||||
then
|
|
||||||
sed -i "/^\s*$CONF_VAR\s*=/ s/\(\s*$CONF_VAR\s*=[\"']\?\)[^\"']*\([\"']\?\s*\)/\1${ELF}\2/g" "$CONF_FILE"
|
|
||||||
else
|
|
||||||
echo "$CONF_VAR=\"$ELF\"" >> "$CONF_FILE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Setup complete."
|
|
@ -1,32 +0,0 @@
|
|||||||
.TH MEMTEST-SETUP 8 2018-05-17 Memtest86+ "Memtest86+ Manual"
|
|
||||||
|
|
||||||
.SH NAME
|
|
||||||
memtest-setup \- install Memtest86+ into GRUB\ 2 boot loader menu
|
|
||||||
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.BR memtest-setup " [" \-b | \-e | \-h ]
|
|
||||||
.br
|
|
||||||
.BR memtest-setup " [" \-\-bin | \-\-elf | \-\-help ]
|
|
||||||
|
|
||||||
.SH DESCRIPTION
|
|
||||||
.RB "The " memtest-setup " utility installs Memtest86+ into GRUB\ 2 boot"
|
|
||||||
loader menu.
|
|
||||||
.RI "It installs GRUB\ 2 template into " /etc/grub.d " directory."
|
|
||||||
.PP
|
|
||||||
GRUB\ 2 configuration file needs to be regenerated manually by running:
|
|
||||||
.IP
|
|
||||||
.RI "grub2-mkconfig -o " /boot/grub2/grub.cfg
|
|
||||||
.PP
|
|
||||||
This is not done automatically because it could overwrite any custom
|
|
||||||
changes in GRUB\ 2 configuration file.
|
|
||||||
|
|
||||||
.SH OPTIONS
|
|
||||||
.TP
|
|
||||||
.BR \-b ", " \-\-bin
|
|
||||||
Install a binary Memtest86+ image.
|
|
||||||
.TP
|
|
||||||
.BR \-e ", " \-\-elf
|
|
||||||
Install an ELF Memtest86+ image (the default).
|
|
||||||
.TP
|
|
||||||
.BR \-h ", " \-\-help
|
|
||||||
Print a help message and exit.
|
|
@ -1,13 +0,0 @@
|
|||||||
diff --git a/lib.c b/lib.c
|
|
||||||
index a2b829d..6a7e210 100644
|
|
||||||
--- a/lib.c
|
|
||||||
+++ b/lib.c
|
|
||||||
@@ -1141,7 +1141,7 @@ void serial_console_setup(char *param)
|
|
||||||
|
|
||||||
end++;
|
|
||||||
|
|
||||||
- if (*end != '\0' || *end != ' ')
|
|
||||||
+ if (*end != '\0' && *end != ' ')
|
|
||||||
return; /* garbage at the end */
|
|
||||||
|
|
||||||
serial_bits = bits;
|
|
@ -1,10 +0,0 @@
|
|||||||
# If INSTALL_ELF is set to 1 or if it is unset/empty, the ELF version of the
|
|
||||||
# memtest86+ will be installed, otherwise the non-ELF version will be
|
|
||||||
# installed. If you change this variable, you will have to regenerate your
|
|
||||||
# grub.conf for the changed to take effect, it is usually done by the
|
|
||||||
# following command:
|
|
||||||
#
|
|
||||||
# grub2-mkconfig -o /boot/grub2/grub.cfg
|
|
||||||
#
|
|
||||||
# For details see memtest86+ package documentation.
|
|
||||||
INSTALL_ELF=1
|
|
@ -0,0 +1,108 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
#
|
||||||
|
# Manage memtest86+ install location and bootloader config.
|
||||||
|
# Currently only manages GRUB with BLS support enabled.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Sanity Checks
|
||||||
|
if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if ! [[ $KERNEL_INSTALL_BOOT_ROOT ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Setup variables
|
||||||
|
[[ -f /etc/default/grub ]] && . /etc/default/grub
|
||||||
|
[[ -f /etc/os-release ]] && . /etc/os-release
|
||||||
|
|
||||||
|
COMMAND="$1"
|
||||||
|
MEMTEST_VERSION="$2"
|
||||||
|
BOOT_DIR_ABS="$3"
|
||||||
|
MEMTEST_IMAGE="$4"
|
||||||
|
|
||||||
|
MEMTEST_DIR="${MEMTEST_IMAGE%/*}"
|
||||||
|
BOOT_ROOT="${KERNEL_INSTALL_BOOT_ROOT}"
|
||||||
|
MACHINE_ID="${KERNEL_INSTALL_MACHINE_ID}"
|
||||||
|
BLS_DIR="${BOOT_ROOT}/loader/entries"
|
||||||
|
# Fail back to /boot default if BLS_DIR
|
||||||
|
# doesn't exist already, matching 20-grub.install
|
||||||
|
if [[ ! -d "${BLS_DIR}" ]]; then
|
||||||
|
BOOT_ROOT="/boot"
|
||||||
|
BLS_DIR="/boot/loader/entries"
|
||||||
|
fi
|
||||||
|
BLS_ENTRY="${BLS_DIR}/${MACHINE_ID}-0-memtest86+.conf"
|
||||||
|
|
||||||
|
# Setup functions
|
||||||
|
mkbls_grub() {
|
||||||
|
local memtestver=$1 && shift
|
||||||
|
local memtestimg=$1 && shift
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
title Memory test (${memtestimg})
|
||||||
|
version 0-${memtestver}-memtest86+
|
||||||
|
linux /${memtestimg}
|
||||||
|
grub_users \$grub_users
|
||||||
|
grub_arg --unrestricted
|
||||||
|
grub_class memtest
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# If ${BOOT_DIR_ABS} exists, non-grub boot loader is active.
|
||||||
|
[[ -d "${BOOT_DIR_ABS}" ]] && exit 0
|
||||||
|
|
||||||
|
case "$COMMAND" in
|
||||||
|
add)
|
||||||
|
# Install into BOOT_ROOT, if not already there
|
||||||
|
if [[ "${MEMTEST_DIR}" != "${BOOT_ROOT}" ]]; then
|
||||||
|
for i in \
|
||||||
|
"$MEMTEST_IMAGE"
|
||||||
|
do
|
||||||
|
[[ -e "$i" ]] || continue
|
||||||
|
rm -f "${BOOT_ROOT}/${i##*/}"
|
||||||
|
cp -aT "$i" "${BOOT_ROOT}/${i##*/}"
|
||||||
|
command -v restorecon &>/dev/null && \
|
||||||
|
restorecon -R "${BOOT_ROOT}/${i##*/}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Generate GRUB BLS, if enabled
|
||||||
|
if [[ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]]; then
|
||||||
|
[[ -d "$BLS_DIR" ]] || mkdir -m 0700 -p "$BLS_DIR"
|
||||||
|
mkbls_grub "${MEMTEST_VERSION}" "${MEMTEST_IMAGE##*/}" > "${BLS_ENTRY}"
|
||||||
|
command -v restorecon &>/dev/null && restorecon -R "${BLS_ENTRY}"
|
||||||
|
|
||||||
|
MEMTEST_LOC="$(grep '^linux[ \t]' "${BLS_ENTRY}" | sed -e 's,^linux[ \t]*,,')"
|
||||||
|
if [[ "$(grub2-probe --device $(grub2-probe --target=device /) --target=fs)" == "btrfs" &&
|
||||||
|
"${SUSE_BTRFS_SNAPSHOT_BOOTING}" == "true" ]]; then
|
||||||
|
MEMTEST_RELPATH="$(grub2-mkrelpath -r ${BOOT_ROOT}${MEMTEST_LOC})"
|
||||||
|
else
|
||||||
|
MEMTEST_RELPATH="$(grub2-mkrelpath ${BOOT_ROOT}${MEMTEST_LOC})"
|
||||||
|
fi
|
||||||
|
|
||||||
|
BOOTPREFIX="$(dirname ${MEMTEST_RELPATH})"
|
||||||
|
|
||||||
|
if [[ "${MEMTEST_LOC}" != "${MEMTEST_RELPATH}" ]]; then
|
||||||
|
sed -i -e "s,^linux.*,linux ${BOOTPREFIX}${MEMTEST_LOC},g" "${BLS_ENTRY}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 77
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
remove)
|
||||||
|
# Find MEMTEST_IMAGE location in BLS_ENTRY, delete both MEMTEST_IMAGE and BLS_ENTRY
|
||||||
|
if [[ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]]; then
|
||||||
|
if [[ -f "${BLS_ENTRY}" ]]; then
|
||||||
|
MEMTEST_IMAGE="$(grep '^linux[ \t]' "${BLS_ENTRY}" | sed -e 's,^linux[ \t]*,,')"
|
||||||
|
if [[ -f "${BOOT_ROOT}${MEMTEST_IMAGE}" ]]; then
|
||||||
|
rm -f "${BOOT_ROOT}${MEMTEST_IMAGE}"
|
||||||
|
fi
|
||||||
|
rm -f "${BLS_ENTRY}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 77
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
Loading…
Reference in new issue