Make installkernel to use kernel-install scripts on BLS configuration

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
Javier Martinez Canillas 2018-08-06 13:34:28 -04:00
parent 5e1de1e87d
commit 6a009b55ac
No known key found for this signature in database
GPG Key ID: C751E590D63F3D69
3 changed files with 69 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 Name: grubby
Version: 8.40 Version: 8.40
Release: 17%{?dist} Release: 18%{?dist}
Summary: Command line tool for updating bootloader configs Summary: Command line tool for updating bootloader configs
License: GPLv2+ License: GPLv2+
URL: https://github.com/rhinstaller/grubby URL: https://github.com/rhinstaller/grubby
@ -11,16 +11,18 @@ URL: https://github.com/rhinstaller/grubby
Source0: https://github.com/rhboot/grubby/archive/%{version}-1.tar.gz Source0: https://github.com/rhboot/grubby/archive/%{version}-1.tar.gz
Source1: grubby-bls Source1: grubby-bls
Source2: grubby.in Source2: grubby.in
Source3: installkernel.in
Patch1: drop-uboot-uImage-creation.patch Patch1: drop-uboot-uImage-creation.patch
Patch2: 0001-Change-return-type-in-getRootSpecifier.patch Patch2: 0001-Change-return-type-in-getRootSpecifier.patch
Patch3: 0002-Add-btrfs-subvolume-support-for-grub2.patch Patch3: 0002-Add-btrfs-subvolume-support-for-grub2.patch
Patch4: 0003-Add-tests-for-btrfs-support.patch Patch4: 0003-Add-tests-for-btrfs-support.patch
Patch5: 0004-Use-system-LDFLAGS.patch Patch5: 0004-Use-system-LDFLAGS.patch
Patch6: 0004-Honor-sbindir.patch Patch6: 0004-Honor-sbindir.patch
Patch7: 0005-installkernel-use-kernel-install.patch
BuildRequires: gcc BuildRequires: gcc
BuildRequires: pkgconfig glib2-devel popt-devel BuildRequires: pkgconfig glib2-devel popt-devel
BuildRequires: libblkid-devel git-core sed BuildRequires: libblkid-devel git-core sed make
# for make test / getopt: # for make test / getopt:
BuildRequires: util-linux-ng BuildRequires: util-linux-ng
%ifarch aarch64 i686 x86_64 %{power64} %ifarch aarch64 i686 x86_64 %{power64}
@ -64,11 +66,14 @@ make test
%install %install
make install DESTDIR=$RPM_BUILD_ROOT mandir=%{_mandir} sbindir=%{_sbindir} 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}/grubby %{buildroot}%{_libexecdir}/grubby/grubby
mv -v %{buildroot}%{_sbindir}/installkernel %{buildroot}%{_libexecdir}/installkernel/installkernel
cp -v %{SOURCE1} %{buildroot}%{_libexecdir}/grubby/ cp -v %{SOURCE1} %{buildroot}%{_libexecdir}/grubby/
sed -e "s,@@LIBEXECDIR@@,%{_libexecdir}/grubby,g" %{SOURCE2} \ sed -e "s,@@LIBEXECDIR@@,%{_libexecdir}/grubby,g" %{SOURCE2} \
> %{buildroot}%{_sbindir}/grubby > %{buildroot}%{_sbindir}/grubby
sed -e "s,@@LIBEXECDIR@@,%{_libexecdir}/installkernel,g" %{SOURCE3} \
> %{buildroot}%{_sbindir}/installkernel
%package bls %package bls
Summary: Command line tool for updating BootLoaderSpec files Summary: Command line tool for updating BootLoaderSpec files
@ -84,6 +89,8 @@ meant to only be used for legacy compatibility users with existing grubby users.
%license COPYING %license COPYING
%dir %{_libexecdir}/grubby %dir %{_libexecdir}/grubby
%attr(0755,root,root) %{_libexecdir}/grubby/grubby %attr(0755,root,root) %{_libexecdir}/grubby/grubby
%dir %{_libexecdir}/installkernel
%attr(0755,root,root) %{_libexecdir}/installkernel/installkernel
%attr(0755,root,root) %{_sbindir}/grubby %attr(0755,root,root) %{_sbindir}/grubby
%attr(0755,root,root) %{_sbindir}/installkernel %attr(0755,root,root) %{_sbindir}/installkernel
%attr(0755,root,root) %{_sbindir}/new-kernel-pkg %attr(0755,root,root) %{_sbindir}/new-kernel-pkg
@ -98,6 +105,9 @@ meant to only be used for legacy compatibility users with existing grubby users.
%{_mandir}/man8/*.8* %{_mandir}/man8/*.8*
%changelog %changelog
* Fri Aug 10 2018 Javier Martinez Canillas <javierm@redhat.com> - 8.40-18
- Make installkernel to use kernel-install scripts on BLS configuration
* Tue Jul 24 2018 Javier Martinez Canillas <javierm@redhat.com> - 8.40-17 * Tue Jul 24 2018 Javier Martinez Canillas <javierm@redhat.com> - 8.40-17
- Fix grubby wrapper paths - Fix grubby wrapper paths
Resolves: rhbz#1607981 Resolves: rhbz#1607981

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