Various improvements to memtest-setup, e.g. now exits with error if run by non root user
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
This commit is contained in:
parent
aa2158d546
commit
ab89f382f1
@ -18,6 +18,12 @@ G2TEMPL="20_memtest86+"
|
|||||||
# GRUB 2 environment file
|
# GRUB 2 environment file
|
||||||
CONF_FILE="/etc/memtest86+.conf"
|
CONF_FILE="/etc/memtest86+.conf"
|
||||||
|
|
||||||
|
# GRUB legacy configuration file
|
||||||
|
GRUBCONF="/boot/grub/grub.conf"
|
||||||
|
|
||||||
|
# GRUB2 configuration file
|
||||||
|
GRUB2CFG="/boot/grub2/grub.cfg"
|
||||||
|
|
||||||
# GRUB2 environment variable to control image type
|
# GRUB2 environment variable to control image type
|
||||||
CONF_VAR="INSTALL_ELF"
|
CONF_VAR="INSTALL_ELF"
|
||||||
|
|
||||||
@ -33,7 +39,7 @@ It supports both GRUB 2 and GRUB Legacy (i.e. GRUB 0.9x).
|
|||||||
In case of GRUB 2 it installs GRUB 2 template into /etc/grub.d and GRUB 2
|
In case of GRUB 2 it installs GRUB 2 template into /etc/grub.d and GRUB 2
|
||||||
config needs to be regenerated manually by running:
|
config needs to be regenerated manually by running:
|
||||||
|
|
||||||
grub2-mkconfig -o /boot/grub2/grub.cfg
|
grub2-mkconfig -o $GRUB2CFG
|
||||||
|
|
||||||
This is not done automatically because it could overwrite any custom changes
|
This is not done automatically because it could overwrite any custom changes
|
||||||
in /boot/grub2/grub.cfg.
|
in /boot/grub2/grub.cfg.
|
||||||
@ -61,11 +67,17 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d /sys/firmware/efi ]; then
|
if [ -d /sys/firmware/efi ]; then
|
||||||
echo "memtest86+ does not support EFI platforms."
|
echo "ERROR: memtest86+ does not support EFI platforms."
|
||||||
exit 254
|
exit 254
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /boot/grub2/grub.cfg ]; then
|
if [ ! -r "$GRUBCONF" -a ! -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
|
||||||
|
|
||||||
|
if [ -f "$GRUB2CFG" ]; then
|
||||||
echo "GRUB 2 detected, installing template..."
|
echo "GRUB 2 detected, installing template..."
|
||||||
if [ ! -d /etc/grub.d ]; then
|
if [ ! -d /etc/grub.d ]; then
|
||||||
echo "ERROR: unable to find /etc/grub.d"
|
echo "ERROR: unable to find /etc/grub.d"
|
||||||
@ -89,11 +101,16 @@ if [ -f /boot/grub2/grub.cfg ]; then
|
|||||||
chmod a+x /etc/grub.d/$G2TEMPL
|
chmod a+x /etc/grub.d/$G2TEMPL
|
||||||
echo "GRUB 2 template installed."
|
echo "GRUB 2 template installed."
|
||||||
echo "Do not forget to regenerate your grub.cfg by:"
|
echo "Do not forget to regenerate your grub.cfg by:"
|
||||||
echo " # grub2-mkconfig -o /boot/grub2/grub.cfg"
|
echo " # grub2-mkconfig -o $GRUB2CFG"
|
||||||
else
|
else
|
||||||
MTVERSION=`rpm -q --qf '%{version}' $PNAME`
|
MTVERSION=`rpm -q --qf '%{version}' $PNAME`
|
||||||
MTPATH="/boot/$ENAME-$MTVERSION"
|
MTPATH="/boot/$ENAME-$MTVERSION"
|
||||||
|
|
||||||
|
if [ ! -r "$GRUBCONF" ]; then
|
||||||
|
echo "ERROR: $GRUBCONF not found or not readable."
|
||||||
|
exit 252
|
||||||
|
fi
|
||||||
|
|
||||||
MENT=`cat /boot/grub/grub.conf | grep "$ENAME-$MTVERSION"` &> /dev/null
|
MENT=`cat /boot/grub/grub.conf | grep "$ENAME-$MTVERSION"` &> /dev/null
|
||||||
if [ "$MENT" != "" ]; then
|
if [ "$MENT" != "" ]; then
|
||||||
echo "$MTPATH is already configured. Exiting..."
|
echo "$MTPATH is already configured. Exiting..."
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
Name: memtest86+
|
Name: memtest86+
|
||||||
Version: 5.01
|
Version: 5.01
|
||||||
Release: 14%{?dist}
|
Release: 15%{?dist}
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
Summary: Stand-alone memory tester for x86 and x86-64 computers
|
Summary: Stand-alone memory tester for x86 and x86-64 computers
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
@ -122,6 +122,10 @@ fi
|
|||||||
%{_mandir}/man8/*.8.gz
|
%{_mandir}/man8/*.8.gz
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Apr 5 2016 Jaroslav Škarvada <jskarvad@redhat.com> - 5.01-15
|
||||||
|
- Various improvements to memtest-setup, e.g. now exits with error if
|
||||||
|
run by non root user
|
||||||
|
|
||||||
* Tue Feb 23 2016 Jaroslav Škarvada <jskarvad@redhat.com> - 5.01-14
|
* Tue Feb 23 2016 Jaroslav Škarvada <jskarvad@redhat.com> - 5.01-14
|
||||||
- Removed some spec artifacts (like buildroot cleaning)
|
- Removed some spec artifacts (like buildroot cleaning)
|
||||||
- Fixed malformed "Loading" banner
|
- Fixed malformed "Loading" banner
|
||||||
|
Loading…
Reference in New Issue
Block a user