|
Harald Hoyer |
908de0 |
From 019766177baf70d5a4f688adb768b07f28fd90a9 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 |
908de0 |
src/kernel-install/kernel-install | 47 +++++++++++++++++++++++++++++++++++++++
|
|
Harald Hoyer |
908de0 |
1 file changed, 47 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 |
908de0 |
index 3ae1d77..041f526
|
|
Harald Hoyer |
2e2e24 |
--- a/src/kernel-install/kernel-install
|
|
Harald Hoyer |
2e2e24 |
+++ b/src/kernel-install/kernel-install
|
|
Harald Hoyer |
908de0 |
@@ -71,6 +71,53 @@ 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 |
+ [[ "$KERNEL_VERSION" == *\+* ]] && flavor=-"${KERNEL_VERSION##*+}"
|
|
Harald Hoyer |
bd236f |
+ case "$COMMAND" in
|
|
Harald Hoyer |
2e2e24 |
+ add)
|
|
Harald Hoyer |
908de0 |
+ if [[ "${KERNEL_DIR}" != "/boot" ]]; then
|
|
Harald Hoyer |
908de0 |
+ for i in \
|
|
Harald Hoyer |
908de0 |
+ "$KERNEL_IMAGE" \
|
|
Harald Hoyer |
908de0 |
+ "$KERNEL_DIR"/System.map \
|
|
Harald Hoyer |
908de0 |
+ "$KERNEL_DIR"/config \
|
|
Harald Hoyer |
908de0 |
+ "$KERNEL_DIR"/zImage.stub \
|
|
Harald Hoyer |
908de0 |
+ "$KERNEL_DIR"/dtb \
|
|
Harald Hoyer |
908de0 |
+ ; do
|
|
Harald Hoyer |
908de0 |
+ [[ -e "$i" ]] || continue
|
|
Harald Hoyer |
908de0 |
+ if [ -d "$i" ]; then
|
|
Harald Hoyer |
908de0 |
+ cp -a "$i" -t "/boot/${i##*/}-${KERNEL_VERSION}"
|
|
Harald Hoyer |
908de0 |
+ else
|
|
Harald Hoyer |
908de0 |
+ cp -a "$i" "/boot/${i##*/}-${KERNEL_VERSION}"
|
|
Harald Hoyer |
908de0 |
+ fi
|
|
Harald Hoyer |
908de0 |
+ command -v restorecon &>/dev/null && \
|
|
Harald Hoyer |
908de0 |
+ restorecon -R "/boot/${i##*/}-${KERNEL_VERSION}"
|
|
Harald Hoyer |
908de0 |
+ done
|
|
Harald Hoyer |
908de0 |
+ # hmac is .vmlinuz-<version>.hmac so needs a special treatment
|
|
Harald Hoyer |
908de0 |
+ i="$KERNEL_DIR/.${KERNEL_IMAGE##*/}.hmac"
|
|
Harald Hoyer |
908de0 |
+ if [[ -e "$i" ]]; then
|
|
Harald Hoyer |
908de0 |
+ cp -a "$i" "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac"
|
|
Harald Hoyer |
908de0 |
+ command -v restorecon &>/dev/null && \
|
|
Harald Hoyer |
908de0 |
+ restorecon "/boot/.${KERNEL_IMAGE##*/}-${KERNEL_VERSION}.hmac"
|
|
Harald Hoyer |
908de0 |
+ fi
|
|
Harald Hoyer |
908de0 |
+ fi
|
|
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 |
908de0 |
2.7.0
|
|
Harald Hoyer |
bd236f |
|