From f8c24964cdde2b8c1569ab33225108573682d3b7 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Fri, 9 Mar 2018 18:54:49 +0100
Subject: [PATCH] 51-dracut-rescue.install: fix initramfs not generated in
/boot case
Commit 5e574046e76e ("5?-dracut*.install: Allow scripts to install
the initramfs in /boot dir") added support to generate initramfs
images in the /boot directory and copy the respective BLS files.
Unfortunately, it broke the rescue initramfs generation when it's
not installed on /boot due not checking for the correct condition.
It checks for the 0-rescue sub-dir to exist, but this is created so
instead if the parent sub-dir exists has to be checked. Also, check
if the destination directory is /boot or not, instead if it exists.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
51-dracut-rescue.install | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/51-dracut-rescue.install b/51-dracut-rescue.install
index 3f07a698..679e94b1 100755
--- a/51-dracut-rescue.install
+++ b/51-dracut-rescue.install
@@ -63,7 +63,7 @@ if ! [[ ${BOOT_OPTIONS[*]} ]]; then
exit 1
fi
-if [[ -d "$BOOT_DIR_ABS" ]]; then
+if [[ -d "${BOOT_DIR_ABS%/*}" ]]; then
BOOT_DIR="/${MACHINE_ID}/0-rescue"
BOOT_ROOT=${BOOT_DIR_ABS%$BOOT_DIR}
LOADER_ENTRY="$BOOT_ROOT/loader/entries/${MACHINE_ID}-0-rescue.conf"
@@ -106,7 +106,7 @@ case "$COMMAND" in
((ret+=$?))
fi
- if [[ -d "$BOOT_DIR" ]]; then
+ if [[ "${BOOT_DIR_ABS}" != "/boot" ]]; then
{
echo "title $PRETTY_NAME - Rescue Image"
echo "version $KERNEL_VERSION"