Make 20-grub.install to exit if there is no machine ID set

The kernel-install plugins are called with an environment variable named
$KERNEL_INSTALL_MACHINE_ID, which is set to the machine ID read from the
/etc/machine-id file. If the file doesn't exist or is empty, the variable
is empty and $BOOT_DIR_ABS is set to a temporary directory that's removed
after all the plugins exit.

So if $KERNEL_INSTALL_MACHINE_ID is not set, just exit the script since
installing a kernel BootLoaderSpec fragment won't be possible anyways.

Resolves: rhbz#1576573

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
Javier Martinez Canillas 2018-06-15 15:06:00 +02:00
parent db7cf3a089
commit 46dcf6afe9
No known key found for this signature in database
GPG key ID: C751E590D63F3D69
2 changed files with 9 additions and 1 deletions

View file

@ -1,5 +1,9 @@
#!/bin/bash #!/bin/bash
if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then
exit 0
fi
[[ -f /etc/default/grub ]] && . /etc/default/grub [[ -f /etc/default/grub ]] && . /etc/default/grub
[[ -f /etc/os-release ]] && . /etc/os-release [[ -f /etc/os-release ]] && . /etc/os-release

View file

@ -7,7 +7,7 @@
Name: grub2 Name: grub2
Epoch: 1 Epoch: 1
Version: 2.02 Version: 2.02
Release: 37%{?dist} Release: 38%{?dist}
Summary: Bootloader with support for Linux, Multiboot and more Summary: Bootloader with support for Linux, Multiboot and more
Group: System Environment/Base Group: System Environment/Base
License: GPLv3+ License: GPLv3+
@ -453,6 +453,10 @@ fi
%endif %endif
%changelog %changelog
* Fri Jun 15 2018 Javier Martinez Canillas <javierm@redhat.com> - 2.02-38
- Make 20-grub.install to exit if there is no machine ID set
Resolves: rhbz#1576573
* Thu Jun 07 2018 Javier Martinez Canillas <javierm@redhat.com> - 2.02-37 * Thu Jun 07 2018 Javier Martinez Canillas <javierm@redhat.com> - 2.02-37
- More fixes for BLS - More fixes for BLS
Resolves: rhbz#1588184 Resolves: rhbz#1588184