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