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