From 967db700905e0f54a159152352116b995ec38737 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 20 Mar 2013 06:39:13 +0100
Subject: [PATCH] 51-dracut-rescue-postinst.sh: Rename image and grub entry
grub2-mkconfig ordered the rescue entries higher than the normal ones.
https://bugzilla.redhat.com/show_bug.cgi?id=923439
---
51-dracut-rescue-postinst.sh | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/51-dracut-rescue-postinst.sh b/51-dracut-rescue-postinst.sh
index d206496..8b4e6c3 100755
--- a/51-dracut-rescue-postinst.sh
+++ b/51-dracut-rescue-postinst.sh
@@ -13,8 +13,10 @@ KERNEL_IMAGE="$2"
[[ $MACHINE_ID ]] || exit 1
[[ -f $KERNEL_IMAGE ]] || exit 1
-INITRDFILE="/boot/initramfs-${MACHINE_ID}-rescue.img"
-[[ -f $INITRDFILE ]] && exit 0
+INITRDFILE="/boot/initramfs-0-rescue-${MACHINE_ID}.img"
+NEW_KERNEL_IMAGE="${KERNEL_IMAGE%/*}/vmlinuz-0-rescue-${MACHINE_ID}"
+
+[[ -f $INITRDFILE ]] && [[ -f $NEW_KERNEL_IMAGE ]] && exit 0
dropindirs_sort()
{
@@ -46,15 +48,17 @@ done
[[ $dracut_rescue_image != "yes" ]] && exit 0
-dracut --no-hostonly -a "rescue" "$INITRDFILE" "$KERNEL_VERSION"
-((ret+=$?))
-
-cp "$KERNEL_IMAGE" "${KERNEL_IMAGE%/*}/vmlinuz-${MACHINE_ID}-rescue"
-((ret+=$?))
+if [[ ! -f $INITRDFILE ]]; then
+ dracut --no-hostonly -a "rescue" "$INITRDFILE" "$KERNEL_VERSION"
+ ((ret+=$?))
+fi
-KERNEL_IMAGE="${KERNEL_IMAGE%/*}/vmlinuz-${MACHINE_ID}-rescue"
+if [[ ! -f $NEW_KERNEL_IMAGE ]]; then
+ cp "$KERNEL_IMAGE" "$NEW_KERNEL_IMAGE"
+ ((ret+=$?))
+fi
-new-kernel-pkg --install "$KERNEL_VERSION" --kernel-image "$KERNEL_IMAGE" --initrdfile "$INITRDFILE" --banner "$PRETTY_NAME Rescue"
+new-kernel-pkg --install "$KERNEL_VERSION" --kernel-image "$NEW_KERNEL_IMAGE" --initrdfile "$INITRDFILE" --banner "$NAME $VERSION_ID Rescue $MACHINE_ID"
((ret+=$?))