grubby-bls: always generate the BLS snippets when adding new entries

a BLS file is generated at build time and stored in /lib/modules/$kernel
but this default BLS file assumes that /boot is a mount point and so the
kernel and initrd paths are relative to the root of this boot partition.

This is not the case if /boot is not a mount point or if the bootloader
is zipl, since zipl expects the absolute path to be in the BLS snippet.

The kernel-install scripts takes care of this and modifies the BLS file
if needed, but grubby doesn't do that. So instead just generate the BLS
always even if there is one for the kernel version of the added entry.

Resolves: rhbz#1653365

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
Javier Martinez Canillas 2018-11-26 18:06:24 +01:00
parent b84a214b99
commit f1aafa632f
No known key found for this signature in database
GPG Key ID: C751E590D63F3D69
1 changed files with 4 additions and 8 deletions

View File

@ -391,16 +391,12 @@ add_bls_fragment() {
fi
kernel_dir="/lib/modules/${kernelver}"
if [[ -f "${kernel_dir}/bls.conf" ]]; then
cp -aT "${kernel_dir}/bls.conf" "${bls_target}" || exit $?
if [[ -d $kernel_dir ]]; then
datetime="$(date -u +%Y%m%d%H%M%S -d "$(stat -c '%y' "${kernel_dir}")")"
else
if [[ -d $kernel_dir ]]; then
datetime="$(date -u +%Y%m%d%H%M%S -d "$(stat -c '%y' "${kernel_dir}")")"
else
datetime=0
fi
mkbls "${kernel}" "${kernelver}" "${datetime}" > "${bls_target}"
datetime=0
fi
mkbls "${kernel}" "${kernelver}" "${datetime}" > "${bls_target}"
if [[ -n $title ]]; then
set_bls_value "${bls_target}" "title" "${title}"