richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
Blob Blame History Raw
From c49c37d5e26bf71a97d5194d390f80d3e71758e1 Mon Sep 17 00:00:00 2001
From: systemd team <systemd-maint@redhat.com>
Date: Tue, 23 Apr 2019 10:46:19 -0300
Subject: [PATCH] Update kernel-install script by backporting fedora patches

---
 src/kernel-install/kernel-install | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install
index f1c74de..d860701 100755
--- a/src/kernel-install/kernel-install
+++ b/src/kernel-install/kernel-install
@@ -73,23 +73,27 @@ KERNEL_IMAGE="$2"
 
 if [[ -x /sbin/new-kernel-pkg ]]; then
     KERNEL_DIR="${KERNEL_IMAGE%/*}"
-    if [[ "${KERNEL_DIR}" != "/boot" ]]; then
-        for i in \
-            "$KERNEL_IMAGE" \
-            "$KERNEL_DIR/.${KERNEL_IMAGE##*/}.hmac" \
-            "$KERNEL_DIR"/System.map \
-            "$KERNEL_DIR"/config \
-            "$KERNEL_DIR"/zImage.stub \
-            "$KERNEL_DIR"/dtb \
-            ; do
-            [[ -e "$i" ]] || continue
-            cp -a "$i" "/boot/${i##*/}-${KERNEL_VERSION}"
-        done
-    fi
 
     [[ "$KERNEL_VERSION" == *\+* ]] && flavor=-"${KERNEL_VERSION##*+}"
     case "$COMMAND" in
         add)
+            if [[ "${KERNEL_DIR}" != "/boot" ]]; then
+                for i in \
+                    "$KERNEL_IMAGE" \
+                    "$KERNEL_DIR"/System.map \
+                    "$KERNEL_DIR"/config \
+                    "$KERNEL_DIR"/zImage.stub \
+                    "$KERNEL_DIR"/dtb \
+                    ; do
+                    [[ -e "$i" ]] || continue
+                    cp -aT "$i" "/boot/${i##*/}-${KERNEL_VERSION}"
+                done
+                # hmac is .vmlinuz-<version>.hmac so needs a special treatment
+                i="$KERNEL_DIR/.${KERNEL_IMAGE##*/}.hmac"
+                if [[ -e "$i" ]]; then
+                    cp -aT "$i" "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac"
+                fi
+            fi
             /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}" --rpmposttrans "$KERNEL_VERSION" || exit $?
-- 
1.8.3.1