diff --git a/grubby.spec b/grubby.spec index cbd3860..927385f 100644 --- a/grubby.spec +++ b/grubby.spec @@ -12,6 +12,7 @@ Source0: https://github.com/rhboot/grubby/archive/%{version}-1.tar.gz Source1: grubby-bls Source2: grubby.in Source3: installkernel.in +Source4: installkernel-bls Patch1: drop-uboot-uImage-creation.patch Patch2: 0001-Change-return-type-in-getRootSpecifier.patch Patch3: 0002-Add-btrfs-subvolume-support-for-grub2.patch @@ -66,6 +67,7 @@ mkdir -p %{buildroot}%{_libexecdir}/{grubby,installkernel}/ %{buildroot}%{_sbind 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 %{SOURCE4} %{buildroot}%{_libexecdir}/installkernel/ sed -e "s,@@LIBEXECDIR@@,%{_libexecdir}/grubby,g" %{SOURCE2} \ > %{buildroot}%{_sbindir}/grubby sed -e "s,@@LIBEXECDIR@@,%{_libexecdir}/installkernel,g" %{SOURCE3} \ @@ -92,6 +94,7 @@ current boot environment. %dir %{_libexecdir}/installkernel %attr(0755,root,root) %{_libexecdir}/grubby/grubby-bls %attr(0755,root,root) %{_sbindir}/grubby +%attr(0755,root,root) %{_libexecdir}/installkernel/installkernel-bls %attr(0755,root,root) %{_sbindir}/installkernel %{_mandir}/man8/[gi]*.8* diff --git a/installkernel-bls b/installkernel-bls new file mode 100755 index 0000000..d66c44a --- /dev/null +++ b/installkernel-bls @@ -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 . +# +# Author(s): tyson@rwii.com +# + +[[ -f /etc/default/grub ]] && . /etc/default/grub + +usage() { + echo "Usage: `basename $0` " >&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