ryantimwilson / rpms / systemd

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