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