Add an installkernel script for BLS configurations

Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Javier Martinez Canillas 2018-08-06 13:29:27 -04:00 committed by Peter Jones
parent c3049d21d8
commit b8ca92b29b
3 changed files with 108 additions and 1 deletions

View file

@ -7,7 +7,7 @@
Name: grub2 Name: grub2
Epoch: 1 Epoch: 1
Version: 2.02 Version: 2.02
Release: 42%{?dist} Release: 43%{?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+
@ -23,6 +23,8 @@ Source5: theme.tar.bz2
Source6: gitignore Source6: gitignore
Source8: strtoull_test.c Source8: strtoull_test.c
Source9: 20-grub.install Source9: 20-grub.install
Source10: installkernel-bls
Source11: installkernel.in
%include %{SOURCE1} %include %{SOURCE1}
@ -70,6 +72,7 @@ hardware devices.\
Summary: grub2 common layout Summary: grub2 common layout
Group: System Environment/Base Group: System Environment/Base
BuildArch: noarch BuildArch: noarch
Conflicts: grubby < 8.40-16.%{?dist}
%description common %description common
This package provides some directories which are required by various grub2 This package provides some directories which are required by various grub2
@ -219,6 +222,12 @@ install -d -m 0755 %{buildroot}%{_sysconfdir}/kernel/install.d/
install -m 0644 /dev/null %{buildroot}%{_sysconfdir}/kernel/install.d/20-grubby.install install -m 0644 /dev/null %{buildroot}%{_sysconfdir}/kernel/install.d/20-grubby.install
install -m 0644 /dev/null %{buildroot}%{_sysconfdir}/kernel/install.d/90-loaderentry.install install -m 0644 /dev/null %{buildroot}%{_sysconfdir}/kernel/install.d/90-loaderentry.install
# Install installkernel script
mkdir -p %{buildroot}%{_libexecdir}/installkernel/
cp -v %{SOURCE10} %{buildroot}%{_libexecdir}/installkernel/
sed -e "s,@@LIBEXECDIR@@,%{_libexecdir}/installkernel,g" %{SOURCE11} \
> %{buildroot}%{_sbindir}/installkernel
# Don't run debuginfo on all the grub modules and whatnot; it just # Don't run debuginfo on all the grub modules and whatnot; it just
# rejects them, complains, and slows down extraction. # rejects them, complains, and slows down extraction.
%global finddebugroot "%{_builddir}/%{?buildsubdir}/debug" %global finddebugroot "%{_builddir}/%{?buildsubdir}/debug"
@ -314,6 +323,8 @@ fi
%{_prefix}/lib/kernel/install.d/20-grub.install %{_prefix}/lib/kernel/install.d/20-grub.install
%{_sysconfdir}/kernel/install.d/20-grubby.install %{_sysconfdir}/kernel/install.d/20-grubby.install
%{_sysconfdir}/kernel/install.d/90-loaderentry.install %{_sysconfdir}/kernel/install.d/90-loaderentry.install
%{_libexecdir}/installkernel/installkernel-bls
%attr(0755,root,root) %{_sbindir}/installkernel
%dir %{_datarootdir}/grub %dir %{_datarootdir}/grub
%exclude %{_datarootdir}/grub/* %exclude %{_datarootdir}/grub/*
%dir /boot/%{name} %dir /boot/%{name}
@ -463,6 +474,9 @@ fi
%endif %endif
%changelog %changelog
* Fri Aug 03 2018 Javier Martinez Canillas <javierm@redhat.com> - 2.02-43
- Add an installkernel script for BLS configurations
* Fri Aug 03 2018 Peter Jones <pjones@redhat.com> - 2.02-42 * Fri Aug 03 2018 Peter Jones <pjones@redhat.com> - 2.02-42
- Kill .note.gnu.property with fire. - Kill .note.gnu.property with fire.
Related: rhbz#1612339 Related: rhbz#1612339

85
installkernel-bls Executable file
View file

@ -0,0 +1,85 @@
#! /bin/sh
#
# /sbin/installkernel
#
# Copyright 2007-2008 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Author(s): tyson@rwii.com
#
[[ -f /etc/default/grub ]] && . /etc/default/grub
usage() {
echo "Usage: `basename $0` <kernel_version> <bootimage> <mapfile>" >&2
exit 1
}
cfgLoader=
if [ -z "$INSTALL_PATH" -o "$INSTALL_PATH" == "/boot" ]; then
INSTALL_PATH=/boot
cfgLoader=1
fi
LINK_PATH=/boot
RELATIVE_PATH=`echo "$INSTALL_PATH/" | sed "s|^$LINK_PATH/||"`
KERNEL_VERSION=$1
BOOTIMAGE=$2
MAPFILE=$3
ARCH=$(uname -m)
if [ $ARCH = 'ppc64' -o $ARCH = 'ppc' ]; then
KERNEL_NAME=vmlinux
else
KERNEL_NAME=vmlinuz
fi
if [ -z "$KERNEL_VERSION" -o -z "$BOOTIMAGE" -o -z "$MAPFILE" ]; then
usage
fi
if [ -f $INSTALL_PATH/$KERNEL_NAME-$KERNEL_VERSION ]; then
mv $INSTALL_PATH/$KERNEL_NAME-$KERNEL_VERSION \
$INSTALL_PATH/$KERNEL_NAME-$KERNEL_VERSION.old;
fi
if [ ! -L $INSTALL_PATH/$KERNEL_NAME ]; then
if [ -e $INSTALLPATH/$KERNEL_NAME ]; then
mv $INSTALL_PATH/$KERNEL_NAME $INSTALL_PATH/$KERNEL_NAME.old
fi
fi
if [ -f $INSTALL_PATH/System.map-$KERNEL_VERSION ]; then
mv $INSTALL_PATH/System.map-$KERNEL_VERSION \
$INSTALL_PATH/System.map-$KERNEL_VERSION.old;
fi
if [ ! -L $INSTALL_PATH/System.map ]; then
if [ -e $INSTALLPATH/System.map ]; then
mv $INSTALL_PATH/System.map $INSTALL_PATH/System.map.old
fi
fi
ln -sf ${RELATIVE_PATH}$INSTALL_PATH/System.map-$KERNEL_VERSION $LINK_PATH/System.map
cat $BOOTIMAGE > $INSTALL_PATH/$KERNEL_NAME-$KERNEL_VERSION
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 [ -n "$cfgLoader" ] && [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then
kernel-install add $KERNEL_VERSION $INSTALL_PATH/$KERNEL_NAME-$KERNEL_VERSION
exit $?
fi

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