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