kernel-install-grubby.patch: only copy files to /boot on "add"

Also make sure directories are copied to the same place and not in the
already existing directory.

https://bugzilla.redhat.com/show_bug.cgi?id=129901
This commit is contained in:
Harald Hoyer 2016-02-11 10:54:29 +01:00
parent 340bf090f9
commit 908de082ce

View File

@ -1,26 +1,29 @@
From 860be9427dff48efc5e486b039be932094572047 Mon Sep 17 00:00:00 2001 From 019766177baf70d5a4f688adb768b07f28fd90a9 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com> From: Harald Hoyer <harald@redhat.com>
Date: Tue, 14 Jan 2014 17:48:08 -0500 Date: Tue, 14 Jan 2014 17:48:08 -0500
Subject: [PATCH] kernel-install: add fedora specific callouts to Subject: [PATCH] kernel-install: add fedora specific callouts to
new-kernel-pkg new-kernel-pkg
--- ---
src/kernel-install/kernel-install | 44 +++++++++++++++++++++++++++++++++++++++ src/kernel-install/kernel-install | 47 +++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+) 1 file changed, 47 insertions(+)
mode change 100644 => 100755 src/kernel-install/kernel-install mode change 100644 => 100755 src/kernel-install/kernel-install
diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install
old mode 100644 old mode 100644
new mode 100755 new mode 100755
index 3ae1d77..5c1e4fc index 3ae1d77..041f526
--- a/src/kernel-install/kernel-install --- a/src/kernel-install/kernel-install
+++ b/src/kernel-install/kernel-install +++ b/src/kernel-install/kernel-install
@@ -71,6 +71,50 @@ fi @@ -71,6 +71,53 @@ fi
KERNEL_VERSION="$1" KERNEL_VERSION="$1"
KERNEL_IMAGE="$2" KERNEL_IMAGE="$2"
+if [[ -x /sbin/new-kernel-pkg ]]; then +if [[ -x /sbin/new-kernel-pkg ]]; then
+ KERNEL_DIR="${KERNEL_IMAGE%/*}" + KERNEL_DIR="${KERNEL_IMAGE%/*}"
+ [[ "$KERNEL_VERSION" == *\+* ]] && flavor=-"${KERNEL_VERSION##*+}"
+ case "$COMMAND" in
+ add)
+ if [[ "${KERNEL_DIR}" != "/boot" ]]; then + if [[ "${KERNEL_DIR}" != "/boot" ]]; then
+ for i in \ + for i in \
+ "$KERNEL_IMAGE" \ + "$KERNEL_IMAGE" \
@ -30,9 +33,13 @@ index 3ae1d77..5c1e4fc
+ "$KERNEL_DIR"/dtb \ + "$KERNEL_DIR"/dtb \
+ ; do + ; do
+ [[ -e "$i" ]] || continue + [[ -e "$i" ]] || continue
+ if [ -d "$i" ]; then
+ cp -a "$i" -t "/boot/${i##*/}-${KERNEL_VERSION}"
+ else
+ cp -a "$i" "/boot/${i##*/}-${KERNEL_VERSION}" + cp -a "$i" "/boot/${i##*/}-${KERNEL_VERSION}"
+ fi
+ command -v restorecon &>/dev/null && \ + command -v restorecon &>/dev/null && \
+ restorecon "/boot/${i##*/}-${KERNEL_VERSION}" + restorecon -R "/boot/${i##*/}-${KERNEL_VERSION}"
+ done + done
+ # hmac is .vmlinuz-<version>.hmac so needs a special treatment + # hmac is .vmlinuz-<version>.hmac so needs a special treatment
+ i="$KERNEL_DIR/.${KERNEL_IMAGE##*/}.hmac" + i="$KERNEL_DIR/.${KERNEL_IMAGE##*/}.hmac"
@ -42,10 +49,6 @@ index 3ae1d77..5c1e4fc
+ restorecon "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac" + restorecon "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac"
+ fi + fi
+ fi + fi
+
+ [[ "$KERNEL_VERSION" == *\+* ]] && flavor=-"${KERNEL_VERSION##*+}"
+ case "$COMMAND" in
+ add)
+ /sbin/new-kernel-pkg --package "kernel${flavor}" --install "$KERNEL_VERSION" || exit $? + /sbin/new-kernel-pkg --package "kernel${flavor}" --install "$KERNEL_VERSION" || exit $?
+ /sbin/new-kernel-pkg --package "kernel${flavor}" --mkinitrd --dracut --depmod --update "$KERNEL_VERSION" || exit $? + /sbin/new-kernel-pkg --package "kernel${flavor}" --mkinitrd --dracut --depmod --update "$KERNEL_VERSION" || exit $?
+ /sbin/new-kernel-pkg --package "kernel${flavor}" --rpmposttrans "$KERNEL_VERSION" || exit $? + /sbin/new-kernel-pkg --package "kernel${flavor}" --rpmposttrans "$KERNEL_VERSION" || exit $?
@ -67,5 +70,5 @@ index 3ae1d77..5c1e4fc
read MACHINE_ID < /etc/machine-id read MACHINE_ID < /etc/machine-id
fi fi
-- --
2.6.0 2.7.0