summaryrefslogtreecommitdiffstats
path: root/0065-51-dracut-rescue-postinst.sh-Rename-image-and-grub-e.patch
blob: d088ecab1ba999985f86ea12a17c80c055172a66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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+=$?))