28ab1c
From 9fdbd56ecef7498d2d61fc7123b958add945f46b Mon Sep 17 00:00:00 2001
28ab1c
From: Kairui Song <kasong@redhat.com>
28ab1c
Date: Sat, 12 Jun 2021 02:25:09 +0800
28ab1c
Subject: [PATCH] fix(dracut.sh): handle symlinks appropriately while using
28ab1c
 '-i' option
28ab1c
28ab1c
[[ -d $symlink ]] will return true if the symlink points to a directory.
28ab1c
So the symlink will not be copied, instead a directory is created with
28ab1c
the symlink name and the content is copied.
28ab1c
28ab1c
Signed-off-by: Kairui Song <kasong@redhat.com>
28ab1c
(cherry picked from commit c7fbc0c8901917baf0d1f0822568e65c6ec00d18)
28ab1c
28ab1c
Cherry-picked from: c7fbc0c8
28ab1c
Resolves: #1959336
28ab1c
---
28ab1c
 dracut.sh | 4 ++--
28ab1c
 1 file changed, 2 insertions(+), 2 deletions(-)
28ab1c
28ab1c
diff --git a/dracut.sh b/dracut.sh
28ab1c
index 3fd31e21..fa14e3ce 100755
28ab1c
--- a/dracut.sh
28ab1c
+++ b/dracut.sh
28ab1c
@@ -1609,8 +1609,8 @@ for ((i=0; i < ${#include_src[@]}; i++)); do
28ab1c
             reset_dotglob="$(shopt -p dotglob)"
28ab1c
             shopt -q -s dotglob
28ab1c
             for objectname in "$src"/*; do
28ab1c
-                [[ -e "$objectname" || -h "$objectname" ]] || continue
28ab1c
-                if [[ -d "$objectname" ]]; then
28ab1c
+                [[ -e $objectname || -L $objectname ]] || continue
28ab1c
+                if [[ -d $objectname ]] && [[ ! -L $objectname ]]; then
28ab1c
                     # objectname is a directory, let's compute the final directory name
28ab1c
                     object_destdir=${destdir}/${objectname#$src/}
28ab1c
                     if ! [[ -e "$object_destdir" ]]; then
28ab1c