]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
51-dracut-rescue.install: fix initramfs not generated in /boot case
authorJavier Martinez Canillas <javierm@redhat.com>
Fri, 9 Mar 2018 17:54:49 +0000 (18:54 +0100)
committerHarald Hoyer <harald@hoyer.xyz>
Mon, 12 Mar 2018 08:05:40 +0000 (09:05 +0100)
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

index 3f07a698f2f9b4b351184eccbe0657fadf4a4a4c..679e94b1b8eb98e9e8460ee0f4227cf41d899d19 100755 (executable)
@@ -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"