Make installkernel to use kernel-install scripts on BLS configuration

Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Javier Martinez Canillas 2018-08-06 13:34:28 -04:00 committed by Peter Jones
parent 907d2ed59e
commit e10461b754
3 changed files with 68 additions and 3 deletions

View File

@ -0,0 +1,48 @@
From f93a35be5bdec17044dd2a17980689d3cbf73d58 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Tue, 31 Jul 2018 17:43:53 +0200
Subject: [PATCH] Make installkernel to use kernel-install scripts on BLS
configuration
The kernel make install target executes the arch/$ARCH/boot/install.sh
that in turns executes the distro specific installkernel script. This
script always uses new-kernel-pkg to install the kernel images.
But on a BootLoaderSpec setup, the kernel-install scripts must be used
instead. Check if the system uses a BLS setup, and call kernel-install
add in that case instead of new-kernel-pkg.
Reported-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
installkernel | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/installkernel b/installkernel
index b887929c179..68dcfac16d2 100755
--- a/installkernel
+++ b/installkernel
@@ -20,6 +20,8 @@
# Author(s): tyson@rwii.com
#
+[[ -f /etc/default/grub ]] && . /etc/default/grub
+
usage() {
echo "Usage: `basename $0` <kernel_version> <bootimage> <mapfile>" >&2
exit 1
@@ -77,6 +79,11 @@ cp $MAPFILE $INSTALL_PATH/System.map-$KERNEL_VERSION
ln -fs ${RELATIVE_PATH}$INSTALL_PATH/$KERNEL_NAME-$KERNEL_VERSION $LINK_PATH/$KERNEL_NAME
ln -fs ${RELATIVE_PATH}$INSTALL_PATH/System.map-$KERNEL_VERSION $LINK_PATH/System.map
+if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ] || [ ! -f /sbin/new-kernel-pkg ]; then
+ kernel-install add $KERNEL_VERSION $INSTALL_PATH/$KERNEL_NAME-$KERNEL_VERSION
+ exit $?
+fi
+
if [ -n "$cfgLoader" ] && [ -x /sbin/new-kernel-pkg ]; then
if [ -n "$(which dracut 2>/dev/null)" ]; then
new-kernel-pkg --mkinitrd --dracut --host-only --depmod --install --kernel-name $KERNEL_NAME $KERNEL_VERSION
--
2.17.1

View File

@ -1,6 +1,6 @@
Name: grubby
Version: 8.40
Release: 15%{?dist}
Release: 16%{?dist}
Summary: Command line tool for updating bootloader configs
License: GPLv2+
URL: https://github.com/rhinstaller/grubby
@ -11,14 +11,16 @@ URL: https://github.com/rhinstaller/grubby
Source0: https://github.com/rhboot/grubby/archive/%{version}-1.tar.gz
Source1: grubby-bls
Source2: grubby.in
Source3: installkernel.in
Patch1: drop-uboot-uImage-creation.patch
Patch2: 0001-Change-return-type-in-getRootSpecifier.patch
Patch3: 0002-Add-btrfs-subvolume-support-for-grub2.patch
Patch4: 0003-Add-tests-for-btrfs-support.patch
Patch5: 0004-Honor-sbindir.patch
Patch6: 0005-installkernel-use-kernel-install.patch
BuildRequires: pkgconfig glib2-devel popt-devel
BuildRequires: libblkid-devel git-core sed
BuildRequires: libblkid-devel git-core sed gcc make
# for make test / getopt:
BuildRequires: util-linux-ng
%ifarch aarch64 i686 x86_64 %{power64}
@ -62,11 +64,14 @@ make test
%install
make install DESTDIR=$RPM_BUILD_ROOT mandir=%{_mandir} sbindir=%{_sbindir}
mkdir -p %{buildroot}%{_libexecdir}/grubby/ %{buildroot}%{_sbindir}/
mkdir -p %{buildroot}%{_libexecdir}/{grubby,installkernel}/ %{buildroot}%{_sbindir}/
mv -v %{buildroot}%{_sbindir}/grubby %{buildroot}%{_libexecdir}/grubby/grubby
mv -v %{buildroot}%{_sbindir}/installkernel %{buildroot}%{_libexecdir}/installkernel/installkernel
cp -v %{SOURCE1} %{buildroot}%{_libexecdir}/grubby/
sed -e "s,@@LIBEXECDIR@@,%{_libexecdir}/grubby,g" %{SOURCE2} \
> %{buildroot}%{_sbindir}/grubby
sed -e "s,@@LIBEXECDIR@@,%{_libexecdir}/installkernel,g" %{SOURCE3} \
> %{buildroot}%{_sbindir}/installkernel
%package bls
Summary: Command line tool for updating BootLoaderSpec files
@ -82,6 +87,7 @@ meant to only be used for legacy compatibility users with existing grubby users.
%license COPYING
%dir %{_libexecdir}/grubby
%attr(0755,root,root) %{_libexecdir}/grubby/grubby
%attr(0755,root,root) %{_libexecdir}/installkernel/installkernel
%attr(0755,root,root) %{_sbindir}/grubby
%attr(0755,root,root) %{_sbindir}/installkernel
%attr(0755,root,root) %{_sbindir}/new-kernel-pkg
@ -96,6 +102,9 @@ meant to only be used for legacy compatibility users with existing grubby users.
%{_mandir}/man8/*.8*
%changelog
* Fri Aug 03 2018 Javier Martinez Canillas <javierm@redhat.com> - 8.40-16
- Make installkernel to use kernel-install scripts on BLS configuration
* Tue Jul 24 2018 Javier Martinez Canillas <javierm@redhat.com> - 8.40-15
- Fix grubby wrapper paths

8
installkernel.in Normal file
View File

@ -0,0 +1,8 @@
#!/bin/bash
if [[ -x @@LIBEXECDIR@@/installkernel ]] ; then
exec @@LIBEXECDIR@@/installkernel "${@}"
elif [[ -x @@LIBEXECDIR@@/installkernel-bls ]] ; then
exec @@LIBEXECDIR@@/installkernel-bls "${@}"
fi
echo "installkernel is not installed correctly." >>/dev/stderr
exit 1