923a60
From 139d2c57d86203e421b17a4b6ec168c49fcb9893 Mon Sep 17 00:00:00 2001
923a60
From: Harald Hoyer <harald@redhat.com>
923a60
Date: Tue, 14 Jan 2014 17:48:08 -0500
923a60
Subject: [PATCH] kernel-install: add fedora specific callouts to
923a60
 new-kernel-pkg
923a60
923a60
---
923a60
 src/kernel-install/kernel-install | 36 +++++++++++++++++++++++++++++++
923a60
 1 file changed, 36 insertions(+)
923a60
 mode change 100644 => 100755 src/kernel-install/kernel-install
923a60
923a60
diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install
923a60
old mode 100644
923a60
new mode 100755
923a60
index 3ae1d77e33..f1c74de27e
923a60
--- a/src/kernel-install/kernel-install
923a60
+++ b/src/kernel-install/kernel-install
923a60
@@ -71,6 +71,42 @@ fi
923a60
 KERNEL_VERSION="$1"
923a60
 KERNEL_IMAGE="$2"
923a60
 
923a60
+if [[ -x /sbin/new-kernel-pkg ]]; then
923a60
+    KERNEL_DIR="${KERNEL_IMAGE%/*}"
923a60
+    if [[ "${KERNEL_DIR}" != "/boot" ]]; then
923a60
+        for i in \
923a60
+            "$KERNEL_IMAGE" \
923a60
+            "$KERNEL_DIR/.${KERNEL_IMAGE##*/}.hmac" \
923a60
+            "$KERNEL_DIR"/System.map \
923a60
+            "$KERNEL_DIR"/config \
923a60
+            "$KERNEL_DIR"/zImage.stub \
923a60
+            "$KERNEL_DIR"/dtb \
923a60
+            ; do
923a60
+            [[ -e "$i" ]] || continue
923a60
+            cp -a "$i" "/boot/${i##*/}-${KERNEL_VERSION}"
923a60
+        done
923a60
+    fi
923a60
+
923a60
+    [[ "$KERNEL_VERSION" == *\+* ]] && flavor=-"${KERNEL_VERSION##*+}"
923a60
+    case "$COMMAND" in
923a60
+        add)
923a60
+            /sbin/new-kernel-pkg --package "kernel${flavor}" --install "$KERNEL_VERSION" || exit $?
923a60
+            /sbin/new-kernel-pkg --package "kernel${flavor}" --mkinitrd --dracut --depmod --update "$KERNEL_VERSION" || exit $?
923a60
+            /sbin/new-kernel-pkg --package "kernel${flavor}" --rpmposttrans "$KERNEL_VERSION" || exit $?
923a60
+            ;;
923a60
+        remove)
923a60
+            /sbin/new-kernel-pkg --package "kernel${flavor+-$flavor}" --rminitrd --rmmoddep --remove "$KERNEL_VERSION" || exit $?
923a60
+            ;;
923a60
+        *)
923a60
+            ;;
923a60
+    esac
923a60
+
923a60
+    # exit, if we can't find a boot loader spec conforming setup
923a60
+    if ! [[ -d /boot/loader/entries || -L /boot/loader/entries ]]; then
923a60
+        exit 0
923a60
+    fi
923a60
+fi
923a60
+
923a60
 if [[ -f /etc/machine-id ]]; then
923a60
     read MACHINE_ID < /etc/machine-id
923a60
 fi