Fix some lingering bls issues

Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Peter Jones 2018-07-17 16:46:37 -04:00
parent 7b06e73552
commit 1b55f4c84d
3 changed files with 54 additions and 10 deletions

View File

@ -0,0 +1,48 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Tue, 17 Jul 2018 20:22:39 +0200
Subject: [PATCH] grub-switch-to-blscfg: Only fix boot prefix for non-generated
BLS files
The BLS files are either copied from /lib/modules/$kernelver/bls.conf or
generated if this file doesn't exist. The shipped bls.conf default path
for the kernel and initramfs is relative to the boot partition.
But in some setups /boot may not be a mount point so in that case the
boot prefix has to be added to the BLS. But we already provide this
prefix for generated BLS files so attempting to add a boot prefix will
lead to a path that contains the boot prefix twice (i.e: /boot/boot).
Reported-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
util/grub-switch-to-blscfg.in | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in
index 40612e00686..9cf64f8e725 100644
--- a/util/grub-switch-to-blscfg.in
+++ b/util/grub-switch-to-blscfg.in
@@ -236,6 +236,10 @@ for kernelver in $(cd /lib/modules/ ; ls -1) "" ; do
if [ -f "${kernel_dir}/bls.conf" ] ; then
cp -af "${kernel_dir}/bls.conf" "${bls_target}"
+ if [ -n "${bootprefix}" ]; then
+ sed -i -e "s,^\(linux[^ \t]*[ \t]\+\).*,\1${bootprefix}${linux},g" "${bls_target}"
+ sed -i -e "/^initrd/ s,\([ \t]\+\)\([^ \t]\+\),\1${bootprefix}\2,g" "${bls_target}"
+ fi
else
mkbls "${kernelver}" \
"$(date -u +%Y%m%d%H%M%S -d "$(stat -c '%y' "${kernel_dir}")")" \
@@ -243,11 +247,6 @@ for kernelver in $(cd /lib/modules/ ; ls -1) "" ; do
>"${bls_target}"
fi
- if [ -n "${bootprefix}" ]; then
- sed -i -e "s,^\(linux[^ \t]*[ \t]\+\).*,\1${bootprefix}${linux},g" "${bls_target}"
- sed -i -e "/^initrd/ s,\([ \t]\+\)\([^ \t]\+\),\1${bootprefix}\2,g" "${bls_target}"
- fi
-
if [ "x$GRUB_LINUX_MAKE_DEBUG" = "xtrue" ]; then
arch="$(uname -m)"
bls_debug="$(echo ${bls_target} | sed -e "s/\.${arch}/-debug.${arch}/")"

View File

@ -408,9 +408,6 @@ cd .. \
%define do_efi_install() \
cd grub-%{1}-%{tarversion} \
install -m 700 -d $RPM_BUILD_ROOT%{efi_esp_dir}/ \
install -m 700 -d $RPM_BUILD_ROOT%{efi_esp_dir}/loader/entries \
install -m 700 -d $RPM_BUILD_ROOT/boot/grub2/ \
make DESTDIR=$RPM_BUILD_ROOT install \
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub.info ]; then \
rm -f $RPM_BUILD_ROOT%{_infodir}/grub.info \
@ -453,7 +450,6 @@ if [ %{3} -eq 0 ]; then \
${RPM_BUILD_ROOT}/boot/%{name}/grubenv create \
fi \
cd .. \
install -d -m 0755 ${RPM_BUILD_ROOT}/boot/loader/entries \
%{nil}
%define do_common_install() \
@ -466,12 +462,12 @@ cp -a $RPM_BUILD_ROOT%{_datarootdir}/locale/en\@quot \\\
cp docs/grub.info $RPM_BUILD_ROOT%{_infodir}/%{name}.info \
cp docs/grub-dev.info \\\
$RPM_BUILD_ROOT%{_infodir}/%{name}-dev.info \
# Ghost config file \
install -d -m 0700 ${RPM_BUILD_ROOT}%{efi_esp_dir}/ \
install -d -m 0700 ${RPM_BUILD_ROOT}/boot/grub2/ \
install -d -m 0755 ${RPM_BUILD_ROOT}/boot/%{name}/themes/system \
install -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/default \
install -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig \
install -d -m 0700 ${RPM_BUILD_ROOT}/boot/loader/entries \
install -d -m 0700 ${RPM_BUILD_ROOT}/boot/%{name}/themes/system \
install -d -m 0700 ${RPM_BUILD_ROOT}%{_sysconfdir}/default \
install -d -m 0700 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig \
touch ${RPM_BUILD_ROOT}%{_sysconfdir}/default/grub \
ln -sf ../default/grub \\\
${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/grub \
@ -504,8 +500,7 @@ touch ${RPM_BUILD_ROOT}/boot/%{name}/grub.cfg \
%config(noreplace) %{_sysconfdir}/%{name}-efi.cfg \
%attr(0700,root,root)%{efi_esp_dir}/%{2} \
%dir %attr(0700,root,root)%{efi_esp_dir}/fonts \
%dir %attr(0700,root,root)%{efi_esp_dir}/loader \
%dir %attr(0700,root,root)%{efi_esp_dir}/loader/entries \
%dir %attr(0700,root,root)/boot/loader/entries \
%ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \
/boot/grub2/grubenv \
%ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grubenv \

View File

@ -368,3 +368,4 @@ Patch0367: 0367-blscfg-don-t-leak-bls_entry.filename.patch
Patch0368: 0368-blscfg-fix-compilation-on-EFI-and-EMU.patch
Patch0369: 0369-Add-loadenv-to-blscfg-and-loadenv-source-file-list.patch
Patch0370: 0370-blscfg-Get-rid-of-the-linuxefi-linux16-linux-distinc.patch
Patch0371: 0371-grub-switch-to-blscfg-Only-fix-boot-prefix-for-non-g.patch