Use mountpoint command to check whether /boot is a mount point

Using grep is wrong and fragile, so let's use the mountpoint command
instead to make it more robust.

Resolves: rhbz#1706091

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
Javier Martinez Canillas 2019-05-03 18:21:23 +02:00
parent dc24f2cedf
commit 73b809baaf
No known key found for this signature in database
GPG Key ID: C751E590D63F3D69
2 changed files with 7 additions and 2 deletions

View File

@ -197,7 +197,7 @@ param_to_indexes() {
}
get_prefix() {
if [[ $bootloader = grub2 ]] && grep -q /boot /proc/mounts; then
if [[ $bootloader = grub2 ]] && mountpoint -q /boot; then
echo "/boot"
else
echo ""

View File

@ -1,6 +1,6 @@
Name: grubby
Version: 8.40
Release: 30%{?dist}
Release: 31%{?dist}
Summary: Command line tool for updating bootloader configs
License: GPLv2+
URL: https://github.com/rhinstaller/grubby
@ -39,6 +39,7 @@ Requires: grub2-tools
Requires: s390utils-base
%endif
Requires: findutils
Requires: util-linux
Obsoletes: %{name}-bls
@ -127,6 +128,10 @@ current boot environment.
%{_mandir}/man8/*.8*
%changelog
* Fri May 03 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-31
- Use mountpoint command to check whether /boot is a mount point
Resolves: rhbz#1706091
* Thu Mar 21 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-30
- grubby-bls: fix --add-kernel not working when using the --args option
Resolves: rhbz#1691004